Hello!
I am trying to use a MediaPlayer within a Blueprint and drive the displayed image based of an attribute on a bone. I need the setup to work on both Editor (so artists can review what is happening while working on their level sequences) and in MRQ (for our final renders).
Note that I do only offline rendering for TV shows and feature films, real-time is absolutly not critical.
The setup is as follow:
- I created the MediaPlayer, ImgMediaSource and MediaTexture assets with default attributes (except no play on open)
- In the construction script of my blueprint, the MediaPlayer opens the ImgMediaSource
- Still in the construction script, the MediaTexture is assigned to some material of another component in the actor
- I use a custom level sequence section to call animation update for a given frame (similar to how GeometryCacheSection does it). This callback seek the MediaPlayer to the given frame (converted to seconds). Note that this custom section works reliably for other time based componetn such as geometry cache or anim sequence.
But I have the following issues:
-
When I change frame in the level sequence editor, the code seems to first call our callback and then calls the RerunConstructionScripts function which open the image source again (the MediaTexture keeps being at the first frame). This behavior can be fixed by uncheking the Rerun Construction Scripts options in the level sequence editor but this may breaks other things in our current setup. I’d rather make it work with Unreal default state.
I tried to seek in the construction script right after the OpenSource function but the MediaPlayer states it cannot seek while preparing. -
When rendering with the MRQ, the media player does not seek at the correct timing. This seems to be kinda random and very depended on the scene complexity (sometimes it works, sometimes not). Sometimes, I simply do not get any media at all, the renders output the Clear Color of the MediaTexture.
After debugging the source code of the engine, it seems the MediaPlayer is opening and seeking asynchronously. This may explains why the system works on heavy scenes but not on simple tests. However, I couldn’t make it work using a single thread (-onethread CLI arg).
My questions are:
- What could be wrong in my current setup?
- Is there any way to reliably use the MediaPlayer in controllable manner through the level sequence and blueprints?
Thanks in advance for your thoughts!