Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live absolute timestamp #8974

Open
bbert opened this issue Feb 4, 2025 · 4 comments
Open

Live absolute timestamp #8974

bbert opened this issue Feb 4, 2025 · 4 comments

Comments

@bbert
Copy link

bbert commented Feb 4, 2025

Hello,
I was wondering how to get live absolute timestamp using the official API, either for DASH or HLS live contents?
Player.currentTime() and Player.buffered() return timestamps relative to 0, with timestampOffset applied to the MSE buffers.

Copy link

welcome bot commented Feb 4, 2025

👋 Thanks for opening your first issue here! 👋

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@mister-ben
Copy link
Contributor

You can get the start time from player.tech(true).vhs.playlists.media().dateTimeObject.getTime() then calculate currentTime() offset from that.

@bbert
Copy link
Author

bbert commented Feb 6, 2025

Thanks @mister-ben for your response.
dateTimeObject is available only for HLS streams.

I found 2 other means by introspecting Player object:

  • get either programDateTime (HLS) or presentationTime (DASH) of 1st segment in player.tech(true).vhs.playlists.media().segments
  • get applied MSE buffer timestampOffset: player.tech(true).sourceHandler_.playlistController_.sourceUpdater_.videoTimestampOffset_

Don't know the reliability of each

@bpkmatthiasv
Copy link

bpkmatthiasv commented Feb 18, 2025

Hi @mister-ben, interested in a solution for this, as I have a DASH stream with availabilityStartTime not starting in 1970, how can I convert it to absolute UTC timestamp ?
Stream for reference: https://cmafref.akamaized.net/cmaf/live-ull/2006350/akambr/out.mpd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants