Skip to content

Commit

Permalink
Fix for Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
alemart committed Jul 18, 2020
1 parent d507323 commit dacb170
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions tests/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions tests/speedy-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}

Expand Down

0 comments on commit dacb170

Please sign in to comment.