Media Player Get Duration returns 0


I’m trying to get the overall duration of a video file in a media player, because I want to rewind it at half time and restart it from the beginning.

I tried to use a reset function called by a timer that fires every 0.5 * duration seconds. Here’s the blueprint:

Blueprint Pastebin

However, it doesn’t work, because the Get Duration Node returns a solid 0 no matter what file I specify. I also switched between Media Players (VLC and the Native windows media player) all with same result.

What am I doing wrong?

Kind regards and thank you

Turns out, get duration returns the actual duration, when the player is set to playing (and only playing. It’s not working, if it’s set on pause)

That said, it affects seek as well (I only can seek, when the player is set to play - which causes a lot of inconsistency)

The OnSeekCompleted-Event is never being called either. The video is starting to play from the desired position, though.

What am I doing wrong?

Hi - I figured out a way. If you put a delay after calling play on the media source, it now returns the length. This is not the best way to do this - but its working. Any one know a better way then please leave a comment. Thanks

1 Like

You could actually skip the delay. See my comment above

what do you mean you can skip the delay? its not possible. You can only skip the delay if the media is already playing. If its not playing you need the delay

Back when I tested it, it was sufficient to set the state to “playing” and the duration was immediately available when I tested it.

However, with or without delay, it was entirely insufficient for my purpose back then, which is why I replaced everything with the bing player plugin, that actually worked.

Any new info on this? Have searched around and this is the only thing I can find on this subject. Unable to get ‘Get Duration’ to return anything other than 0.
I’m playing random sources from a playlist and using MI Interpolation to add effects at the beginning and end of the clips. Need the duration of the clip to set when to play the end effects.

With HISPlayer Unreal Engine Media Player for Windows you can get total time of a video. However, the video content must be in mp4, HLS or DASH streaming formats