Is there a way to properly preload videos used in a media texture?
My approach at the moment looks like this:
- Place object somewhere outside the level with the media texture on it
- OnBeginPlay - Open Source
- Set Position to 0
Whenever I need it I Open it again or Play it on the object I need it (Not the same as the init object).
The problem is, that sometimes it works and sometimes the game freezes for a moment before the video shows up.
Any ideas or suggestions on how to make this work?
It would also be possible to preload it before the level actually starts. This could work for me as well.
You can check the precache video box in the media file source. Have you tried this one?
Additional note: PrecacheFile should reduce the time it takes the decoder to warm up (at the cost of drastically increased RAM usage), but it may not completely remove the initial delay. We don’t have a way right now to guarantee that the first frame is rendered immediately when Play is executed. It’s something we’re investigating for Sequencer integration.
As Evil_Fishchi mentioned, there is an option within your Media Source file that allows you precache your media files into memory if applicable.
I created a template project for Media playback which you can download and mess around with to get an idea of how to call media files to open. There are other ways to put checks in place to make sure your video has been loaded first, like using the OnMediaOpened bind event which won’t fire until the media has fully loaded into memory.
[Media Player Template Project]
Let me know if you have additional questions.
Thank you for your help. Using precache and the OnMediaOpened bin event did the job. Still complicated to load more than one video but it works
Loading the media files into memory makes sense for us, as our game will run in loops.
is that also possible somehow for image sequences?
I have the problem with png sequences, at some point they get stuck during the game…
Hey, I’m having same problem, but even checking the precache file, it stills taking some time to load. Also, I’ve tried streamed video from Vimeo, takes way too long to load and when streaming a video there’s no option like precache. Any help?