Skip to content

Pause/Resume download with HlsDownloader or DashDownloader #3907

@pmunizferreira

Description

@pmunizferreira

Hi, I'm using exoplayer2.source.hls.offline.HlsDownloader and exoplayer2.source.dash.offline.DashDownloader to download videos that will be played offline later. I do not need an instance of Exoplayer at this time, just Downloader classes.
Are there ways to pause and resume the download?

A simple code to start download (working fine):

 val tempFolder = Util.createTempDirectory(context, "tempFolder");
 val cache = SimpleCache(tempFolder, NoOpCacheEvictor())
 val dataSourceFactory = CacheDataSourceFactory(context, 100 * 1024 * 1024, 5 * 1024 * 1024)

 val hlsDownloader = HlsDownloader(Uri.parse(videoUrl), DownloaderConstructorHelper(cache, dataSourceFactory))

 hlsDownloader.download(object: Downloader.ProgressListener {
    override fun onDownloadProgress(downloader: Downloader?, downloadPercentage: Float, downloadedBytes: Long) {
       ...
    }
  })

I've also tried the exoplayer2.upstream.CacheUtil class, but it also has no way to pause/resume downloads.
Maybe another class should be used to download videos? vov
thanks.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions