-
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
How Could I start playing video from second segment in first playlist calls? #6598
Comments
Interrupt loading once the segment list is retrieved. Loading can be started at the start time of any segment in the list: // begin loading playlists with a callback for the first variant playlist
// containing the last of segments (`details.fragments`):
const hls = new Hls({});
hls.loadSource('https://host/index.m3u8');
hls.attachMedia(hlsVideo);
hls.once(Hls.Events.LEVEL_UPDATED, (name, data) => {
// set the start position using startLoad to skip loading of the first segment
const fragments = data.details.fragments;
const startTime = fragments[1].start;
hls.startLoad(startTime);
}); |
Hi, thanks so much! I've been working on a solution for that. I was able to fix it by changing the value of liveSyncDurationCount. The value was 8, and I set it to 0, which made it start consuming the second segment from the first playlist exactly as I needed. Now I'm wondering if my solution is the best approach, since your solution seems better. What do you think? |
I did not notice that you were working with a live playlist. Live playlists should be at least three segments long and Alternatively, you can set Those guidelines work best with 4-10 second target durations. If you insist on using two second segments, you should at least double the number of segments in your sliding window and hold back an addition segment to maintain steady playback. |
@robwalch
Is there a best practices manual for configuration/delay that I can read? Regarding holding an additional segment, I didn’t understand what you meant. Could you provide an example? Thank you for your attention. ✋🏾 |
I mean hold back the playhead one additional segment duration from the end of the playlist. So if you have 2 second segments, the playlist should be at least 6 segments long and playback should start 3 or more segments from the end (as apposed to only 2.5). |
Oh I got it! |
What do you want to do with Hls.js?
I want to know how I can start playing a video from the second segment. I have a playlist.m3u8 file with two segments inside. I know how to detect which segment was loaded, but I need to intercept it and change to get next one.
In the photo, we can see my mock playlist.m3u8, and in the console at the bottom, we have segment logs showing the segment that was loaded. The objective is to get segment 509 instead of segment 508.
Could someone help me with this?
Could someone can help me, please?
What have you tried so far?
I try find some solution in doc but I fail, after that I try to change currentTime passing some seconds in future to try advance in future to get next segment, but I fail again, I don't know what I need to do to resolve my issue
The text was updated successfully, but these errors were encountered: