Downloading Media through Exoplayer Part 2

Photo by Markus Winkler on Unsplash

In this final part, we will send the download request, retrieve the downloaded media and also play the media offline.

To grasp this concepts you need to read the Part one of this post Downloading Media through Exoplayer Part 1

We will not only be caching the media for offline playback, but we will also be storing some of the media’s metadata with it. To do that, we use DownloadHelper class and the request is sent using the DownloadService sendAddDownload static method.

The DownloadService also has a static method for pausing and resuming downloads.

Below is a method for retrieving all the downloaded items.

Having retrieved the cached media item, we can now play them.

Android(Kotlin, Java), iOS (Swift)| Works @GiGLogistics | Mentor @andela_alc |