Distinguish HLS content during stream

801 views Asked by At

I want to distinguish the content type of data incoming from a HLS stream using Google's ExoPlayer.

Specifically, I want to distinguish between Video and Audio-only content.

Thanks!

1

There are 1 answers

3
Mick On

Accoridng to the Exoplayer documentation the player does not currently support detecting the media format at all:

ExoPlayer does not (yet) automatically detect the format of the media being played. An application needs to know the format of the media it wishes to play in order to construct an ExoPlayer capable of playing it. Removing this limitation is tracked by Issue #438.

The issue link mentioned above is: https://github.com/google/ExoPlayer/issues/438

You could look at the raw stream yourself if you can access it (it is not encrypted) and figure out from there if it is audio or video but this will need a reasonable amount of work: HLS is a 'streaming protocol' that streams MPEG-2 transport streams, chunked into segments. Each of these MPEG-2 transport streams can contain audio and video.

The MPEG standards (MPEG 1 and MPEG 2) use stream ids to identify each individual audio or video stream in the transport stream. Audio streams are numbered 110X XXXX and video streams 1110XXXX - hence you can check all the individual streams in an MPEG2 transport stream and see if whether it is audio only, video only or a mix.