videojs / video.js

Video.js - open source HTML5 video player
https://videojs.com
Other
38.12k stars 7.46k forks source link

Fast transition when changing HLS video sources #7539

Open rpaschoal opened 2 years ago

rpaschoal commented 2 years ago

I'm currently trying to change the source of a player instance from video source 1 to video source 2 (both HLS sources) without having users seeing a loading spinner between transitions.

I've stumbled across this https://github.com/videojs/video.js/issues/7184 issue and have implemented a solution with multiple instances in the DOM as suggested which at first work as expected however this introduces a couple UX issues such as users losing their full screen state when the players are swapped. It is important for my use case to have the player remaining on fullscreen.

Is there an alternative to this, perhaps using the player tech (vhs) to prefetch/preload HLS streams? Thank you 😃

welcome[bot] commented 2 years ago

👋 Thanks for opening your first issue here! 👋

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. To help make it easier for us to investigate your issue, please follow the contributing guidelines.

gkatsev commented 2 years ago

Unfortunately, we don't currently have a way for VHS to handle this, though, theoretically possible. It also isn't currently something we're planning on looking into. Potentially, the workaround for fullscreen is to create a custom fullscreen button which will take a parent container fullscreen rather than the player element. Then you could still do the double buffering/double player trick. You'd also then want to override some of the userActoins such as doubleClick. Alternatively, you could use the link element with preload/prefetch/precache/preconnect to load the second url. This should help minimize the time it takes to load the content from the new source.

rpaschoal commented 2 years ago

Hi @gkatsev , thanks for getting back to me. It would be awesome if this could be done through VHS but I understand is it not up for consideration at the moment.

I did consider what you suggested for the fullscreen workaround and I wonder if you have any updates on this issue https://github.com/videojs/video.js/issues/3249 ? It would be pretty sweet if we had the possibility to customize the fullscreen event as you have suggested here https://github.com/videojs/video.js/issues/3249#issuecomment-454155799

gkatsev commented 2 years ago

I don't have any updates on #3249, unfortunately. It's most likely will have to come in the form of a PR from a contributor as it's unlikely we'll have the time to implement it ourselves.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.