1
0
mirror of https://github.com/psychopy/psychojs.git synced 2025-05-11 16:18:10 +00:00

visual/MovieStim: deal with promise based video play

This commit is contained in:
Sotiri Bakagiannis 2020-09-18 13:21:18 +01:00
parent da2d9c5ad7
commit 3220e5b1b5

View File

@ -219,7 +219,20 @@ export class MovieStim extends VisualStim
play(log = false)
{
this.status = PsychoJS.Status.STARTED;
this._movie.play();
// As found on https://goo.gl/LdLk22
const playPromise = this._movie.play();
if (playPromise !== undefined)
{
playPromise.catch((error) => {
throw {
origin: 'MovieStim.play',
context: `when attempting to play MovieStim: ${this._name}`,
error
};
});
}
}