| Reference | Downloads | Github

Video stimuli not playing correctly a second time

OS (e.g. Win10):
PsychoPy version (e.g. 1.84.x):
Standard Standalone? (y/n) If not then what?:
Chrome, Edge

What are you trying to achieve?:

Video stimuli plays correctly the first time it is played. But on the second iteration of the loop the video pauses on the final frame and the routine does not end as expected.

What did you try to make it work?:

This seems to be a somewhat common problem, with several threads on the forum for this already. (see Video stimuli not resetting to beginning in online experiment and Videos are not played multiple times in Pavlovia) However, I implemented the solutions given in that thread to no success.

I tried this and removed it as it did not solve the problem:


The current example implements the following code but this does not solve the problem:

myMovie._movie.currentTime = 0;;


I also ensured the video was uses H.264 encoded MP4 with AAC audio encoding, but this made no change.

I’ve created a basic working example which can be viewed here. James Lewis-Cheetham / video_stimuli_error_example · GitLab ( Any help would be much appreciated!

@wakecarter This might be of interest to you as your crib sheet suggests the use of .stop() and .seek(0) and may need updating if that solution no longer works.


As a current workaround I am listing the duration of each video in a. xlsx file and setting the duration of the movie component from the spreadsheet. This seems to fix it by ending the video at a specific time.

However, it would still be nice to find a solution to the main problem, rather than having to find a workaround.

I have been having many video related issues, and seem to need to adapt the solution nearly every time I create a new study - my current iteration uses another code component in begin routine, as well as the .play() component.

Begin routine (in the java side)
MyMovie._movie.currentTime = 0;

I don’t know if it does anything, but prior to starting the trials I have a code component incorporated into a blank between trial interval that has

Begin routine:
clearBuffer = true;

Also, check you don’t have loop play back checked on the movie properties screen. (To clarify - this should not be ticked)
I don’t know if any of this will help, but thought it may be useful to share. Hopefully @wakecarter can help further, good luck!

1 Like

Hi Samantha,

Thanks for the response, it’s unfortunate I’m not the only one having video related issues.

I tried the solution you suggested, but it didn’t seem to have any effect. Do you have any examples you could share? I’d like to see exactly how you’ve got it all set up, and also to see if those examples run for me. It could be some sort of device dependent compatibility error which would be nice to rule out.

I am hoping this link will take you to an osf repository showing my study: OSF |

In theory this should be downloadable and usable. I am not so sure about how easy it is to then get it to run through Pavlovia - please let me know if this does or doesn’t work.

Another thing I had to do was add a short fixation or just blank section at the start of the trial (I used text displayed for 100ms) this was because the videos were starting from the end before going to the start without this - i.e. a quick flash of the end of the video, then playing from the start.


1 Like

Hi Sam,

Thanks for sharing this study, very useful! Unfortunately I could not get it to run due to a missing resource error (despite the resource being present when I checked, quite odd). However, I mainly wanted to look at how you had it set up in the builder so that’s not a problem.

I also noticed in the online settings there was a link to a prolific completion URL. You may want to remove this if sharing studies in the future as I don’t know if you want this to be accessed easily?

I confirmed that my example was set up using exactly the same code components as you had and it still did not solve the error.

I don’t think the code components are helping to solve this problem. I noticed the movie components in your study have a fixed duration which I think is what is causing them to play properly a second time. This might be dependent on the version of PsychoPy however, and I can’t find a way to see which version you used to build your study.

I changed the basic working example I have to confirm the behaviour for the latest version of PsychoPy. Setting a video duration fixes the playback error problem without the need for any code.

For a more permanent fix I could look at the code for when a video duration is set to see what’s different vs a video of unspecified duration. But for now I’ll just implement a fixed video duration from spreadsheet.

Thanks for pointing out the prolific url, I have taken it down for now, and will upload with a version without this.
Good luck with your study.

Hi there,

I’ve been having the same problem and have had no luck in fixing it. Would you be able to kindly explain your .xlsx file work around? I’m new to PyschoPy and I’ve nearly completed my experiment, I just need to fix this problem somehow but I’m not sure how.

Thank you so much!

Update: I actually just had to select “set every repeat” instead of “constant” for the video file and it worked, no need for an xlsx file workaround. Thanks anyways!