Skip to content

Commit e1bc2b7

Browse files
committed
Merge pull request phaserjs#912 from j0hnskot/onDecoded-patch
Fix for bug phaserjs#906
2 parents ba29d5b + 5ef8143 commit e1bc2b7

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/sound/Sound.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,12 @@ Phaser.Sound = function (game, key, volume, loop, connect) {
290290
* @private
291291
*/
292292
this._paused = false;
293-
293+
294+
/**
295+
* @property {boolean} _onDecodedEventDispatched - Was the onDecoded event dispatched?
296+
* @private
297+
*/
298+
this._onDecodedEventDispatched = false;
294299
};
295300

296301
Phaser.Sound.prototype = {
@@ -357,6 +362,13 @@ Phaser.Sound.prototype = {
357362
* @protected
358363
*/
359364
update: function () {
365+
366+
if (this.isDecoded && !this._onDecodedEventDispatched) {
367+
368+
this.onDecoded.dispatch(this);
369+
this._onDecodedEventDispatched=true;
370+
371+
}
360372

361373
if (this.pendingPlayback && this.game.cache.isSoundReady(this.key))
362374
{

0 commit comments

Comments
 (0)