You might have to try it with client-side scripting. I have heard that the object tag, of mediaplayer, exposes the GetDuration method that tells us the time span of the media that it plays. It is worth a try.
If your markup is as follows,
<object id="customMediaPlayer" />
Hope this helps.