When testing MediaPlayer->OnEndReached with a shorter audio file that is only a few seconds it works. If I try the same code with a longer file, like a couple minutes long, it never fires.
Yeah, this is a bug that I just discovered. If you’re compiling the Engine from source, you can fix it by updating WmfMediaSession.cpp:
void FWmfMediaSession::GetEvents(TArray<EMediaEvent>& OutEvents)
{
#if WMFMEDIASESSION_USE_WINDOWS7FASTFORWARDENDHACK
if (CurrentDuration > FTimespan::Zero())
{
FTimespan Time = GetTime();
if ((Time < FTimespan::Zero()) || (Time > CurrentDuration))
{
if (!ShouldLoop)
{
const HRESULT Result = MediaSession->Stop();
UE_LOG(LogWmfMedia, Verbose, TEXT("Session %p: Forced media session to stop at end: %s"), this, *WmfMedia::ResultToString(Result));
}
HandleSessionEnded();
}
}
#endif
EMediaEvent Event;
while (DeferredEvents.Dequeue(Event))
{
OutEvents.Add(Event);
}
}
I will get this into the upcoming hotfix as well.