Gilad Eshkoli
Gilad Eshkoli

Reputation: 1263

ExoPlayer - How to know if HLS video is Live or not?

I'm developing a video application when an HLS video starts as Live but after the .m3u8 playlist has completed loading we want to move back to seeing VOD HLS instead of Live.

How can I tell if HLS video is in Live mode and changed to VOD ?

Upvotes: 3

Views: 2298

Answers (2)

Roger Alien
Roger Alien

Reputation: 3080

You can try mExoPlayer.isCurrentWindowDynamic() link

so in the code you will use it like this:

    if (mExoPlayer.isCurrentWindowDynamic()) {
        // treat me as live stream
    } else {
        // treat me as VOD (Video On Demand)
    }

Upvotes: 2

Namdev Londhe
Namdev Londhe

Reputation: 111

I have tried for detecting the HLS video is Live or VOD. We can able to differentiate a live stream from a VOD by getting the player's duration after it is prepared. The live streams will return UNKNOWN_TIME, where as VOD streams will return the fixed known duration of the stream which is currently playing.

Upvotes: 1

Related Questions