Videos are not played multiple times in Pavlovia

Did you find a solution to this problem, @Anne?

I think I’m having the same issue. I have three videos in my routine, separated by a picture that presents for 2 seconds. The first video plays fine, but the second and third freeze a few seconds into playing.

Hi Igunning! That sounds a little bit different than my problem…

In my experiment I have 20 pairs of videos and always show one pair in a trial. The first time I show a video pair, both videos work fine. However, the second time I show the same pair, the videos aren’t playing anymore. From what I understood it’s because the first time the videos play they are not properly reset, and that’s what they don’t play the second time. However, I couldn’t figure out how to fix this problem…I ended up copying all my videos, so I really only show each video once.

Hi all,

I had the same issue, where repeating videos in my experiment freezes the second time around. I tried the solution suggested here, inserting nameofMyMovie.play(); at the Beginning of the Routine and nameOfMyMovie.stop(); at the end of the Routine. It didn’t work and I also tried all the different combinations suggested in the other thread regarding similar issues: https://discourse.psychopy.org/t/video-stimuli-not-resetting-to-beginning-in-online-experiment/10459/12. None of those options also worked for me.

Finally, I used a different hack, where I pulled the durations of my videos and creating a new variable in the trial excel sheet named “time” in which each video’s corresponding duration in seconds is listed down. Then in the movie component of my routine, I set the stop duration to be $time, so that when each video play in the routine, the routine duration also matches that. Hence, even if the video end is not recognized by the pavlovia during the second run through and doesn’t force the end of the routine. The routine will still end after running for the duration equivalent to the video clip’s runtime. It was possible because I had only a few videos in my experiment, it may not be a solution for the experiments where there is a lot of videos and all of their runtimes are different!

However, still will be interested to see whether there are any alternative and better solutions!

Best,
Prasanth

1 Like

I have a similar problem, while the video plays the second time it appears, it no longer ends the routine. As the different videos that get inserted have different lengths I do not want to rely on a “timer”. Does anybody know how to get the video to force the end of the routine for a second time?

Hi, I have a similar problem. Although, when I add the name_of_my_movie.play(); code snippet, Pavlovia gives the following error message:
error4
Experiment: PILOT_NAD_signlang [PsychoPy]
Repository: MTA-BME Lendület Nyelvelsajátítás Kutatócsoport / PILOT_NAD_signlang · GitLab
(It apparently has no problem with the name_of_my_movie.stop() snippet…)
When I remove it, as expected, it freezes when videos are played for the second time.
Does anyone have any ideas how to solve this issue?

And does anyone know if this issue has been indicated to the developers? It would be nice if video files could be played without these issues and workarounds…

Thanks @Prasanthp,

I created a variation of this solution and it was the only thing I could get to work.

For anyone else hoping to do the same you can add code before the video component (in the ‘Begin Routine’ tab) with something like (written here in pseudo-ish code):

if current_file_name == 'filename1':

    VideoDuration = 6.9

From there, in the subsequent Video component in the Stop row, in the ‘duration (s)’ tab type

$VideoDuration

I also have the ‘Force end of routine’ box ticked in this menu too, but haven’t checked to see if that is necessary. Either way, this solution ensures the same video can be played twice in an experiment.

TIP: if you want to get a measure of the video duration in Python script you can use

visual.MovieStim3(win, 'video_file_path/video_name').duration

to return the duration.

Thanks again, @Prasanthp

1 Like