mirror of
https://github.com/wassname/phaser.git
synced 2026-08-05 13:21:00 +08:00
Added ability for full Audio tag playback and iOS touch lock load support.
This commit is contained in:
+24
-7
@@ -330,6 +330,8 @@ module Phaser {
|
||||
case 'audio':
|
||||
|
||||
file.url = this.getAudioURL(file.url);
|
||||
console.log('Loader audio');
|
||||
console.log(file.url);
|
||||
|
||||
if (file.url !== null)
|
||||
{
|
||||
@@ -344,13 +346,27 @@ module Phaser {
|
||||
}
|
||||
else if (this._game.sound.usingAudioTag)
|
||||
{
|
||||
file.data = new Audio();
|
||||
file.data.name = file.key;
|
||||
file.data.onerror = () => this.fileError(file.key);
|
||||
file.data.preload = 'auto';
|
||||
file.data.src = file.url;
|
||||
file.data.addEventListener('canplaythrough', () => this.fileComplete(file.key), false);
|
||||
file.data.load();
|
||||
if (this._game.sound.touchLocked)
|
||||
{
|
||||
// If audio is locked we can't do this yet, so need to queue this load request somehow. Bum.
|
||||
console.log('Audio is touch locked');
|
||||
file.data = new Audio();
|
||||
file.data.name = file.key;
|
||||
file.data.preload = 'auto';
|
||||
file.data.src = file.url;
|
||||
this.fileComplete(file.key);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('Audio not touch locked');
|
||||
file.data = new Audio();
|
||||
file.data.name = file.key;
|
||||
file.data.onerror = () => this.fileError(file.key);
|
||||
file.data.preload = 'auto';
|
||||
file.data.src = file.url;
|
||||
file.data.addEventListener('canplaythrough', () => this.fileComplete(file.key), false);
|
||||
file.data.load();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -379,6 +395,7 @@ module Phaser {
|
||||
if (this._game.device.canPlayAudio(extension))
|
||||
{
|
||||
console.log('getAudioURL', urls[i]);
|
||||
console.log(urls[i]);
|
||||
return urls[i];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user