From dacb17082be9bb96bf43aef7b4e491756c6ed95c Mon Sep 17 00:00:00 2001 From: alemart Date: Fri, 17 Jul 2020 21:28:25 -0300 Subject: [PATCH] Fix for Firefox --- tests/media.js | 15 ++++++++------- tests/speedy-helpers.js | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/media.js b/tests/media.js index 47cd0fc9..81aa4e1e 100644 --- a/tests/media.js +++ b/tests/media.js @@ -36,13 +36,14 @@ describe('SpeedyMedia', function() { }); it('can load a video', function() { - return expectAsync( - loadVideo('jelly.mp4').then(video => - Speedy.load(video).then(media => - (display(media, 'Video'), Promise.resolve(media)) - ) - ) - ).toBeResolved(); + return expectAsync(new Promise((resolve => { + loadVideo('jelly.mp4').then(video => { + Speedy.load(video).then(media => { + resolve(media); + display(media, 'Video'); + }); + }); + }))).toBeResolved(); }); it('has a valid source', async function() { diff --git a/tests/speedy-helpers.js b/tests/speedy-helpers.js index 07cf412c..7f252b62 100644 --- a/tests/speedy-helpers.js +++ b/tests/speedy-helpers.js @@ -62,10 +62,10 @@ function loadVideo(assetName) const video = document.createElement('video'); video.oncanplay = () => (video.play(), resolve(video)); video.onerror = () => reject(new Error(`Can't load ${assetName}`)); - video.muted = true; + video.defaultMuted = video.muted = true; + video.autoplay = true; video.loop = true; video.src = '../assets/' + assetName; - video.load(); }); }