PsychoPy/Pavlovia Movie Playing Error

URL of gitlab repo: Ferenc Igali / Video Test · GitLab
URL of experiment: Movie_Mp4 [PsychoPy]

Description of the problem: When trying to play a movie on the online version, Pavlovia crashes (page becomes unresponsive due to JavaScript fatal error). I have the latest stable build running, got a successful sync and video file is in the HTML resources folder from Builder.

PsychoPy prints a line to the console about not having a default parameter for movies. Image included below. Similarly, it has trouble setting the setMovie parameter in JavaScript (image of console error included). Full error is just endless iterative text with encoding issues so would rather not copy it out but the main listed error in the console before the fatal one is:

{origin: “MovieStim.setMovie”, context: “when setting the movie of MovieStim: movie”, error: "the argument:}

Please note, have received successful syncs for this project. No other errors shown.

Have tried all back-ends for playing movies (I’m assuming the online player can support .mov as a container format here - is there a preferred codec or container format for videos?).

Experiment built as a test for an academic in builder using the Movie component - have tried other containers and types of video and receive same error (so I’m assuming it’s not container specific, unless there’s a preferred codec/container type I haven’t tried but I tried all the classics - mp4, h.264, etc).

Videos and experiment play fine on local machine. Have made gitlab repo public for this one (linked at top of post).

Long error makes reference in this case to: “Apple Alias Data Handler”.

Also, does your video engine or the back-end not do any compression? I noticed while downloading the resources on the front-end that my academics 600mb of videos (there’s 4 types of stimuli, encoded in .mov at a decent bit rate) are all downloaded client-side. I assume for data/speed/sanity sake, we should compress videos to a lower bitrate that still is acceptable to play if there’s no compression?

Can provide more information/logs as requested,

Ferenc

And not to confuse too many issues into one post but when trying to change from one video file type to another (so if I swap test.mov with test.mp4), I get the following error:

To test different video file types, I’ve only been able to do so by making new experiments/repos - guessing this is something to do with some sort of meta data sync in the background?

The video and resource play fine in Gitlab (so it exists and is accessible: html/resources/test.mp4 · master · Ferenc Igali / Video Test · GitLab).

This error seems to occur particularly with .mp4 as a container type - have tried messing around with experiment settings for different units (everything) - still have this error.

" * { “origin” : “util.to_unit”, “context” : “when converting a position to a different unit”, “error” : { “origin” : “util.to_unit”, “context” : “when converting a position to a different unit”, “error” : “unknown target units: from exp settings” }}"

Ferenc

Hi @Makataui, I have raised an issue for your first problem in GitHub already, as this has come up before. Here is the link if you would like to add to the issue, and follow what happens.

Regarding the second issue, you can fix this by changing your screen units from “from exp settings” to something else, such as “height” units. I will put a fix in for this now.

Hi @Makataui, I have raised an issue for your first problem in GitHub already, as this has come up before. Here is the link if you would like to add to the issue, and follow what happens.

Regarding the second issue, you can fix this by changing your screen units from “from exp settings” to something else, such as “height” units. I will put a fix in for this now. See pull req below:

My apologies for not finding that other issue already - I shall follow that thread.

As per my second one, I got that error when ‘height’ or ‘pixels’ or anything else was selected. Maybe the cache of my experiment didn’t update when I swapped from experiment settings (I had a successful sync after changing that in the builder and a successful sync each time I changed the units of measurement). Would be happy to try again - maybe I should try with a new repo once changed?

Ferenc

Ok, try forcing a refresh of your browser running the experiment. On a Mac, it is Cmd-Shift-R.

Hey @dvbridges - tried a force refresh in a range of browsers (actual and emulated in a browser stack as well for kicks), still getting the same error.

For the MP4 test repo, I’d like to add that the XML file recognises that it should be ‘height’ - when I change and resync, the XML file does update the parameter from what I can tell:


 <Param name="Units" updates="None" val="height" valType="str"/>

I get that we’re throwing an error here:

function to_unit(pos, posUnit, win, targetUnit)
{
	let errorPrefix = '{ "origin" : "util.to_unit", "context" : "when converting a position to a different unit", "error" : ';
	try {
		if (targetUnit === 'pix')
			return to_px(pos, posUnit, win);
		if (targetUnit === 'norm')
			return to_norm(pos, posUnit, win);
		if (targetUnit === 'height')
			return to_height(pos, posUnit, win);
		throw errorPrefix + '"unknown target units: ' + targetUnit + '" }';
	} catch (error) {
		throw errorPrefix + error + '}';
	}
}

But not entirely sure why - targetUnit should be set to ‘height’ (or pix or whatever) so should be the same type and contain the same value, returning true.

I’ve also cleared cache and cookies and tried different browsers by the way. It only seems to be a problem when trying to get the size of the movie basically.

We also get the following logged to the console:

WARN unknown | setting the value of attribute: size in PsychObject: movie as: undefined
BrowserConsoleAppender.append @ log4javascript.min.js:148

Good afternoon,

I can confirm that the issue has to do with the units of MovieStim being set to “from exp settings” rather than “height”.
@dvbridges: This is something we should take care of at code generation time.
@Makataui: I took the liberty of changing the units in Movie_Mp4.js, and making a small correction (missing namespace), and your experiment now seems to be running fine at: https://pavlovia.org/run/Makataui/video-test/html/
Let me know what you think!
Best wishes,

Alain

@apitiot Cool, I’ll apply the fix you did in the js file to the actual experiment files now so thank you.

Is the missing namespace an issue of generation of the js code or is it something that I’ve missed when setting it up and syncing? I’ll manually add it in now for the other experiment but just wondering if it’s something I’ve done wrong on my end then?

Ferenc

The missing namespace is indeed something to do with code generation. David should have it fixed shortly.

All done, please see pull request below:

@dvbridges sir, I was also wondering if you could help me. I am quite new to Psychopy - not very familiar with coding. I have managed to make my experiment run locally but encounter problems online - it has to do with my video.

I hope you could help me.