mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 22:18:29 +00:00
Handling sound ending in update method
This commit is contained in:
parent
0d0df1900b
commit
72955bfe30
1 changed files with 6 additions and 2 deletions
|
@ -167,14 +167,18 @@ var HTML5AudioSound = new Class({
|
|||
}
|
||||
return;
|
||||
}
|
||||
// handle looping
|
||||
var startTime = (this.currentMarker ? this.currentMarker.start : 0);
|
||||
// handle looping and ending
|
||||
var startTime = this.currentMarker ? this.currentMarker.start : 0;
|
||||
var endTime = startTime + this.duration;
|
||||
var currentTime = this.audio.currentTime;
|
||||
if (currentTime >= endTime) {
|
||||
if (this.currentConfig.loop) {
|
||||
this.audio.currentTime = startTime + (currentTime - endTime);
|
||||
}
|
||||
else {
|
||||
this.reset();
|
||||
this.stopAndReleaseAudioTag();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue