ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Getting real current time position in HLS live streaming

Open aarondib opened this issue 9 years ago • 3 comments

In v2.1.1 getCurrentPosition() returns position in current window. Here is the solution to get time that increases indefinitely: https://github.com/google/ExoPlayer/issues/2118

However, position is always starting from 40000 - 70000 ms, rather then from 0 ms. Is there any way to get this starting offset to calculate real time position, like it was in v2.0.2?

aarondib avatar Jan 04 '17 09:01 aarondib

It's quite arbitrary to assume time=0 corresponds to when the user happened to join the playback. What are you actually trying to do? If you're just trying to show an increasing time in your UI and want it to start at 0, then (a) why is this useful, and (b) why don't you just take the first position queried after playback starts, and subtract that value from each position before displaying it?

ojw28 avatar Jan 04 '17 13:01 ojw28

@ojw28, In our case, server provides access to a video archive at the specified time, depending on http request. "specified time" + getCurrentPosition() gives users actual playback time. For example, when user selected playback from 10:00:00, instead playback timeline showing it started from 10:01:10.

Actually, (b) way is possible, if you think it is the most correct way? Thanks!

aarondib avatar Jan 04 '17 17:01 aarondib

It doesn't sound like a great setup to be serving archived content in the guise of live streams in the first place. That aside, I'd suggest you go with (b).

ojw28 avatar Jan 04 '17 20:01 ojw28