Skip to content
This repository has been archived by the owner. It is now read-only.

json2 undefined using waveform.dataFromSoundCloudTrack() #2

Closed
meleyal opened this issue Jul 2, 2012 · 4 comments

Comments

@meleyal
Copy link

commented Jul 2, 2012

Using the waveform.dataFromSoundCloudTrack() method causes the following error:

Uncaught TypeError: Property 'json2' of object [object Window] is not a function
@gherkins

This comment has been minimized.

Copy link

commented Aug 24, 2012

Also having that issue when loading data for multiple waveforms. jsonp call for the last waveform always fails with the error message above.

@cucko

This comment has been minimized.

Copy link

commented Oct 19, 2012

just find this line in waveform.js
jsonp = "json" + (++counter);
and change it to
jsonp = "json";// + (++counter);

works for me for now.

ccoenen added a commit to meso-unimpressed/waveformjs that referenced this issue Nov 8, 2012

fixing soundcloud#2 scope/closure problem: the wrong jsonp-function w…
…as removed (always the last one), if you did multiple calls to waveform.js in short succession. also fixes polluted window scope with jsonpN properties.
@ccoenen

This comment has been minimized.

Copy link

commented Nov 8, 2012

We came across that same issue. It's actually a scope-problem that is well-masked in coffeescript. We solved it by introducing a local variable for the counter.

We also solved the pollution in the window scope by switching around the
window.jsonpN = null
and
delete window.jsonpN

@wfsmith

This comment has been minimized.

Copy link

commented Nov 13, 2013

I am having this issue. Neother cucko nor ccoenen's solutions have worked for me. I am making a waveform call from within a modified sc-player.js.

I am not seeing the behavior described above. The error happens even with 2 calls on a page; it is not always the last item called; and it does not happen 100% of the time (though nearly 100%. I would say 95% of the time).

Here is a working example of the bug: http://jsfiddle.net/VHPkD/

@meleyal meleyal closed this Jan 9, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
5 participants
You can’t perform that action at this time.