UMediaTexture being initialized before it's referenced UMediaPlayer has been initialized

I just upgraded to UE 4.9 and discovered that my UMediaTexture is now being initialized before it’s referenced UMediaPlayer has a chance to initialize.

I have a simple scene that has a connected UMediaTexture attached to a box face. If I run immediately after loading, my UMediaTexture fails to render the images from my UMediaPlayer. If I then modify the UMediaTexture in any way (without touching the reference link to the UMediaPlayer), it gets a call to PostEditChangeProperty which then calls InitializeTrack which then properly AddSink back to the UMediaPlayer’s VideoTracks and all is well - until, of course, I reopen the level.

I debugged and discovered that the UMediaTexture::PostLoad call was occurring before its UMediaPlayer referenced by the UMediaTexture::MediaPlayer was getting it’s PostLoad call - why would we ever want this to occur? So we have a serious bug in the loading system of the Media Framework based UAssets.

The UMediaTexture’s InitializeTrack needs to be called after its UMediaPlayer’s InitializePlayer has been called. How do I get that to occur?

Please advise.

Thanks,

Hey , I’m gonna need some more information from you to track this down.

In general, the loading order shouldn’t matter. If the texture is loaded after the player, then the Texture’s InitializeTrack() method will have access to an initialized player. If, on the other hand, the player is loaded after the texture, then it should call its OnTracksChanged delegate, which is caught by the texture to initialize itself. Either way, the texture should be initialized with a valid player.

Can you check whether the UMediaPlayer::HandlePlayerTracksChanged() and UMediaTexture::HandleMediaPlayerTracksChanged() are called in your case?

I was using a custom IMediaPlayer originally based on the WMF player version. I was however not using the OnTracksChanged system. I added the broadcast of that event on the Open of my media and was able to get everything up and running. Thanks!