Skip to content

Commit 093f295

Browse files
Added touchLockedActionQueue property to HTML5AudioSound class
1 parent c4f4fbc commit 093f295

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

src/sound/html5/HTML5AudioSound.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,21 @@ var HTML5AudioSound = new Class({
4444
* @default 0
4545
*/
4646
this.previousTime = 0;
47+
/**
48+
* A queue of all actions performed on a sound object while audio was locked.
49+
* Once the audio gets unlocked, after an explicit user interaction,
50+
* all actions will be performed in chronological order.
51+
*
52+
* @private
53+
* @property {{
54+
* sound: Phaser.Sound.HTML5AudioSound,
55+
* type: string,
56+
* name: string,
57+
* value?: any,
58+
* time: number,
59+
* }[]} touchLockedActionQueue
60+
*/
61+
this.touchLockedActionQueue = manager.touchLocked ? [] : null;
4762
this.duration = this.tags[0].duration;
4863
this.totalDuration = this.tags[0].duration;
4964
BaseSound.call(this, manager, key, config);
@@ -240,6 +255,19 @@ var HTML5AudioSound = new Class({
240255
if (this.audio) {
241256
this.audio.playbackRate = this.totalRate;
242257
}
258+
},
259+
checkTouchLocked: function (type, name, value) {
260+
if (this.manager.touchLocked) {
261+
this.touchLockedActionQueue.push({
262+
sound: this,
263+
type: type,
264+
name: name,
265+
value: value,
266+
time: window.performance.now()
267+
});
268+
return true;
269+
}
270+
return false;
243271
}
244272
});
245273
/**

0 commit comments

Comments
 (0)