videojs html5 video retrieve absolute time relative to live content

Viewed 1003

I'm using VideoJs (using an HTML5 player) to play live content from a DASH or HLS source.

I would like to be able to know how far behind the actual playback is from the actual live content.

How can I do this?

There is a player.currentTime(), and a player.liveTracker.seekableEnd() as described on https://docs.videojs.com/tutorial-live.html, but these are given in relative units and do not necessarily track the content's timeline because of buffering / other network transmission delays.

How do I calculate how far behind (in milliseconds) the player is playing vs what the actual live HLS or DASH live source is outputting?

1 Answers

If you just want to test the difference between the time the frame is displayed on the screen and the time the actual live event happened (i.e. in the real world), the usual way to do this is to film a live clock or 'clapperboard'.

If you are testing an end to end delivery, maybe involving cloud processing, packaging etc, then the easy way is to have the clock and the streamed video beside each other.

  • Film a clapperboard with your camera
  • Feed the video stream into whatever your video workflow is (encoders, packagers, CDN etc)
  • Play your live stream on a player
  • Put the clapperboard and the player beside each other
  • View, photograph or video the two screen - the difference between the times is the latency

Amazon have a good overview here including this picture which helps explain it:

enter image description here

(https://aws.amazon.com/blogs/media/how-to-compete-with-broadcast-latency-using-current-adaptive-bitrate-technologies-part-1/)

If you want to be able to do it on the client alone then you would need to add in some accurate timestamps into the metadata for each frame. I am not aware of standard equipment doing this but there may be some available - there are mechanisms such as SEI (https://mpeg.chiariglione.org/tags/sei-messages) in H.264 to convey information to 'supplement' the video, but again, they are not commonly used in this way AFAIK.

Related