Movie component issue in the browser

Description of the problem: I want a movie to fit to screen so that it accommodates different monitor sizes. I tried to play with different video resolutions and unit settings in the movie component. It either shows a black box, or nothing at all. Looks like it’s the same issue as discussed in this thread.

@sotiri, any chance you can help with it? I’ve added you as a developer in my project. I really appreciate it.


Hi tlan!

Could you run this demo to see whether that video runs in your browser?

Best, Thomas

Yes, Thomas. I do see the video. What’s the trick?


The format the video is encoded in: H.264 seems to work on most browsers

Hi Thomas,

I managed to get it work, partially.
I need to control the size of the video so it can fit different screens. It displays well when I set the size as a constant, like below.

However, the size naturally needs to come from a variable - the window size.
I obtain winSize at the beginning of the experiment.

winSize = psychoJS.window.size;

The video isn’t able to play under this setup. I don’t even see a black box, it’s just my background color on the screen. And it won’t proceed to the next routine.

I verified the value of winSize[0] and winSize[1] using console.log(), which have no problem.
I also tried to replace the parentheses with brackets too, which didn’t help.

Any thought?


Actually I made it work by changing “set every repeat” into “set every frame” under “Size”.
It kinda makes sense, but I’m not entirely sure why “set every repeat” won’t work.

Nice we got a workaround, but yeah, let’s dive a bit deeper in that issue you mention. Perhaps it’s a scoping problem? I.e. you do set the variable, but it’s not available when you want to use it. Maybe try prefixing winSize with window.? Then it would become:
window.winSize = psychoJS.window.size;

I’d expect there to be an error message if the variable is not available when I call it, but I don’t see any error popping up. Anyway, I tried window.winSize = psychoJS.window.size; and set it back to set each repeat, but it still doesn’t work.

Maybe set each frame is supposed to be the way to go, although I’m not clear why.

Hi @tlan, where you able to figure something out? x

Thank you for asking, @sotiri . I think I managed to solve it by setting the size of the movie component to “set each frame”, according to my correspondence with @thomas_pronk above, although I’m still not sure why that should be the case.

No problem @tlan, I can no longer access the repo, has it been removed? x