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
Hls fragments don't stop loading after destroying player #2273
Comments
Do you have a URL I can check please? |
I created a user so you can check: |
OK I'll check it and keep you posted. Thanks |
Once I'm there where should I look at? there are different sections and IDK which one I can test for issues |
You can test by accessing any of the items on the first carousel. All those contents are live and hls. |
And then I just play it and pause it? Or is there anything else I need to do? |
Nevermind, I see what you are saying. I'll take a look. When it is paused, it should stop the loading of fragments. But I'll confirm that |
Play one of those contents while having console and/or network tab open. You'll see Fetch messages for both .m3u8 and .ts files. When you go back or navigate somewhere else, content loading should stop but it doesn't. Furthermore, if you access another content on that carousel you'll see that there are Fetch logs for both contents, the one you closed and the one you're watching. My best guess is that once async hls fetching starts it doesn't stop until buffer's full. Regardless of what I do... |
As you said, when the video is paused this occurs as well but I don't think that's necessarily an issue because you could pause to allow the player to buffer, if you have a bad internet connection for example. My issue is that I can't stop destroyed, removed players from loading fragments.. the only thing that stops the load is refreshing the screen. |
Gotcha. Well let me explore this situation and I'll let you know my findings |
BTW, you prefer me to speak in Spanish with you? |
First thing I noticed is the |
BTW, 4.1.3 fixed something related to |
English keeps it universal, but thanks for the offer! |
Can you put a test page where you use the 4.1.3 so I can see what's going on with this version, please? I'm setting up a test page to check this issue but I want to make sure I can have some reference to your issue |
Ok, I'll update and create a separate frontend version so you can test it. I'll let you know. |
Thank you I appreciate it |
And if you can provide me a code snippet of how you are setting this up I'd also appreciate it. I haven't dealt a lot with React to know how to execute a |
Just FYI, I tried this inside the
|
Here's the 4.1.3 version: http://iday.rocstar.tv/
|
I don't think thats the issue since the snippet I posted above was using 4.1.3 and I used the remove method |
Ok so my question is how you remove the component? Can you share the piece of code that removes it? Because maybe that's what I didn't understand: the method will be called once the player is removed and that already happened |
That way I can update the documentation if needed |
This is the code I use to remove the player componentWillUnmount() {
if(this.state){
// If player exists
if (this.state.player) {
this.state.player.pause();
// If player is reproducing hls
if(this.state.player.media.hlsPlayer){
this.state.player.media.hlsPlayer.stopLoad();
this.state.player.media.hlsPlayer.destroy();
}
try{
this.state.player.remove();
}catch(e){
console.log(e);
}
}
var videos = document.getElementsByTagName('video');
for( var i = 0, total = videos.length; i < total; i++ ){
try{
videos[i].parentNode.removeChild(videos[i]);
}catch(e){
console.log(e);
}
}
}
} On version 4.1.3 this method: |
|
In React you don't remove a component. You update the state and React figures out if a component, in this case the player, is no longer needed thus it unmounts it. Before it is unmounted the method |
And what executes your componentWillUnmount in your code? I'm just trying to imitate this locally |
I use redux to handle state so I dispatch an action. In order to imitate that exact behavior you need react and redux. It should be the same as calling a function... but maybe not. |
Ok I'll keep trying and keep you posted |
I've tested 2 different chromecast devices in 3 different networks but it's not working for me. I click on the cast button and select a casting device, just like in the screenshots but it only casts for a second, then it goes into pause. When I click play again it won't start. It looks like it's loading on the device I'm casting to, but the player is automatically set to pause. There are no error messages. I experience the same behavior on android and desktop every time so at least it's consistent. When I stop casting I get this error:
HLS chunks are being loaded, everything else looks normal. Any ideas on what to try next? |
If you want to test it yourself you can go to iday.rocstar.tv, same user and pass. Keep in mind that I haven't worked on the unmounting issue, so refresh the screen to test instead of navigating in and out of a channel. |
In your configuration have you used castIsLive: true? |
I know you are streaming TV so you must set the live flag so Chromecast takes care of some specific elements |
Nice catch. I added it and but still experience the same behavior. The only change is that when I press play after stream got paused it doesn't automatically set itself to pause on the player. Still no errors. |
I'll take a look because I tried something on my local following that approach and it worked fine. |
The first error on |
Yeah I logged in and I could see the streamings. I just took the screenshot of everything I saw. So you can ignore the first error. But definitely there's something going on with the streamings |
Ok, so I'm going to update that version with the castIsLive=true and point it to another server that shouldn't have problems. I'll let you know how it goes. |
Ready: http://iday.rocstar.tv/ I can't reproduce the |
OK I'll check this later; if you can point any other issues while you test, let me know |
Where did you set the castIsLive? I cannot find it |
if |
castIsLive is set here:
Replacing camlCase for '-' is a react thing. If the property doesn't exist it warns you so I know it's working. Where would you add it if not there? I followed the example here: https://github.com/mediaelement/mediaelement-plugins/blob/master/docs/chromecast.md I get the Where you able to cast on iday.rocstar.tv? |
Yes but that particular element integrates like this: new MediaElementPlayer('player-id', {
// All your config...
castIsLive: true
}); The only elements that |
YES! It works now! thanks! I'm going to keep testing. I still have to figure out how to work with chromecast sessions and react but I will! I'll keep you posted! |
Such good news! Yes keep me posted on anything so I can release these changes |
It's working great. I just have a few cosmetic issues and a few improvement ideas. 2 - I can no longer pause the video player by touching the screen. I find it useful to have control of the player from the screen, specially on mobile devices. Once the video is paused I can set it to play from the screen, no problem. This only happens when castIsLive is set to true, otherwise it works fine. I want to handle casting "a la Netflix" and it's been working great. If I don't stop the cast and change channels the stream updates, so I can do zapping while casting. Some channels get automatically paused when I do this, others not. I'm going to test this further and try to get cast information from Improvement ideas (mostly based on the "a la Netflix" concept):
I'm going to keep testing and trying stuff. Let me know how can I help move this along. Great work! |
I'm not able cast youtube videos embedded on the player. Cast starts, sends title and description information but that's all it happens. |
Thanks I'll check your suggestions about the plugin. As for the YouTube, the plugin only allows to play what natively plays with Chromecast. YouTube is loaded through an iframe and that's not something that natively supports |
And for your concerns with customizing the icon in the app, I'm using the default receiver but it's gonna be on your side to develop a new receiver with all the customized features you want to see on TV. I just provide the basic platform for it. You will need to check Cast documentation about how to build a new receiver. |
I really appreciate the time you have spent testing. I'll address the issues with play pause and the poster image locally, and with that I'll release the changes on this plugin |
Sounds great, keep me posted! |
So as far as the poster issue, YouTube implements that same workflow: a poster that remains static with every interaction you are having when you are connected to Chromecast. If you don't need that, you must avoid the |
Just FYI, I'm doing some last fixes to make sure the interaction with MEJS and chromecast gets better. I'll keep you posted when I'm done with this final adjustments |
OK I have pushed everything to the master branches in both projects; if you can test them once more before I release I'd appreciate it. One thing to note: everything works as expected in a single page player, but with ReactJS there are not a lot of resources to dig more. Once you have something online, and if you feel stuck, reach Chromecast team so they give you guidance, and if needed, I can perform more fixes. But as it is right now, the plugin should be ready to go. It's more a matter of implementation on ReactJS at this point. If you have feedback from them, create a new ticket rather than writing on this one. Thanks again for all your help on this |
Awesome, I'll be testing it today, I'll open another issue if something comes up. Thanks!! |
After an hls stream starts I can't get it to stop streaming.
I'm using React 15.5.4, medialement 4.1.2 and hls.js 0.7.9, Chrome, latest version.
On player's
componentWillUnmount()
I do the following: (where 'player' is the MediaElementPlayer)this.state.player.pause();
this.state.player.media.hlsPlayer.stopLoad();
this.state.player.media.hlsPlayer.destroy();
this.state.player.remove();
I even remove the node from the HTML. I checked step by step and everything's being executed properly, no errors.
As I navigate back in the browser I still see chunks being loaded. In the screenshot below, I accessed a different contents and navigated back twice more.
As a result you can see both .m3u8 lists as well as .ts chunks are being loaded for 3 different contents: canal9vivo, americatv and tvp.
I tested it with medialelement 4.1.3 but controls are not working for me on chrome. Content starts, but I can't see the controls or pause it. I get no errors. It's working fine on android though.
Am I missing something?
Thanks in advance.
The text was updated successfully, but these errors were encountered: