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

stream-controller won't seek to live if seeking before the first fragment #2260

Closed
wants to merge 1 commit into from

Conversation

mfedderly
Copy link
Contributor

This PR will...

Split out the logic that forces seeks to jump to live if they are too far behind the live point from the logic that constrains seeks to the beginning of the video.

Why is this Pull Request needed?

I've got an HLS chunklist where the first fragment starts at 2.5ish seconds instead of 0. We'd like to seek to the beginning of the video, so we try to seek to 0. Since this is before 2.5, HLS jumps to live. Instead I propose that we first clamp the seek to the start of the video, and then apply the check for maxLatency.

Are there any points in the code the reviewer needs to double check?

Resolves issues:

Checklist

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
  • API or design changes are documented in API.md

Copy link
Collaborator

@johnBartos johnBartos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try seeking to video.buffered.start(0) instead of 0? I don't think your use case is broad enough to warrant merging into master, and as this is a change in the existing API, it must be made in a major release.

Alternatively, you can get the fragments array from an event, and set Hls' start time to that fragment's start.

@mfedderly
Copy link
Contributor Author

video.buffered.start(0) isn't necessarily the earliest part of the video that is seekable, depending on when you started the player. Is there a way to get access to the fragment data from outside of HLS code? If I can look up the start time and seek there instead, I wouldn't need this change.

@mfedderly
Copy link
Contributor Author

video.seekable.start(0) also returns 0 so I can't use that.

@johnBartos
Copy link
Collaborator

@mfedderly Try listening to the LEVEL_PTS_UPDATED event:

`hls.on(Hls.Events.LEVEL_PTS_UPDATED, data => {
    video.currentTime = data.start;
});

Let me know if this works

@mfedderly
Copy link
Contributor Author

LEVEL_PTS_UPDATED exposes the fragments, so its possible to get the information, just a little tricky to make sure we have a set of fragments after HLS has attempted to load the fragment for time offset 0. Going to go ahead and close this, but I'll probably keep using my forked version in the short term before attempting to use these events.

Thanks!

@mfedderly mfedderly closed this Jun 19, 2019
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

Successfully merging this pull request may close these issues.

2 participants