Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect current bitrate of HTTP Live Streaming in Safari

When using Apple Live Streaming in Safari, is there any way to detect the current bitrate with Javascript? Alternatively, can I detect which element of the .m3u8 is being played?

I've looked at the HTMLMediaElement Class Reference, but found no clues there. The src property always references the .m3u8 file, so that doesn't help.

like image 280
Paul Dixon Avatar asked Feb 19 '23 20:02

Paul Dixon


1 Answers

It looks like the WHATWG is trying to address that very concern. See their document about HTML5 video metrics here: http://wiki.whatwg.org/wiki/Video_Metrics

Using the Safari web developer tools, you can see that Webkit has implemented the following properties on the HTMLVideoElement:

  • webkitAudioDecodedByteCount
  • webkitDecodedFrameCount
  • webkitDroppedFrameCount
  • webkitVideoDecodedByteCount

There isn't much documentation out there about these, but I found some sample code that might be helpful.

I'd be very interested to hear if these properties worked for you. Please post your feedback if you gain any insight.

like image 186
TimHayes Avatar answered Feb 27 '23 09:02

TimHayes