Rohan M
Rohan M

Reputation: 181

Android Exoplayer : Get currentTime for a live stream

How do you get the current time for a live video(rtmp) when using Exoplayer? I tried

player.getCurrentPosition() 

but the values start from 0 and not the actual time of the live stream. Is it possible to get the actual video time?

Upvotes: 3

Views: 6598

Answers (1)

In this case, I implement with subtraction between date now with user start date playing like this. dateStartPlaying is initialized when we want to play some content / change the content.

private long getCurrentTimeLiveStreaming(){
    return new Date().getTime() - dateStartPlaying.getTime();
}

Upvotes: 1

Related Questions