Skip to content

Commit fd4ac6d

Browse files
authored
Merge pull request phaserjs#5052 from aucguy/contribute
Fix loading audio and video with blob urls
2 parents 63eb41e + 0288a96 commit fd4ac6d

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/loader/File.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ var File = new Class({
9494
{
9595
this.url = loader.path + loadKey + '.' + GetFastValue(fileConfig, 'extension', '');
9696
}
97-
else if (typeof(this.url) !== 'function')
97+
else if (typeof(this.url) !== 'function' && this.url.indexOf('blob:') !== 0 && this.url.indexOf('data:') !== 0)
9898
{
9999
this.url = loader.path + this.url;
100100
}

src/loader/filetypes/AudioFile.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ AudioFile.getAudioURL = function (game, urls)
145145

146146
if (url.indexOf('blob:') === 0 || url.indexOf('data:') === 0)
147147
{
148-
return url;
148+
return {
149+
url: url,
150+
type: ''
151+
};
149152
}
150153

151154
var audioType = url.match(/\.([a-zA-Z0-9]+)($|\?)/);

src/loader/filetypes/VideoFile.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,10 @@ VideoFile.getVideoURL = function (game, urls)
261261

262262
if (url.indexOf('blob:') === 0)
263263
{
264-
return url;
264+
return {
265+
url: url,
266+
type: ''
267+
};
265268
}
266269

267270
var videoType;

0 commit comments

Comments
 (0)