Movie stim is just a black box on Pavlovia

Hello all,

I am working on getting an experiment up on pavlovia which will simply present videos with sound and collect key-press responses. My stimuli consists of separate audio (.wav) and video (currently .mpeg) files which are played simultaneously using the sound and movie components in builder. I have been able to make this run locally and am in the process of building it again from scratch while frequently synching to pavlovia and debugging.

The problem I am having is that the video is not playing. The audio plays fine but the video appears as a black square in the middle of the screen. I can manipulate said square with the size and position parameters in the video component and the trial plays without giving an error or crashing - so I think the video file is being called but it isn’t showing correctly.

I’ve seen other video issues on the discourse addressed by reformatting the files themselves so I had hoped that converting to .mp4 would be the fix. However, I ran a test with a different .mp4 video file that a labmate has had formatted at h.264 (as recommended elsewhere) with no luck. That file plays fine on her pavlovia experiment but is another black box for me.

If anyone can shed any light on getting these videos playing I would appreciate it very much!

*note: I have shared the pavlovia link below in case anyone would like to have a look at the files - so far it’s just a test of the movie and sound components calling a single file in each. I’ll eventually create loops and call the trials from .csv files in case that has any bearing on things.

Hi There,

I am going to tag a colleague who I know has been working closely with movie stim online @sotiri and would have better advise on this than me.

As a start point - please can we check what version of psychopy you are using?


Thanks @Becca, would it be possible to give me developer access to your repo so that I can investigate some more please @Cailey? Thank you, x

Hi @Cailey, thanks for flagging, we are in the middle of addressing the issue you are facing with a permanent fix. For now, I have created an extra branch and a corresponding merge request for you to pull the changes required to get video playback to work as expected into your codebase. Please consult the following thread for context:

Please let me know if you need more details, thanks, s.

Thanks for getting in touch @Becca (I am currently working in 2020.2.4 by the way) and @sotiri! I will check out the new branch and follow up if I run into anything else. Thank you very much for your help with this!

OK hope it works, thanks, x

Hi Sotiri, it looks like your changes have done the trick to get the video playing! Thank you for that!

Just to be sure I understand where the changes are and what they’re doing, the patches you added are now operating directly from the gitlab repository for this project, is that correct? So for me to go back into the builder file and continue building out trials and conditions, do I just make those changes in the original .py file and associated folders on my local computer and continue to sync the changes to pavlovia as I have been doing? Or do I need to download all the material from the merged version and make changes from there? I hope that question is clear enough.

thanks again for all your help!

Hi Cailey, yes unfortunately you would need to git clone from GitLab and then make sure to import PsychoJS components from that custom-lib folder (lines 5-11) instead of relying on default Builder output, but only temporarily until we get Pavlovia up to speed with the latest patches. Please post back should that approach fail to work and I will be sure to follow up with the necessary edits. Many thanks for your patience while we work to get the problem fixed for good :blush:

Basically, you can carry on working with PsychoPy as normal, but whenever you export HTML from Builder, please revisit the main JS file for your project and tweak the import section to match the current one (lines 5-11)

Hi Sotiri,
we have a sample problem here with a video-based task, where some videos are not playing and instead a black box appears. I wanted to look at the lines 5-11 that need to be modified as mentioned above, but all the links in this thread are not working. Could you please repost?
Many thanks

Hi @Henning_Holle, no problem, that link seems broken because Cailey’s study is private. Would it be possible to share your project with me to see if I can patch PsychoJS the same way? Here to help, thanks, s.

Hi Sotiri,
thanks for the kind offer. I have now added you as guest to the project (hope that works, I did not want to make the whole thing public to everyone).
Best wishes

Thanks @Henning_Holle, could you make it developer access? Cheers, x

Hi Sotiri, have just given you developer’s access. I think about 90% of my problems arise because I don’t really understand how gitlab works…

1 Like

Hi @Henning_Holle, I have created a merge request for you to try. Please post back should that fail to solve the problem. Thanks, x

Hi Sotiri,
thanks, this has fixed the problem with the black boxes. Will the patch be part of the next release of psychopy?

Dear @Henning_Holle, @Cailey, @feygele, @YT_HAN, video-playback-issue-resolving-post-pixi-upgrade tweaks have now hit production PsychoJS and you should no longer need to rely on importing from ‘custom-lib’. Please let me know if you need more details. Many thanks again for your patience, s.

Hi @sotiri
From reading a few threads it sounds like this error (and some others I am getting when trying to run my study on different devices) is likely fixed in the newest version of psychopy?

I built my study using Psychopy2020.2 how do I make sure that my experiment is using the newest core code that has these fixes included?

Thanks, Elle

Hi @EJJ, these particular tweaks should be already available on Pavlovia, would it be possible to send me a link to your study, maybe something else is at work? Thanks, s.

Thanks for the quick reply! :smiley:

Here is a link to the study:

And this is a link to the github:

Video problems

  • On an ipad or android tablet the videos are replaced by black boxes
  • On a 2011 Mac the videos are replaced by black boxes
  • On android it also crashes after the 1st movie

Javascript problems

  • For just some PCs running windows it gives me an unspecified java error when attempting to run on chrome. (but works on firefox and edge and works ok on chrome on other windows pcs)
  • on a 2009 Mac, running it on safari it gives an error: tone.js is not available

Devices it runs smoothly on

  • A new Mac
  • Some windows 10 PCs on chrome, firefox and edge

Sorry for the long list, i just dont really understand whats causing the problems when it works great on some devices and browsers!