Problem with Electra Media Player and Sequencer when migrating from 5.1 to 5.3.

Hello everybody!

I am streaming audio and video (two different streams) from a custom fastAPI server. Both streams are loaded in two different UMovieSceneMediaTrack objects which are both contained in one UMovieScene. The audio stream is played through an external media player, whereas the video stream is rendered automatically in a MediaTexture.

**This specific setup was not my initial design, but I ended up with this as a workaround, since no other setup could work for me (maybe I couldn’t do the HLS segmentation correctly with the FFmpeg command).

Nevertheless, this solution was working flawlessly in UE5.1.1! When i migrated to UE5.3.2 the playback started having lugs.

This is the code I use to instantiate the sequencer:

UMovieScene* StreamMovieScene = NewObject<UMovieScene>();
StreamMovieScene = Sequencer->GetSequence()->GetMovieScene();

TArray<UMovieSceneTrack*> matrix_of_tracks = StreamMovieScene->GetMasterTracks();
for (UMovieSceneTrack* Track : matrix_of_tracks)
{
	StreamMovieScene->RemoveMasterTrack(*Track);
}
// maybe something must be done here with GUID()	

// ONLY TEXTURE
UMovieSceneMediaTrack* VideoStreamMediaTrack = StreamMovieScene->AddMasterTrack<UMovieSceneMediaTrack>();
UMovieSceneMediaSection* VideoStreamMediaSection = Cast<UMovieSceneMediaSection>(VideoStreamMediaTrack->CreateNewSection());

UStreamMediaSource* VideoStreamMediaSource = NewObject<UStreamMediaSource>();
VideoStreamMediaSource->StreamUrl = "http://localhost:8000/D6-5min-1/video_stream/video_master.m3u8";
VideoStreamMediaSource->PlatformPlayerNames.Add("Windows", "ElectraPlayer");

UMediaTexture* StreamMediaTexture = NewObject<UMediaTexture>();
StreamMediaTexture->NewStyleOutput = true;
StreamMediaTexture->Filter = TextureFilter::TF_Bilinear;
StreamMediaTexture->OutputFormat = MediaTextureOutputFormat::MTOF_SRGB_LINOUT;

VideoStreamMediaSection->MediaTexture = StreamMediaTexture;
VideoStreamMediaSection->SetMediaSource(VideoStreamMediaSource);
VideoStreamMediaSection->StartFrameOffset = 0;
PremiereWidget->video->Brush.SetResourceObject(StreamMediaTexture);
StreamMediaTexture->UpdateResource();

VideoStreamMediaTrack->AddSection(*VideoStreamMediaSection);

// ONLY AUDIO (via player)
UMovieSceneMediaTrack* AudioStreamMediaTrack = StreamMovieScene->AddMasterTrack<UMovieSceneMediaTrack>();

UStreamMediaSource* AudioStreamMediaSource = NewObject<UStreamMediaSource>();
AudioStreamMediaSource->StreamUrl = "http://localhost:8000/D6-5min-1/audio_stream/audio_master.m3u8";
AudioStreamMediaSource->PlatformPlayerNames.Add("Windows", "ElectraPlayer");

UMovieSceneMediaSection* AudioStreamMediaSection = Cast<UMovieSceneMediaSection>(AudioStreamMediaTrack->CreateNewSection());
AudioStreamMediaSection->SetMediaSource(AudioStreamMediaSource);
AudioStreamMediaSection->StartFrameOffset = 0;
AudioStreamMediaSection->bUseExternalMediaPlayer = true;

UMediaPlayer* AudioMediaPlayer = NewObject<UMediaPlayer>();
AudioStreamMediaSection->ExternalMediaPlayer = AudioMediaPlayer;

AudioStreamMediaTrack->AddSection(*AudioStreamMediaSection);	

UMediaSoundComponent* audio_component = Sequencer->FindComponentByClass<UMediaSoundComponent>();
audio_component->SetMediaPlayer(AudioMediaPlayer);