How do I make my media use their relative path instead of local in a packaged game?

I am packaging up a project and testing it on a separate laptop.
When packaged and playing on my computer the video files play fine in the main menu and in play content, however when packaged and played on the other computer the video files fail to load and display black. The Media is in Content\movies\ and I am using a blueprint which references the full local directory (which is what I would assume is causing the issue), If i change that path to anything other than the full directory the video files don’t play at all.

Any idea of how I can get this to work?

Good luck … The staff guys have been “looking into it” since 2014 / engine 4.5. None of the suggestions from the community seem to work either. Appears as though making videos work in an actual packaged build isn’t a priority.

Hi,
The Path is " ./Movies/VidName.mp4 "
or when hovered over in the content browser "/Game/Movies "

Hi,

The videos exist in that directory. I think the issue may lie in the triggering blueprint as it is looking to open the file using the full file path including the user name, which doesn’t exist on the 2nd PC.
e.g C:\Users\Name\Desktop\UnrealProjects\ProjectName\Content\Movies\VidName.mp4
But if I change that in the blueprint, the files wont load at all.

I’ll have to check I am able to disclose the information in the log as it contains client information in the file names.

Cheers

BigFudge, what is the path stored in the FileMediaSource?

That looks correct. Does the video file get packaged? It should exist in the /Content/Movies directory on your laptop.

Could you please also attach your log file from the laptop?

Which BP function are you using to open the movie? Are you opening the media source asset, or are you trying to open directly with a file path URL string?

I was using “open File” with the directory, I’m guessing I should be using the “open source” with the media source set as the relevant video?

I was using “open File” with the directory, I’m guessing I should be using the “open source” with the media source set as the relevant video?

You can use either. OpenSource probably makes more sense and is more convenient. If you use OpenFile with relative paths, you have to follow the Engine’s conventions for relative file paths. This means that the file path will be relative to the directory from which the executable is launched, something like:

../../../MyProject/Content/Movies/VidName.mp4

The media source asset uses a special syntax for relative paths, which starts with “./”. It translates into “my game’s Content directory”. Unfortunately, this syntax is not supported anywhere else. I contemplated adding support to OpenFile and OpenUrl, but I may actually deprecate it altogether as it probably wasn’t a good idea in the first place.

1 Like