-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Implement full offline support for DASH/HLS/SS/Misc #2643
Comments
Hi @kidmiracleman, yes we're working on DASH downloading currently. It should be published in a few weeks. HLS and SmoothStreaming support will follow. |
@erdemguven Thank you for the update. Looking forward to the release... |
Let's use this as an overall tracking issue for offline support. |
So, are you going to release any offline donwload manager kind of thing |
Can you give me a hint as to what interface you are providing to show the progress of the download? |
@ram992 yes there will be a download manager. @KiminRyu There will be a listener interface and broadcast events depending on the download method you use. int totalSegments, int downloadedSegments, long downloadedBytes are provided but this might change. |
Wow, but I had to implement all these things on my own, Can you say anything on when to expect the download Manager. Casue I want to use that. |
@ram992 Sorry I can't as it's hard to estimate at the moment. |
I've recently configured this on iOS, you may of already seen it, but it could be a good resource for you to reference - https://developer.apple.com/library/content/documentation/AudioVideo/Conceptual/MediaPlaybackGuide/Contents/Resources/en.lproj/HTTPLiveStreaming/HTTPLiveStreaming.html |
sure no problem, Can you make a comment once it is available in dev branch |
@erdemguven Is this commit to meet the dependency? I want to know how roughly it is completed! |
No. We will update this issue when significant progress is made. You may see some commits that look odd from time to time, where the commit message and actual content of the commit don't align well. This includes the one you reference. This is a side effect of the way we use internal tools for development work + mirror to GitHub. |
Any updates on this @ojw28 ? Just deciding if we need to code this ourselves or if we should wait |
I'll keep tracking this issue. Once implemented, I'll create a demo and full "doc" so everyone can use it with full offline mode and cache using DASH or similar. |
@hishamMuneer I think you can do this yourself if you need it for DASH content, as in the latest exoplayer there is a class OfflineLicenseHelper to handle license issues |
@ram992 I dont have licence issues, for now I am trying to download the video for offline viewing, even if it is not protected by licence. A single mp4 file can be downloaded easily but what about a segmented dashed file. https://stackoverflow.com/questions/45418817/saving-a-video-offline-while-playing-in-exoplayer |
@hishamMuneer One question : why do you want to use a segmented DASH for offline use, |
@ram992 But that will double my server size as I have to store both full mp4 and segmented files of the same video. Right now i have segmented files (along with mpd) stored on server which i am able to play without any problem. |
I know, I faced that problem, but I don't know any other way. That is how the DASH formatt works. |
@mkiisoft @ojw28 Please guide how should I proceed? "Right now i have segmented files (along with mpd) stored on server which i am able to play without any problem. But how segmented videos running through mpd files can be saved offline for later use. Videos are unencrypted for now and no DRM is being used." |
@hishamMuneer We're planning to release some of the downloaders in August. We'll update this thread when it's done. You'll be able to download your DASH streams. |
@ojw28 I have Downloaded the Dash stream to the local file using the I have tried using ExtractorMediaSource like below:
and also DashMediaSource:
Neither of the implementation is playing and also don't know whether above implementation is correct or not. Thanks in advance. |
Hey @mraj0045 have you tried using instructions from @q-litzler above |
@bnussey, @erdemguven I tried using the instructions you pointed out for the Sample URL: But in my application, it is not working. It is throwing,
The difference with the Sample URLand my URL is, My Code:
Need help in implementing it. Thanks in advance. |
@ojw28 Do you mean 'DownloadManager' is from android framework? or own implementation on this library? |
@mraj0045 could you please share how did you manage to use the CacheDataSource to play the video Offline? I am constructing DashMediaSource after I have downloaded it this way: new DashMediaSource(Uri.parse(DASH_TEST_URL), getDataSourceFactory(false),
new DefaultDashChunkSource.Factory(getDataSourceFactory(false)), mainHandler,
eventLogger);
private DataSource.Factory getDataSourceFactory(boolean useBandwidthMeter) {
return new CacheDataSourceFactory(
cache, buildDataSourceFactory(useBandwidthMeter), 0);
}
private DataSource.Factory buildDataSourceFactory(boolean useBandwidthMeter) {
return buildDataSourceFactory(useBandwidthMeter ? BANDWIDTH_METER : null);
}
private DataSource.Factory buildDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
return new DefaultDataSourceFactory(this, bandwidthMeter,
buildHttpDataSourceFactory(bandwidthMeter));
}
private HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
return new DefaultHttpDataSourceFactory(userAgent, bandwidthMeter);
} where cache is the one I used to download previously. |
How to download DASH DRM video on custom button click instead of caching it while playing? 1.How DRM enabled video are downloaded using exoplayer methods? |
Hi all, |
@rabindrachhachan You may find Erdem's blog post on pre-caching/downloading progressive streams useful. |
Issue: #2643 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=184844484
Hi all,
Thanks in advance! |
@FD- CacheUtils can be used to download any single content, ProgressiveDownloader uses it to download progressive streams. To download adaptive streams, you need to use Downloaders which handles multiple segments in the stream automatically. You can also use DownloadService for background downloads. DownloadService uses DownloadManager which handles multiple downloads and continue download when the app restarts. It's also possible to configure the downloads to be run only when there is wifi or the device is charging. As you can see Downloaders are for more complex cases. |
@erdemguven Thanks for the clarification! I managed to implement caching for HLS and DASH. For selecting a subset of available qualities I use HlsPlaylistParser and DashManifestParser to parse the manifests, then select qualities. For later only playing the cached qualities, I use custom parsers that filter the manifest using the copy() function. Works great! One thing I'd love to see supported is downloading parts of live streams. I've created a new feature request for that (#3877). |
Please see my Downloading Streams blog post on Medium. |
I tried to integrate new offline feature with locally imported ExoPlayer. Do you have any plan to improve download speed? The average download speed is measured as 1MB(or lower) per second. Dash Downloader's implementation is designed to receive chunks sequentially so that downloads are slow even if the internet speed is fast. Although simultaneous downloads are possible (currently set to 4 in consideration of background service restrictions), this does not seem to improve user experience. It took 40 minutes to download a 50 minute 720p video. The total downloaded bytes are 700MB. It is clear that it takes 40 minutes to receive 700MB to be improved. I used Giga WiFi and Galaxy s9 Plus as download environment. |
@erdemguven thanks for the post on Medium. -Any updates about Live stream download? -And could you define "Progressive Stream"? are you referring to a live Streaming with segments that do not exist yet? (I could only find clear definitions for "Streaming" and "Progressive Download") |
@erdemguven is out on holiday at the moment. To answer your questions:
No, sorry
This is not correct. ProgressDownloader is just for any regular media file (i.e. not DASH, SmoothStreaming or HLS). For example an mp3 file. |
ok, thanks @ojw28 @KiminRyu Maybe that can help you: I had the same download issue, it was extremly slow, and actually it was not related to the DashDownloader or the connection speed! I just replaced my external storage by a faster one and I just downloaded 1GB in 4min |
@kvillnv |
@ojw28 @erdemguven is there any way to limit the bandwidth in the download service? @KiminRyu yes I have done remove actions, it is not instantaneous but it's not that long. |
It seems that when the cache becomes voluminous it becomes slower to start playback: Here is how I instantiate the cache and MediaSource for reading:
Here is my method to get the cacheFile:
On the CacheDataSourceFactory I also tried to use CacheDataSource.FLAG_BLOCK_ON_CACHE and to set the maxBytes, I didn't notice a difference Everything is working full offline (DRM and Media) Any suggestions? |
@kvillnv How about follow this way to initiate CacheDataSourceFactory? It is from the latest release(2.8.0)'s demo application. It works fine even I downloaded more than 20 dash streams. uhmm...and I think you will get SimpleCache Error(it should be singleton over application scope. It is updated just a couple of days ago) if you get SimpleCache like that. I recommend to provide your simple cache in application scope by dagger or something. val appComponent = (application as ECApplication).component()
val downloadCache = if (useExternal) appComponent.externalCache() else appComponent.internalCache()
val component: MediaDownloadComponent = DaggerMediaDownloadComponent.builder()
.mediaDownloadModule(MediaDownloadModule(this, downloadCache, useExternal))
.build()
component.inject(this) Here is my example for injecting application scope SimpleCache to MediaDownloadService(which I implement DownloadService!) |
@KiminRyu thank you, problem solved by reviewing my SimpleCache |
@kvillnv, please look at PriorityTaskManager. If you create a PriorityTaskManager and use it with your DefaultLoadControl and DownloadManager (you should pass it DownloaderConstructorHelper and use it while contructing DownloadManager), it will make downloads pause while player is buffering. Closing this issue as now we support downloading adaptive streams. Please open separate issue for future problems. |
@erdemguven is there any support to download and offline play protected DRM content? I've been trying the Exoplayer2 recent demo. Added my urls to the assets, but on download I got
|
To be able to play offline DRM protected content you need to download licenses too. You can use OfflineLicenseHelper to download the licenses. There can be multiple licenses. To keep the demo app simple we didn't deliberately disabled downloading DRM content. |
Hi,
Is download and/or progressive download of adaptive streaming presentations a feature that is planned for ExoPlayer?
Note I am referring to 'up front' acquisition of the content rather than local HTTP caching.
Thanks.
The text was updated successfully, but these errors were encountered: