Skip to content

How is duration determined by hls.js ? #5073

Answered by robwalch
robotkutya asked this question in Q&A
Discussion options

You must be logged in to vote

HLS.js determines duration first based on the Playlist (20 seconds using the example above). As it parses each segment, it updates its model of the playlist, based on the duration of the media parsed. After processing the first segment, if it finds that it has only 9.5s of audio or video, then the duration will be updated from accordingly (20 -> 19.5).

Very small amounts of change are ignored, and reducing the duration is avoided (see buffer-controller for how MediaSource duration is set).

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by robwalch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants