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

Detect ended stream based on #EXT-X-ENDLIST #2288

Closed
klanjabrik opened this issue Jun 27, 2019 · 7 comments
Closed

Detect ended stream based on #EXT-X-ENDLIST #2288

klanjabrik opened this issue Jun 27, 2019 · 7 comments

Comments

@klanjabrik
Copy link

What do you want to do with Hls.js?
Detect if the stream has been ended based on #EXT-X-ENDLIST in m3u8 file

What have you tried so far?
I've been output all Events with console, but there are no Events fired when the stream has ended.

@Korilakkuma
Copy link
Contributor

The HTMLVideoElement#stalled event is fired when the user agent is trying to fetch media data, but data is unexpectedly not forthcoming.

const video = document.querySelector('video');

video.addEventListener('stalled', (event) => {
  console.log('ended');
});

@tjenkinson
Copy link
Member

tjenkinson commented Jun 27, 2019 via email

@klanjabrik
Copy link
Author

Correct me, ended event produce 2 possibilities:

  1. Video was over
  2. data is not available (due to lack of connection)

@tjenkinson
Copy link
Member

tjenkinson commented Jun 28, 2019 via email

@klanjabrik
Copy link
Author

I think you're right @tjenkinson .

So i made script below:

const video = document.getElementById('video');
video.addEventListener('ended', (event) => {
  console.log('Stream ended.');
});

I tested the video running m3u8 with #EXT-X-ENDLIST and the log showing Stream ended as expected. BUT if there is no #EXT-X-ENDLIST, the log output is different.

Thanks for the discussion @tjenkinson @Korilakkuma.

@moonbrv
Copy link

moonbrv commented Oct 29, 2020

We have an ended event listener on the video element, but when I received EXT-X-ENDLIST tag I see nothing happened... Also, I did try to lister for stalled event, also does not help. I did try to listen for Hls.Events.BUFFER_EOS but it's emmited only few seconds after EXT-X-ENDLIST received, so users see spinner in video element. How can I know that EXT-X-ENDLIST was received?

@robwalch
Copy link
Collaborator

robwalch commented Oct 29, 2020

Hi @moonbrv,

The latest release includes some changes that should have improved handling of ENDLIST: #3124

Please file a new Bug Report as this issue was closed over a year ago.

Please include all the details required to reproduce your issue - hlsjs config, stream properties, etc...

( I have a guess that if your playlist update that adds EXT-X-ENDLIST does not also add a new segment, then EOS is never added because all appending was done in LIVE mode rather than VOD mode. That might not be the problem but something we can look into as part of a new issue. )

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

No branches or pull requests

5 participants