PSA: Filenames for web experiments can be case-sensitive


Author
Message
AKrishna
AKrishna
Distinguished Member (3.1K reputation)Distinguished Member (3.1K reputation)Distinguished Member (3.1K reputation)Distinguished Member (3.1K reputation)Distinguished Member (3.1K reputation)Distinguished Member (3.1K reputation)Distinguished Member (3.1K reputation)Distinguished Member (3.1K reputation)Distinguished Member (3.1K reputation)
Group: Forum Members
Posts: 90, Visits: 274
Hi all,

I've run into this issue before and I really should know better by now, but I just spent 20 minutes googling and couldn't find an answer, so I thought I'd write up a problem I had and its solution for posterity.

I set up an Inquisit Web experiment which included media files (specifically mp4s, although I didn't test whether other types of media such as pictures were also affected). It ran fine locally, but when I tested it from the Inquisit Web launch page, the script crashed when loading the media ("Relax_1.mp4"). The error message was: "Invalid media 'Relax_4.mp4'." (Code 0), followed by "Player Error 'Relax_1.mp4'. Resource could not be resolved. Failed to load source." (Code 0), and "Unable to load the media file '[redacted link to file]'. Failed to load media." (Code 63).

The solution was to change the Inquisit script from:
<video RelaxationVideo>
/ items = ("Relax_1.mp4")
/ playthrough = false
/ size = (80%, 80%)
/ stream = true
</video>

to:
<video RelaxationVideo>
/ items = ("relax_1.mp4")
/ playthrough = false
/ size = (80%, 80%)
/ stream = true
</video>


Note the case spelling in the /items attribute. This fixed the issue. Hope this helps if anyone has the same problem.

And hi, future me! Yes, you have had this problem before!

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
AKrishna - 2/26/2024
Hi all,

I've run into this issue before and I really should know better by now, but I just spent 20 minutes googling and couldn't find an answer, so I thought I'd write up a problem I had and its solution for posterity.

I set up an Inquisit Web experiment which included media files (specifically mp4s, although I didn't test whether other types of media such as pictures were also affected). It ran fine locally, but when I tested it from the Inquisit Web launch page, the script crashed when loading the media ("Relax_1.mp4"). The error message was: "Invalid media 'Relax_4.mp4'." (Code 0), followed by "Player Error 'Relax_1.mp4'. Resource could not be resolved. Failed to load source." (Code 0), and "Unable to load the media file '[redacted link to file]'. Failed to load media." (Code 63).

The solution was to change the Inquisit script from:
<video RelaxationVideo>
/ items = ("Relax_1.mp4")
/ playthrough = false
/ size = (80%, 80%)
/ stream = true
</video>

to:
<video RelaxationVideo>
/ items = ("relax_1.mp4")
/ playthrough = false
/ size = (80%, 80%)
/ stream = true
</video>


Note the case spelling in the /items attribute. This fixed the issue. Hope this helps if anyone has the same problem.

And hi, future me! Yes, you have had this problem before!

Adding:
- For general background, all files names are automatically converted to all lowercase when they are uploaded to the web. This is done for cross-platform compatibility reasons (some file systems are case-sensitive, i.e. A.jpg and a.jpg are different files than can coexist in the same place, whereas others are not.
- In most cases, the casing in /items does not matter, since Inquisit will convert these to all lowercase when downloading, which happens before the script is executed on the client system.
- There are, however, edge cases: Here, the file isn't downloaded up-front, but streamed at runtime, and that is why the casing matters. Another ede case would be HTML files that read file names from <item> elements in your script.
- In terms of defensive programming, it is a good idea to always give file names in all lowercase.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search