Skip to content

Commit 54683b7

Browse files
committed
Sounds played using the Audio tag, that were paused and then resumed again (either directly in code, or via a game pause event) would not resume from the point at which they paused (thanks @rroylance phaserjs#2473)
1 parent 02e8b1a commit 54683b7

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
359359
* InputHandler.checkPointerDown and checkPointerOver will now test the worldTransform scale property of a Sprite. If zero it will fast return, where-as before it would incorrectly report an up event (thanks @jaapaurelio #2466)
360360
* Fixed a bug in Arcade Physics Body.preUpdate which would incorrectly apply the position of an offset Body (one which has had Body.setSize used on it) when combined with a Sprite with a non-zero anchor (thanks @SBCGames #2470)
361361
* If you set Game.renderType to `Phaser.HEADLESS` it will no longer render the output to the canvas. The canvas is still created (although not added to the DOM), as it's required internally, but no rendering now takes place on it (thanks @ForgeableSum #2464)
362+
* Sounds played using the Audio tag, that were paused and then resumed again (either directly in code, or via a game pause event) would not resume from the point at which they paused (thanks @rroylance #2473)
362363

363364
### Pixi Updates
364365

src/sound/Sound.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,12 @@ Phaser.Sound = function (game, key, volume, loop, connect) {
300300
*/
301301
this._tempVolume = 0;
302302

303+
/**
304+
* @property {number} _tempPause - Internal marker var.
305+
* @private
306+
*/
307+
this._tempPause = 0;
308+
303309
/**
304310
* @property {number} _muteVolume - Internal cache var.
305311
* @private
@@ -753,6 +759,7 @@ Phaser.Sound.prototype = {
753759
this.paused = true;
754760
this.pausedPosition = this.currentTime;
755761
this.pausedTime = this.game.time.time;
762+
this._tempPause = this._sound.currentTime;
756763
this.onPause.dispatch(this);
757764
this.stop();
758765
}
@@ -823,6 +830,7 @@ Phaser.Sound.prototype = {
823830
}
824831
else
825832
{
833+
this._sound.currentTime = this._tempPause;
826834
this._sound.play();
827835
}
828836

src/sound/SoundManager.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -846,7 +846,6 @@ Object.defineProperty(Phaser.SoundManager.prototype, "volume", {
846846
}
847847

848848
this.onVolumeChange.dispatch(value);
849-
850849
}
851850

852851
}

0 commit comments

Comments
 (0)