File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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/**
You can’t perform that action at this time.
0 commit comments