From 402aa27ff3a0ff1c48d0386d3ffc3db94d260308 Mon Sep 17 00:00:00 2001 From: Pavle Goloskokovic Date: Wed, 17 Jan 2018 14:05:35 +0100 Subject: [PATCH] Skipping setting preload attribute and events on an audio tag on mobile devices --- src/loader/filetypes/HTML5AudioFile.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/loader/filetypes/HTML5AudioFile.js b/src/loader/filetypes/HTML5AudioFile.js index b6cd5eb2c..c8cb77118 100644 --- a/src/loader/filetypes/HTML5AudioFile.js +++ b/src/loader/filetypes/HTML5AudioFile.js @@ -74,12 +74,13 @@ var HTML5AudioFile = new Class({ var audio = new Audio(); audio.name = this.key + ('0' + i).slice(-2); // Useful for debugging audio.dataset.used = 'false'; - audio.preload = 'auto'; - // TODO check if ios is locked - - audio.oncanplaythrough = this.onProgress.bind(this); - audio.onerror = this.onError.bind(this); + if (!('ontouchstart' in window)) + { + audio.preload = 'auto'; + audio.oncanplaythrough = this.onProgress.bind(this); + audio.onerror = this.onError.bind(this); + } this.data.push(audio); }