mirror of
https://github.com/photonstorm/phaser
synced 2024-12-17 16:43:30 +00:00
Added touchLockedActionQueue property to HTML5AudioSound class
This commit is contained in:
parent
c4f4fbc79d
commit
093f295389
1 changed files with 28 additions and 0 deletions
|
@ -44,6 +44,21 @@ var HTML5AudioSound = new Class({
|
||||||
* @default 0
|
* @default 0
|
||||||
*/
|
*/
|
||||||
this.previousTime = 0;
|
this.previousTime = 0;
|
||||||
|
/**
|
||||||
|
* A queue of all actions performed on a sound object while audio was locked.
|
||||||
|
* Once the audio gets unlocked, after an explicit user interaction,
|
||||||
|
* all actions will be performed in chronological order.
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @property {{
|
||||||
|
* sound: Phaser.Sound.HTML5AudioSound,
|
||||||
|
* type: string,
|
||||||
|
* name: string,
|
||||||
|
* value?: any,
|
||||||
|
* time: number,
|
||||||
|
* }[]} touchLockedActionQueue
|
||||||
|
*/
|
||||||
|
this.touchLockedActionQueue = manager.touchLocked ? [] : null;
|
||||||
this.duration = this.tags[0].duration;
|
this.duration = this.tags[0].duration;
|
||||||
this.totalDuration = this.tags[0].duration;
|
this.totalDuration = this.tags[0].duration;
|
||||||
BaseSound.call(this, manager, key, config);
|
BaseSound.call(this, manager, key, config);
|
||||||
|
@ -240,6 +255,19 @@ var HTML5AudioSound = new Class({
|
||||||
if (this.audio) {
|
if (this.audio) {
|
||||||
this.audio.playbackRate = this.totalRate;
|
this.audio.playbackRate = this.totalRate;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
checkTouchLocked: function (type, name, value) {
|
||||||
|
if (this.manager.touchLocked) {
|
||||||
|
this.touchLockedActionQueue.push({
|
||||||
|
sound: this,
|
||||||
|
type: type,
|
||||||
|
name: name,
|
||||||
|
value: value,
|
||||||
|
time: window.performance.now()
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue