mirror of
https://github.com/photonstorm/phaser
synced 2025-03-05 15:58:11 +00:00
Skipping calling load method on an audio tag on mobile devices
This commit is contained in:
parent
402aa27ff3
commit
ae36cf5729
1 changed files with 8 additions and 2 deletions
|
@ -69,13 +69,15 @@ var HTML5AudioFile = new Class({
|
|||
this.filesLoaded = 0;
|
||||
this.percentComplete = 0;
|
||||
|
||||
var touchLocked = 'ontouchstart' in window;
|
||||
|
||||
for(var i = 0; i < instances; i++)
|
||||
{
|
||||
var audio = new Audio();
|
||||
audio.name = this.key + ('0' + i).slice(-2); // Useful for debugging
|
||||
audio.dataset.used = 'false';
|
||||
|
||||
if (!('ontouchstart' in window))
|
||||
if (!touchLocked)
|
||||
{
|
||||
audio.preload = 'auto';
|
||||
audio.oncanplaythrough = this.onProgress.bind(this);
|
||||
|
@ -89,7 +91,11 @@ var HTML5AudioFile = new Class({
|
|||
{
|
||||
audio = this.data[i];
|
||||
audio.src = GetURL(this, baseURL || '');
|
||||
audio.load();
|
||||
|
||||
if (!touchLocked)
|
||||
{
|
||||
audio.load();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue