HLS/DASH video streaming in mobile app

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
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 1 servicesAll 1735 services
HLS/DASH video streaming in mobile app
Medium
~2-3 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1054
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Implementing HLS/DASH Video Streaming in Mobile Applications

HLS and DASH — protocols for adaptive streaming. Player doesn't load one file but manifest with segments, dynamically switching qualities based on network speed. This isn't simple MP4 download — buffering, ABR algorithms and network error handling are involved.

HLS vs DASH: What to Choose

Parameter HLS DASH
Native iOS support Yes (AVFoundation) No (library needed)
Native Android support No (ExoPlayer) No (ExoPlayer)
Standard latency 6–30 s 2–10 s
Low-Latency HLS/DASH LL-HLS: ~2 s LL-DASH: ~1–3 s
DRM support FairPlay (iOS), Widevine Widevine, PlayReady

In practice: if audience is iOS-dominant and no DRM — HLS without third-party libraries. If cross-platform and minimal latency needed — DASH via ExoPlayer/Shaka.

iOS: AVPlayer + HLS

AVPlayer plays HLS natively. Create AVPlayerItem(url: m3u8Url):

let asset = AVURLAsset(url: hlsURL, options: [
    "AVURLAssetHTTPHeaderFieldsKey": ["Authorization": "Bearer \(token)"]
])
let item = AVPlayerItem(asset: asset)
player = AVPlayer(playerItem: item)

Monitor buffering — KVO on item.isPlaybackLikelyToKeepUp and item.loadedTimeRanges. When isPlaybackLikelyToKeepUp == false — show spinner, on true — hide.

Pre-load next video: create AVPlayerItem in advance, add to AVQueuePlayer — first segment of next video starts downloading in background.

Android: ExoPlayer + HLS/DASH

val player = ExoPlayer.Builder(context).build()

// HLS
val hlsItem = MediaItem.Builder()
    .setUri("https://example.com/stream.m3u8")
    .build()

// DASH
val dashItem = MediaItem.Builder()
    .setUri("https://example.com/manifest.mpd")
    .build()

player.setMediaItem(hlsItem)
player.prepare()
player.play()

ExoPlayer automatically chooses HlsMediaSource or DashMediaSource by URL extension. For explicit specification or custom headers:

val dataSourceFactory = DefaultHttpDataSource.Factory()
    .setDefaultRequestProperties(mapOf("Authorization" to "Bearer $token"))
val hlsSource = HlsMediaSource.Factory(dataSourceFactory)
    .createMediaSource(MediaItem.fromUri(uri))

Adaptive Bitrate

By default, ExoPlayer uses AdaptiveTrackSelection — switches quality at segment boundaries (usually 2–10 s intervals). Set minimum quality:

val trackSelector = DefaultTrackSelector(context)
trackSelector.parameters = trackSelector.buildUponParameters()
    .setMaxVideoSizeSd() // no higher than 480p on weak devices
    .build()

On iOS — AVPlayerItem.preferredPeakBitRate = 2_000_000 limits upper bitrate, useful for traffic saving.

Network Error Handling

Network is unstable — segment didn't load, manifest returned 403, CDN gave 5xx. ExoPlayer retries automatically with exponential backoff (DefaultLoadErrorHandlingPolicy). Custom policy:

class RetryPolicy : DefaultLoadErrorHandlingPolicy() {
    override fun getRetryDelayMsFor(loadErrorInfo: LoadErrorInfo) =
        if (loadErrorInfo.errorCount < 5) 1000L * loadErrorInfo.errorCount else RETRY_DELAY_UNSET
}

On iOS: AVPlayerItem.status == .failedplayer.currentItem?.error — read NSError, show "Retry" button.

Timeline

HLS player on one platform with ABR and error handling — 2 days. Cross-platform (iOS + Android) with DASH, DRM and manual quality selection — 4–5 days.