mirror of
https://github.com/psychopy/psychojs.git
synced 2025-05-12 16:48: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:
commit
96bab10712
@ -219,7 +219,20 @@ export class MovieStim extends VisualStim
|
|||||||
play(log = false)
|
play(log = false)
|
||||||
{
|
{
|
||||||
this.status = PsychoJS.Status.STARTED;
|
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
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user