# PsychoPy/Pavlovia Movie Playing Error

**URL:** https://discourse.psychopy.org/t/psychopy-pavlovia-movie-playing-error/6986
**Category:** Online experiments
**Tags:** movies
**Created:** [March 11, 2019, 6:56am UTC](https://discourse.psychopy.org/t/psychopy-pavlovia-movie-playing-error/6986 "2019-03-11T06:56:43Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Makataui](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/makataui/32/4128_2.png) [@Makataui](https://discourse.psychopy.org/u/Makataui)
#### Post date: [March 11, 2019, 6:56am UTC](https://discourse.psychopy.org/t/psychopy-pavlovia-movie-playing-error/6986/1 "2019-03-11T06:56:43Z")

</div>

URL of gitlab repo: [Ferenc Igali / Video Test · GitLab](https://gitlab.pavlovia.org/Makataui/video-test)  
URL of experiment: [Movie\_Mp4 [PsychoPy]](https://pavlovia.org/run/Makataui/video-test/html/)

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).

 ![js_error](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/4/f/4fbca8d5a06f38fe7b88a4c09015bb0916d5feb3.png) ![thumbnail_image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/a/a/aa748fe98a73d97a50013cfa48f55d935b3e4e06.png)

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

---

<div class="post-metadata">

### Author: ![Makataui](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/makataui/32/4128_2.png) [@Makataui](https://discourse.psychopy.org/u/Makataui)
#### Post date: [March 11, 2019, 7:07am UTC](https://discourse.psychopy.org/t/psychopy-pavlovia-movie-playing-error/6986/2 "2019-03-11T07:07:47Z")

</div>

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:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/9/4/94fbde4fa0d908e3465b1c8a66fa957ddb3b32f4.png)

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](https://gitlab.pavlovia.org/Makataui/video-test/blob/master/html/resources/test.mp4)).

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

---

<div class="post-metadata">

### Author: ![dvbridges](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/dvbridges/32/1918_2.png) [@dvbridges](https://discourse.psychopy.org/u/dvbridges)
#### Post date: [March 11, 2019, 9:05am UTC](https://discourse.psychopy.org/t/psychopy-pavlovia-movie-playing-error/6986/3 "2019-03-11T09:05:33Z")

</div>

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.

> <https://github.com/psychopy/psychojs/issues/37>
>
> \*Warning: Unpleasant content in one of the video files\*
> 
> A user wants to play …movies from Pavlovia. They upload ok, but the experiment freezes when you click "Ok" to begin, and then the Pavlovia dashboard also freezes. 
> 
> \*project deleted\* 
> 
> If there is a preferred file type (e.g., not .wmv) or file size limit, perhaps we can put this as a warning, or document it.

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.

---

<div class="post-metadata">

### Author: ![dvbridges](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/dvbridges/32/1918_2.png) [@dvbridges](https://discourse.psychopy.org/u/dvbridges)
#### Post date: [March 11, 2019, 9:16am UTC](https://discourse.psychopy.org/t/psychopy-pavlovia-movie-playing-error/6986/4 "2019-03-11T09:16:32Z")

</div>

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.

> <https://github.com/psychopy/psychojs/issues/37>
>
> \*Warning: Unpleasant content in one of the video files\*
> 
> A user wants to play …movies from Pavlovia. They upload ok, but the experiment freezes when you click "Ok" to begin, and then the Pavlovia dashboard also freezes. 
> 
> \*project deleted\* 
> 
> If there is a preferred file type (e.g., not .wmv) or file size limit, perhaps we can put this as a warning, or document it.

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:

> <https://github.com/psychopy/psychopy/pull/2338>

---

<div class="post-metadata">

### Author: ![Makataui](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/makataui/32/4128_2.png) [@Makataui](https://discourse.psychopy.org/u/Makataui)
#### Post date: [March 11, 2019, 9:50am UTC](https://discourse.psychopy.org/t/psychopy-pavlovia-movie-playing-error/6986/5 "2019-03-11T09:50:13Z")

</div>

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

---

<div class="post-metadata">

### Author: ![dvbridges](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/dvbridges/32/1918_2.png) [@dvbridges](https://discourse.psychopy.org/u/dvbridges)
#### Post date: [March 11, 2019, 9:57am UTC](https://discourse.psychopy.org/t/psychopy-pavlovia-movie-playing-error/6986/6 "2019-03-11T09:57:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Makataui](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/makataui/32/4128_2.png) [@Makataui](https://discourse.psychopy.org/u/Makataui)
#### Post date: [March 13, 2019, 2:52pm UTC](https://discourse.psychopy.org/t/psychopy-pavlovia-movie-playing-error/6986/7 "2019-03-13T14:52:51Z")

</div>

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:

```auto

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

```

I get that we’re throwing an error here:

```auto
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:

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

```

---

<div class="post-metadata">

### Author: ![apitiot](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@apitiot](https://discourse.psychopy.org/u/apitiot)
#### Post date: [March 22, 2019, 3:42pm UTC](https://discourse.psychopy.org/t/psychopy-pavlovia-movie-playing-error/6986/8 "2019-03-22T15:42:02Z")

</div>

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/](https://pavlovia.org/run/Makataui/video-test/html/)  
Let me know what you think!  
Best wishes,

Alain

---

<div class="post-metadata">

### Author: ![Makataui](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/makataui/32/4128_2.png) [@Makataui](https://discourse.psychopy.org/u/Makataui)
#### Post date: [March 22, 2019, 4:05pm UTC](https://discourse.psychopy.org/t/psychopy-pavlovia-movie-playing-error/6986/9 "2019-03-22T16:05:16Z")

</div>

@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

---

<div class="post-metadata">

### Author: ![apitiot](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@apitiot](https://discourse.psychopy.org/u/apitiot)
#### Post date: [March 26, 2019, 6:34am UTC](https://discourse.psychopy.org/t/psychopy-pavlovia-movie-playing-error/6986/10 "2019-03-26T06:34:45Z")

</div>

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

---

<div class="post-metadata">

### Author: ![dvbridges](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/dvbridges/32/1918_2.png) [@dvbridges](https://discourse.psychopy.org/u/dvbridges)
#### Post date: [March 26, 2019, 9:40am UTC](https://discourse.psychopy.org/t/psychopy-pavlovia-movie-playing-error/6986/11 "2019-03-26T09:40:39Z")

</div>

All done, please see pull request below:

> <https://github.com/psychopy/psychopy/pull/2376>
>
> Previously, movie units were set to 'undefined' if screen units set to
> "from ex…p settings". Now, "from exp settings" is replaced with
> "height" units. Also fixes a missing namespace from movie status.

---

<div class="post-metadata">

### Author: ![Tin\_Tin](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/tin_tin/32/14611_2.png) [@Tin\_Tin](https://discourse.psychopy.org/u/Tin_Tin)
#### Post date: [February 16, 2022, 1:57am UTC](https://discourse.psychopy.org/t/psychopy-pavlovia-movie-playing-error/6986/12 "2022-02-16T01:57:33Z")

</div>

@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.
