-
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
No 'ended' event on Safari only by my stream #5703
Comments
If it is browser issue, is there someone can help provide some encoding suggestion to avoid this problem? |
@legolaserea On that m3u8 Test Stream, 2 of the streams are 10 seconds, and the 3rd is 2.88 seconds.
|
Experiencing the same problem in Safari 16.5.1 on desktop. I can't reproduce with Big Buck Bunny on https://hlsjs.video-dev.org/demo/, but I can reproduce with my test stream. I get the following errors in the console when the video ends:
I have previously had a similar issue with my streams in all browsers in 1.1.2 but I believe it was already resolved in other browsers: #4783. I'm using ffmpeg to encode. I think the underlying issue could be due to that encoding process producing short final segments? |
Testing a bit more I'm noticing that in my case this problem is inconsistent. Sometimes the Bit of a hack but I'm trying a temporary workaround by adding a media error handler that calls my hls.on(Hls.Events.ERROR, (event, data) => {
if (data.type === Hls.ErrorTypes.MEDIA_ERROR && data.details === 'bufferStalledError') {
if (video.duration - video.currentTime < 0.1) {
onEndedHandler();
}
}
});
video.addEventListener('ended', onEndedHandler); |
Same problem here but on Chrome 120 (dev). |
Hopefully fixes that landed in Safari 17 have improved the reliability of the "ended" event for those of you who have experienced it in the past. We've moved the automated Safari test runs to latest and have seen much better results on tests that include seeking near the end and listening for "ended". There are some edge cases like certain tests with overlapping appends on start not firing the event; presumably, re-appending the first segment before playback begins might interfere with autostart which can fail the test, and I've seen "ended" fire on VOD even when HLS.js has not marked EoS on the MediaSource. The purpose of #6141 if to give you an event you can rely on even in older use-agents or streams with issues near the end. Please try it out and leave feedback on the PR. Thanks! |
What version of Hls.js are you using?
1.4.10
What browser (including version) are you using?
Safari 16.5
What OS (including version) are you using?
Mac OS 12.6
Test stream
https://voddemo-play.volcvod.com/1dd490a910e143de95c1e6a0345e1d81.m3u8?auth_key=1784955407-8c15a1326e1f45929b43f26b1826c6b0-0-8d947d2362115532e3306b9b9c692111
Configuration
Additional player setup steps
No response
Checklist
Steps to reproduce
Expected behaviour
The 'ended' event will be triggered when the video is played to the end
What actually happened?
The 'ended' event not be triggered when the video is played to the end
Console output
"[buffer-controller]: Could not call mediaSource.endOfStream(). mediaSource.readyState: ended"
Chrome media internals output
No response
The text was updated successfully, but these errors were encountered: