Skip to content

Commit ab8c986

Browse files
committed
Sound.resume wouldn't properly restart looped sounds in Chrome after being paused. Phaser now specifically handles the Chrome 42 bug and later fix (thanks @nkovacs phaserjs#1820)
1 parent c518fa3 commit ab8c986

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ Version 2.4 - "Katar" - in dev
383383
* Tween.to and Tween.from can now accept `null` as the ease parameter value. If `null` it will use the default tween, as per the documentation (thanks @nkovacs #1817)
384384
* TilemapParser.parseTiledJSON would ignore 'falsey' properties set on Objects in Tiled JSON tilemaps, such as `x: 0` or `visible: false`. These properties are now accurately copied over to the destination map data (thanks @MaksJS #1818)
385385
* Removed un-necessary PIXI.TextureCache pollution in Phaser.LoaderParser.bitmapFont.
386-
*
386+
* Sound.resume wouldn't properly restart looped sounds in Chrome after being paused. Phaser now specifically handles the Chrome 42 bug and later fix (thanks @nkovacs #1820)
387387

388388
For changes in previous releases please see the extensive [Version History](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md).
389389

src/sound/Sound.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,22 @@ Phaser.Sound.prototype = {
804804
}
805805
else
806806
{
807-
this._sound.start(0, p, duration);
807+
if (this.loop && this.game.device.chrome)
808+
{
809+
// Handle chrome bug: https://code.google.com/p/chromium/issues/detail?id=457099
810+
if (this.game.device.chromeVersion === 42)
811+
{
812+
this._sound.start(0);
813+
}
814+
else
815+
{
816+
this._sound.start(0, p);
817+
}
818+
}
819+
else
820+
{
821+
this._sound.start(0, p, duration);
822+
}
808823
}
809824
}
810825
else

typescript/phaser.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ declare module Phaser {
654654
canvas: boolean;
655655
chrome: boolean;
656656
chromeOS: boolean;
657+
chromeVersion: number;
657658
cocoonJS: boolean;
658659
cocoonJSApp: boolean;
659660
cordova: boolean;

0 commit comments

Comments
 (0)