Skip to content

Commit af8666f

Browse files
Added reset method that calls super stop method in order to reset sounds state
Calling reset method and setting audio to null after hijacking audio tag from another sound
1 parent 106e324 commit af8666f

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/sound/html5/HTML5AudioSound.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,14 @@ var HTML5AudioSound = new Class({
9191
});
9292
var selectedSound = otherSounds_1[0];
9393
this.audio = selectedSound.audio;
94+
selectedSound.reset();
95+
selectedSound.audio = null;
9496
}
9597
return true;
9698
},
99+
reset: function () {
100+
BaseSound.prototype.stop.call(this);
101+
},
97102
update: function (time, delta) {
98103

99104
},
@@ -169,10 +174,14 @@ Object.defineProperty(HTML5AudioSound.prototype, 'seek', {
169174
}
170175
},
171176
set: function (value) {
177+
if (this.startTime > 0) {
178+
return;
179+
}
172180
if (this.isPlaying || this.isPaused) {
173181
value = Math.min(Math.max(0, value), this.duration);
174182
if (this.isPlaying) {
175-
this.audio.currentTime = value;
183+
this.previousTime =
184+
this.audio.currentTime = value;
176185
}
177186
else if (this.isPaused) {
178187
this.currentConfig.seek = value;

0 commit comments

Comments
 (0)