psychopy.org | Reference | Downloads | Github

Videos not loading properly on Chrome, Edge and Safari

URL of experiment: https://gitlab.pavlovia.org/f.cerpelloni/smi_chrome

Hello all,

I created a small psychophysics experiment in which I present participants with videos of a visual and an auditory sitmuli.
The experiment runs fine in Firefox, but on Chome, Edge and Safari presents issues with the video stimuli.
The experiment itself runs, showing a following choice routine and the next iteration of the loop.
In the psychopy experiment I made on Builder, there are two routines before and after the video routine with a static component of 1 second to allow loading of the video.
All videos are .mp4.
Does someone have the same issue or a possible solution for that?

Many thanks!

EDIT: Sorry, I attached the wrong link. Here’s the pavlovia runable experiment https://run.pavlovia.org/f.cerpelloni/smi_chrome/html

Odd. Edge I can understand, but something that works in Firefox but not Chrome is new to me. Most likely it has to do with something subtle about the video format. While they are all mp4, there are different ways to encode mp4s. There’s also this thread, which may be relevant: Pavlovia experiment freezes during video playback

The .play() and .stop() codes were necessary since the first trial. I previously added the .reset() part but didn’t seem to change much, probably one or two more conditions were displayed.

I also looked at Pavlovia not playing movieStim and Pavlovia experiment freezes during video playback
Stimuli in the current version are video encoded with MPEG-4. A previous try had h.264 encoded stimuli with the same results.

I made some adjustment during the day and it runs better in chrome, but it still skips a lot of stimuli, either video, audio, or both (around half).

Pavlovia is being difficult about letting me fork and test these, but I have two ideas you might try.

  1. Move the “movie_sim.play()” line to “each frame” instead of “begin routine”. The main reason for this is that the movie has not been drawn in the “begin routine” section of the code. If that doesn’t work, try removing it altogether, and leave only “reset” and “stop”.
  2. Add a short delay before the start of the movie, say .1s. I have a suspicion that part of the issue might simply be a buffering issue, where it’s difficult for the browser to load and play the movie in the time window it has, so just giving it a little extra margin (if it doesn’t disrupt your experiment) might make it more consistent.

Otherwise, I don’t see any obvious reason this should have trouble. Is it now consistent about which movies it’s skipping or random every time?

I tried both your options but unfortunately they didn’t work.

What helped me a bit was extending the duration of the movie component from 1 sec (video duration) to 1.2 secs. This resolved audio issues.
I’m currently updating a new version with different attempts (https://run.pavlovia.org/f.cerpelloni/sequential/html).

The probable cause of the issue is refresh rate. The video is composed of a fixation point and a gabor that flashes (1 frame duration) either left or right. In the missed trials, the fixation point is still displayed, the audio works, but the flash is skipped.

Also, errors are not consistentin which movie is skipped

In addition to that, in pyschopy I use a routine “pre” with a static component ISI, and the movie file is set during that interval, but it’s not mentioned in the .js file. I tried extending it and moving it to the same routine as movie, but it doesn’t affect the visual part of the movie

Yeah, this seems like an issue of how movies are played in browsers. It may not be possible for a browser to play a movie file with frame-level precision. However, in principle, you could get PsychoPy to display the object and play the sound with its own built-in tools rather than making it a bunch of separate image files. Did you already try this and find that it got desynced? Is there are a reason you need these as movie files in particular?

I’m not attached to movies per se, however I tried using polygons and audio components but I had more issues in displaying them and checking for synchronization.
At this point I have to give up. Fortunately on firefox I don’t have all these issues, so I will probably just put it as a requirement.
Thank you