| Reference | Downloads | Github

MovieStim won't play the same file twice in Chrome

URL of experiment:

Description of the problem:
I’m trying to play combinations of sound + video, and I’m running into an issue where the video files won’t play the second time they’re used. I’ve seen similar issues on the discussion board where people fixed this by using the .reset() and/or .stop() functions of the MovieStim class, and that sort of fixed my problem: it works if I use Firefox as my browser, but it still doesn’t work in Chrome: the movie file is just frozen on a single frame the second time around. (This can be seen in the experiment by selecting ‘y’ to do the practice tasks; the fourth trial will show this behavior, since it uses the same video as the third trial.)

Looking at the PsychoJS code, it seems like this might be because both the .stop() and .reset() functions are checking to see if HTMLMediaElement.fastSeek() is supported before resetting the video to the beginning, and there’s nothing to handle the case where this method isn’t supported (as in Chrome), so no reset actually happens. Has anybody found a way around this?

@abbeyjoy, take a look at the link, which should have a solution

Thank you for the reply! I’m sorry for the slow response; it took me a while to get back to this. I tried the suggestions at that link, but it didn’t solve the issue in Chrome: movies would play for the specified time (which is slightly less than the full movie duration) on the first presentation, play the final few frames on the second presentation (without resetting to the beginning of the movie, which was the problem), play from the start and appear correct on the next presentation, and so on.
I finally added the line movie_stim._movie.currentTime = 0; to the Begin Routine section of the JS code that plays the movie; this seems to have solved the problem, just in case anyone else runs into the same thing.