-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Frame accurate seeking in HLS #6649
Comments
This is usually the result of audio priming or video composition time pushing frame rendering times on the HTMLVideoElements timeline out a bit.
On let tOffset = 0;
const getAppendedOffset = (eventName, { frag }) => {
if (frag.type === 'main' && frag.sn !== 'initSegment' && frag.elementaryStreams.video) {
const { start, startDTS, startPTS, maxStartPTS, elementaryStreams } = frag;
tOffset = elementaryStreams.video.startPTS - start;
hls.off(Hls.Events.BUFFER_APPENDED, getAppendedOffset);
console.log('video timestamp offset:', tOffset, { start, startDTS, startPTS, maxStartPTS, elementaryStreams });
}
}
hls.on(Hls.Events.BUFFER_APPENDED, getAppendedOffset); |
Thank you! That solves my issue. Seems to me that this information deserves a place in the documentation, such as in |
Thank you for the suggestion @fredrikj. Would you submit a PR adding that documentation? |
My HLS streams (transcoded from MP4 files with AWS MediaConvert) always get a time offset of 0.213 seconds. This causes time update events and seeking to be off by this much time. Is it an inevitable deficiency of HLS to not be frame accurate, or does HLS.js have a way to solve this?
The text was updated successfully, but these errors were encountered: