Skip to content

Commit 2a7e715

Browse files
authored
Merge pull request phaserjs#4831 from apasov/patch-1
Fix: enable loading video file as data URI (fixes phaserjs#4830)
2 parents 26d8847 + abe3247 commit 2a7e715

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/loader/filetypes/VideoFile.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,21 @@ VideoFile.getVideoURL = function (game, urls)
259259
{
260260
var url = GetFastValue(urls[i], 'url', urls[i]);
261261

262-
if (url.indexOf('blob:') === 0 || url.indexOf('data:') === 0)
262+
if (url.indexOf('blob:') === 0)
263263
{
264264
return url;
265265
}
266266

267-
var videoType = url.match(/\.([a-zA-Z0-9]+)($|\?)/);
267+
var videoType;
268+
269+
if (url.indexOf('data:') === 0)
270+
{
271+
videoType = url.split(',')[0].match(/\/(.*?);/);
272+
}
273+
else
274+
{
275+
videoType = url.match(/\.([a-zA-Z0-9]+)($|\?)/);
276+
}
268277

269278
videoType = GetFastValue(urls[i], 'type', (videoType) ? videoType[1] : '').toLowerCase();
270279

0 commit comments

Comments
 (0)