Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed additional scoping bug when audio stalls.

  • Loading branch information...
commit 527f7f2ef8beb057bab82c58237fb4cf2adec62b 1 parent 8bd1651
@lannymcnie lannymcnie authored
Showing with 10 additions and 5 deletions.
  1. +10 −5 src/soundjs/SoundJS.js
View
15 src/soundjs/SoundJS.js
@@ -1119,26 +1119,31 @@
*
*/
SoundJS.handleAudioStall = function(event) {
- setTimeout(function(){ SoundJS.testAudioStall(event) }, 0);
+ var element = this;
+ setTimeout(function(){ SoundJS.testAudioStall(element, event) }, 0);
}
/**
* Checks if callback exists and calls it with the name of sound stalling.
- * Do not call directly as this is an event listener.
+ * Do not call directly as this is handled similar to an event listener.
+ *
+ * Note that this is called on a delay by the above method, and as such
+ * has be descoped to belong to SoundJS instead of the audio window which
+ * why it requires a target element to be passed in.
*
* @private
*
*/
- SoundJS.testAudioStall = function(event) {
- var parts = this.id.split("_");
+ SoundJS.testAudioStall = function(target, event) {
+ var parts = target.id.split("_");
if(SoundJS.soundHash[parts[0]][parts[1]].loaded){
return;
}
if (SoundJS.onStall) {
- SoundJS.onStall(this, parts[0], parts[1]);
+ SoundJS.onStall(target, parts[0], parts[1]);
}
SoundJS.loadNext();

0 comments on commit 527f7f2

Please sign in to comment.
Something went wrong with that request. Please try again.