Skip to content

Commit 21bdac8

Browse files
authored
Merge pull request #6010 from Azim-Palmer/bugfix/cordova-webaudio-fix
Fix WebAudio for Crodova based apps
2 parents 440fc8f + 726c874 commit 21bdac8

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/core/Config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,11 @@ var Config = new Class({
499499
*/
500500
this.loaderImageLoadType = GetValue(config, 'loader.imageLoadType', 'XHR');
501501

502+
/**
503+
* @const {string} Phaser.Core.Config#loaderLocalScheme - Optional local scheme definition.
504+
*/
505+
this.loaderLocalScheme = GetValue(config, 'loader.localScheme', '');
506+
502507
/*
503508
* Allows `plugins` property to either be an array, in which case it just replaces
504509
* the default plugins like previously, or a config object.

src/core/typedefs/LoaderConfig.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
* @property {string} [user] - Optional username for all XHR requests.
1212
* @property {string} [password] - Optional password for all XHR requests.
1313
* @property {number} [timeout=0] - Optional XHR timeout value, in ms.
14+
* @property {string} [localScheme] - Optional local scheme definition.
1415
*/

src/loader/File.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ var File = new Class({
318318
// On iOS, Capacitor often runs on a capacitor:// protocol, meaning local files are served from capacitor:// rather than file://
319319
// See: https://github.com/photonstorm/phaser/issues/5685
320320

321-
var isLocalFile = xhr.responseURL && (xhr.responseURL.indexOf('file://') === 0 || xhr.responseURL.indexOf('capacitor://') === 0);
321+
var localSchemes = [ 'file://', 'capacitor://', this.loader.systems.game.config.loaderLocalScheme ];
322+
var isLocalFile = xhr.responseURL && localSchemes.some(function (scheme) { return xhr.responseURL.indexOf(scheme) === 0; });
322323

323324
var localFileOk = (isLocalFile && event.target.status === 0);
324325

0 commit comments

Comments
 (0)