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

Merge pull request #178 from thewhodidthis/bf#169--movie

visual/MovieStim: deal with promise based video play
This commit is contained in:
Alain Pitiot 2020-10-27 11:03:31 +01:00 committed by GitHub
commit 96bab10712
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
};
});
}
}