The Wayback Machine - https://web.archive.org/web/20200527044242/https://github.com/video-dev/hls.js/issues/2473
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

Can't `hls.loadSource()` a second video without errors #2473

Open
ffxsam opened this issue Dec 16, 2019 · 6 comments
Open

Can't `hls.loadSource()` a second video without errors #2473

ffxsam opened this issue Dec 16, 2019 · 6 comments

Comments

@ffxsam
Copy link

@ffxsam ffxsam commented Dec 16, 2019

image

I get this in Firefox (Chrome shows nothing at all) when I try to do hls.loadSource() on an m3u8 URL after already having played a different URL previously. Do I need to completely re-init HLS each time between videos?

The use case: I have a playlist/queue of m3u8 URLs and want to play them in succession.

@robwalch
Copy link
Collaborator

@robwalch robwalch commented Dec 19, 2019

Sounds like a bug.

Have you confirmed this is the case with any two urls?
Is it only in Firefox?
Is this a regression, or is the behavior the same in 0.12.x?

I can't confirm using the demo because it always configures and instantiates a new player.

@robwalch robwalch added the Need info label Dec 19, 2019
@atgnatus
Copy link

@atgnatus atgnatus commented Jan 2, 2020

First, you should answer @ffxsam 's question - Is this a bug? I have been trying to get an answer to this for over a year.

My app plays a series of videos. It starts playing the next video automatically when the current video finishes. The only reliable way I have found to get this to work across all browsers and network conditions is to call this.hls.destroy() and then this.hls = new Hls() between each video before calling this.hls.loadSource().

I've tried a lot of different approaches to avoid this like ensuring the event queue was drained or calling loadSource() with null (or something). My most common problem was without destroying and re-initializing hls, the previous video would start replaying if there was any sort of buffer stall.

We would like to just call loadSource() a hundred times in a row but it does not reset the hls engine correctly for this (buffer should be cleared, etc.)

So, is this a bug? Do we need to re-initialize between videos or should calling loadSource() work?

Thank you.

@ffxsam
Copy link
Author

@ffxsam ffxsam commented Jan 2, 2020

It's cool, I don't expect @robwalch to do all the footwork on this since it's open source! I've just been too busy to respond as of yet. My workaround is to simply destroy & recreate the HLS instance every time.

I'll circle back to this once some time frees up.

@atgnatus
Copy link

@atgnatus atgnatus commented Jan 3, 2020

I apologize if I came across harshly. I love hls.js and am indebted to everyone who works on it.

I have seen my issue on Chrome, Firefox and Edge (latest 2 versions) in 0.12.4.

I have not seen the file corrupt message in 0.12.4.

We are not scheduled to upgrade to 0.13 for another week. At that time, I will try to create a test case.

However, if possible, I would be interested in knowing what the expected behavior is. From the documentation you get the impression you should be able to loadSource() as often as you want on an instance of Hls. However, the test cases are all written with the destroy and re-instantiate method.

@robwalch
Copy link
Collaborator

@robwalch robwalch commented Jan 3, 2020

I think it should work the way you expect, but it does not. So, the workaround (and common practice) is to destroy and reinitialize. (You are not alone. We're all doing it. IDK if the project ever supported it or if it's just one of the oldest regressions... doesn't matter.)

I'll add the Bug label and leave the Need Info label until the description contains a complete bug report (browsers, steps to repro...). Thanks!

@robwalch robwalch added the Bug label Jan 3, 2020
@blacktrash
Copy link
Contributor

@blacktrash blacktrash commented Jan 5, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.