Skip to content

Commit aab5150

Browse files
Setting source to null before calling stop on it to determine if onended event was fired when sound ended or when it was stopped by user
1 parent 04eb680 commit aab5150

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

v3/src/sound/webaudio/WebAudioSound.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,12 @@ var WebAudioSound = new Class({
123123
*/
124124
stopAndRemoveBufferSource: function () {
125125
if (this.source) {
126-
this.source.stop();
126+
var source = this.source;
127127
this.source = null;
128+
// Setting source to null before calling stop on it
129+
// to determine if onended event was fired when sound
130+
// ended or when it was stopped by user
131+
source.stop();
128132
}
129133
},
130134
update: function () {

0 commit comments

Comments
 (0)