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

Local/offline playback + download support #1189

Closed
jimmywarting opened this issue Jun 5, 2017 · 13 comments
Closed

Local/offline playback + download support #1189

jimmywarting opened this issue Jun 5, 2017 · 13 comments

Comments

@jimmywarting
Copy link

Hi I was wondering if there was the possibility of local playback / download support like ShakaPlayer?

The functionality is quite complex. It first parses the manifests and stores the data into an indexDB then rebuilds the manifest and data from this database for local playback.

@johnBartos
Copy link
Collaborator

@jimmywarting Downloading the manifest to an in-browser DB is quite complicated. However, it wouldn't be too much work (I think) to implement the file:// protocol, which enables local playback. Let's open this up and see if anyone wants to implement it.

@eutychus
Copy link

I'm not sure this should be implemented in the hls library as it's not something everyone would use, but probably in players sitting on top of it. We did something similar to this for site-to-multisite broadcasts. Our player is pretty much Chrome only and about 2000 lines of JS. We use the file system api, along with localstorage. Manifest entries are kept in a Map and occasionally flushed to disk as JSON. For hls.js integration, we configure with a custom fragment loader and playlist loader.

@mangui
Copy link
Member

mangui commented Jun 21, 2017

agree this should be made through custom loader.

@jimmywarting
Copy link
Author

Hm, then I got some question.

  • how would you build a custom fragment loader?
  • how do you build a custom playlist loader?
  • how can you download the hole movie in full speed in advance without buffering/watching the video?
  • how do you choose only one quality to download?
  • are there curtains constraints if you use DRM that makes you not able to play it offline?
  • what to do if it's a Live stream?

@eutychus
Copy link

#1, #2 https://github.com/video-dev/hls.js/blob/master/doc/API.md#loader
#3 We use a chain of promises to download in sequence once a start point has been selected
#4 That would be within your logic on how you handle the playlists...
#5 I'm not sure
#6 We do all this on live streams that have long playlist lengths on the server. Since both the fragment and segment loaders are custom, you can play back segments that no longer exist on the server or even restart the player without internet connectivity.... but as johnBartos mentioned, implementing something like this gets pretty complicated.

@jimmywarting
Copy link
Author

@eutychus would you care to share your code, is it open source?

@eutychus
Copy link

Sorry, the code belongs to the company I work for and is heavily tied to the backend it connects to, so it probably wouldn't be easily adapted anyway... I was just trying to give you enough pointers to get an idea of what can be done and where to start if you wanted to build something like this out... (without having to touch the hls.js code). There is a lot of power in the ability to use custom loaders.

@radiantmediaplayer radiantmediaplayer changed the title Local playback / download support Local/offline playback + download support Jul 29, 2017
@radiantmediaplayer
Copy link
Collaborator

radiantmediaplayer commented Jul 29, 2017

For reference Shaka player design notes on the subject can be found here.

@ameer
Copy link

ameer commented Jan 19, 2018

+1 here! I want to save live videos and watch them when offline but all videos downloaded without sound. Please consider adding such a great option to this library.

@nicopace
Copy link

any progress on this?

@jimmywarting
Copy link
Author

jimmywarting commented Jun 24, 2018

I'm attempting to do a custom loader (using something like abstract-chunk-store) but i still think it needs more core functionality... like getting a list of all fragments that you should download. and download/adding fragments without involving xhr or watching the movie.

Building a custom loader isn't good enough IMO. Needs something better built in...

Think a store option should be added... following something along what webtorrent are doing with abstrackt chunk store. Abr and levelcontroller should be aware of what exist and what not and load levels that exist.

Then we need some utilities function for downloading a level (quality) without having to watch the hole movie for example player.levelController.download(index) or hlsPlayer.levelController.levels[0].details.fragments[0].download()

And then some function for cleaning up stuff

@stale
Copy link

stale bot commented Aug 25, 2018

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.

@stale stale bot added the Stale label Aug 25, 2018
@stale stale bot closed this as completed Sep 1, 2018
@DiegoZurita
Copy link

@eutychus could you give a more general explanation of how your team implemented that functionality? I tried use shaka player as well, but ir force the use of DRM in order to encrypt the HLS. (if it support to HLS with AES i didn't find any resource about it). Any help will be grateful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants