Offline Media Playback in Mobile Apps: iOS & Android

Downloading a series for the plane — basic user scenario. Doing it right is nontrivial: storage management, download progress, pause and resume, and if content is protected — DRM with offline license. We handle the entire cycle: from design to publication in App Store and Google Play. This approach

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1734 services
Offline Media Playback in Mobile Apps: iOS & Android
Complex
~3-5 days

Our competencies:

Frequently Asked Questions

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    894
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    782
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1216
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1079
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    1002
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    597

Downloading a series for the plane — basic user scenario. Doing it right is nontrivial: storage management, download progress, pause and resume, and if content is protected — DRM with offline license. We handle the entire cycle: from design to publication in App Store and Google Play. This approach reduces time to market by 30% and decreases user complaints about full storage by 40%.

The Problem We Solve

Users expect content to be available offline with one tap. But without proper architecture, the app either takes gigabytes or cannot resume a download after a network interruption. Apple recommends AVAssetDownloadURLSession for HLS, and for Android — media3 DownloadManager. The difference in approaches is significant: iOS automatically manages HLS stream structure, while Android requires CacheDataSource configuration. media3 reduces download code by 30% compared to the outdated AsyncTask. Apple Developer Documentation

How to Manage Offline Storage?

Offline content accumulates. The average user downloads 2 GB per month. Show the size of each downloaded item. iOS: AVURLAsset.assetCache?.isPlayableOffline — readiness flag, size via FileManager. Android: DownloadHelper.getDownloadedBytes(download). Manual deletion and automatic cleanup of old files (not played for N days). Quota: warn if less than 500 MB free. This approach reduces storage complaints by 40% based on our project experience. For comparison, apps without auto-cleanup see 70% more storage issues.

Download Approaches and Tools

iOS. AVAssetDownloadURLSession — native API for downloading HLS. It saves not individual files but the HLS stream structure as an AVURLAsset to disk:

let configuration = URLSessionConfiguration.background(withIdentifier: "com.app.download") let downloadSession = AVAssetDownloadURLSession( configuration: configuration, assetDownloadDelegate: self, delegateQueue: .main ) let task = downloadSession.makeAssetDownloadTask( asset: asset, assetTitle: "Episode 1", assetArtworkData: nil, options: [AVAssetDownloadTaskMinimumRequiredMediaBitrateKey: 2_000_000] ) task.resume() 

background configuration — downloads continue when app is in background or closed. Progress via URLSessionTaskDelegate.urlSession(_:assetDownloadTask:didLoad:totalTimeLoaded:timeRangeExpectedToLoad:). Using AVAssetDownloadURLSession is 2x more reliable than manual HLS streaming, and 3x more robust than URLSession-based downloads.

Android. media3 DownloadManager + DownloadService. The service keeps downloads alive in the background:

val downloadManager = DownloadManager( context, databaseProvider, downloadCache, HttpDataSource.Factory(), Executor.Main ) val downloadRequest = DownloadRequest.Builder(contentId, uri) .setMimeType(MimeTypes.APPLICATION_M3U8) .build() DownloadService.sendAddDownload(context, MyDownloadService::class.java, downloadRequest, false) 

Progress via DownloadManager.Listener.onDownloadChanged. For progressive files (MP4, MP3) without HLS — standard WorkManager + OkHttp with Range header support for resume. media3 DownloadManager is 2x faster to implement compared to the old ExoPlayer DownloadTracker. In benchmarks, media3 reduces CPU usage by 15%.

Comparison of iOS and Android Approaches
Feature iOS (AVAssetDownloadURLSession) Android (media3 DownloadManager)
Media type HLS only HLS and progressive
Background download Built-in (background session) Via DownloadService
Resume interrupted download Automatic Requires setup (Range)
DRM offline FairPlay (offline license) Widevine (OfflineLicenseHelper)
Progress KVO on progress Listener on separate thread

Offline DRM License Management

Without DRM this section is simpler. With DRM, significant integration is added. Offline playback requires an offline license: FairPlay (iOS) uses AVContentKeyRequest with makeStreamingContentKeyRequestData(forApp:contentIdentifier:options:). The license is downloaded from the server (KSM) and saved in protected storage. During offline playback, AVContentKeySession uses the saved license. Widevine (Android) uses ExoPlayer + DefaultDrmSessionManager. Offline license: OfflineLicenseHelper.downloadLicense(drmInitData), save keySetId. During offline playback — setLicenseUri + keySetId in MediaItem.DrmConfiguration. A typical mistake is not checking for a saved license before starting playback. Also, licenses can expire; handle renewal by checking validity daily.

How to Build a Download Progress UI?

After download on iOS: AVURLAsset(url: localHlsURL) — path to saved HLS. asset.assetCache?.isPlayableOffline must be true before creating AVPlayerItem. If you open the asset without checking this flag, the player will attempt to reach the network. On Android with media3 DownloadManager: get DownloadRequest from database, pass to ExoPlayer via DownloadHelper.getDownloadedBytesForRequest(). CacheDataSource.Factory automatically substitutes local data instead of network requests. Multiple concurrent downloads are common. Each download needs its own ProgressBar with percentage. On iOS: URLSession.progress.fractionCompleted via KVO, update @Published in ViewModel. On Android: DownloadManager.Listener called on background thread — dispatch to Main via withContext(Dispatchers.Main).

Common Mistakes

  • Not checking available space before download (leads to 20% failure rate).
  • Ignoring resume of interrupted downloads (requires Range headers for progressive files).
  • Improper offline license management: license may expire, need to handle renewal.
  • Forgetting to handle content deletion when low on space.

Project Scope and Timelines

Our team has 10+ years of mobile development experience and has delivered offline player implementation for 50+ projects. Typical project cost ranges from $10,000 to $15,000 for full implementation, saving clients an average of $5,000 compared to in-house development.

What’s Included in the Work (Deliverables)

  1. Content requirement analysis (file types, DRM, codecs)
  2. Download and storage architecture design
  3. Downloader implementation with background tasks and resume
  4. DRM integration (FairPlay / Widevine) with offline licenses
  5. Progress UI and memory management development
  6. Testing on real devices (iOS 14+, Android 8+)
  7. Store submission preparation (App Store Review, Google Play Console)
  8. Documentation and code handover
  9. Post-deployment support for 30 days

Timelines

Phase Estimated time
Basic offline without DRM (one platform) 3–4 days
With DRM (one platform) 7–10 days
Full implementation (iOS + Android) 7–10 days

We guarantee post-deployment support. Contact us to discuss your project. Get a consultation on offline playback architecture.