psychojs icon indicating copy to clipboard operation
psychojs copied to clipboard

BF: Videos are not played multiple times when running JavaScript experiment

Open JLC827 opened this issue 3 years ago • 3 comments

This error occurs when using the builder component Movie and running the experiment in JavaScript.

When running an experiment that plays the same video multiple times, on the second time the video is played it will freeze on the final frame and the routine does not end even if "Force end of Routine" is ticked.

This isn't a new bug and was discussed back in March 2020, however none of the solutions suggested in this thread work anymore.

The only solution is to give the Movie element a fixed duration, or to reference a spreadsheet containing the durations but this is cumbersome or not always possible.

JLC827 avatar Apr 21 '21 14:04 JLC827

This sounds like an issue for psychojs rather than psychopy. @JamesLewis-Cheetham could you also just confirm the version of psychojs being imported in your script (or providing a link to a minimal working example of the failure)?

peircej avatar Apr 27 '21 16:04 peircej

I've uploaded a minimal working example at https://gitlab.pavlovia.org/JWLC1/video_bug_example

The PsychoJS version used is 2021.1.4

The bug does not occur when the movie file path is set as constant, but does occur when the movie file path is set every repeat and is being pulled from a spreadsheet.

Cheers

JLC827 avatar May 04 '21 15:05 JLC827

@peircej The problem here is with how the boilerplate is wired not PsychoJS. A new MovieStim instance is created at the beginning of each trial and so the movie.status === PsychoJS.Status.FINISHED check that would normally be expected to terminate the routine once the movie is stopped is only valid the first time.

@JamesLewis-Cheetham I have created a support fork to demonstrate a potential fix, but you need to manually edit JS output to match whenever you export for HTML in PsychoPy.

thewhodidthis avatar Jun 17 '21 13:06 thewhodidthis