ExoPlayer Integration for Video Playback in Android App

This article covers ExoPlayer Android integration for HLS streaming Android, DASH streaming Android, Widevine DRM Android, adaptive streaming Android, PiP ExoPlayer, RecyclerView ExoPlayer, custom player controls, and more. The `MediaPlayer` from the Android standard library handles local files a

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
ExoPlayer Integration for Video Playback in Android App
Medium
~2-3 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

This article covers ExoPlayer Android integration for HLS streaming Android, DASH streaming Android, Widevine DRM Android, adaptive streaming Android, PiP ExoPlayer, RecyclerView ExoPlayer, custom player controls, and more.

The MediaPlayer from the Android standard library handles local files and simple HTTP links. But as soon as an HLS stream, DASH manifest, DRM protection via Widevine, or seeking without full buffering appears — MediaPlayer ends, and ExoPlayer begins. We've encountered this dozens of times: clients complain about constant pauses when switching quality, black screens in RecyclerView, or playback failure on devices with Android 7. ExoPlayer solves these problems, but its setup requires deep expertise.

ExoPlayer (with Media3 — androidx.media3:media3-exoplayer) is a Google library for media playback on Android. It is used in YouTube, Google TV, and most streaming applications. We have integrated it into 15+ projects — from simple players for news feeds to complex systems with adaptive streaming, DRM, and Picture-in-Picture. ExoPlayer is 2-3 times better than MediaPlayer in switching speed during adaptive streaming, which is critical for users with unstable internet. ExoPlayer buffering can be tuned via LoadControl, solving common pauses.

ExoPlayer's solution to adaptive streaming problems

Adaptive streaming (HLS/DASH) is one of the main reasons to switch to ExoPlayer. Instead of a single file, the player receives a manifest with multiple quality variants. ExoPlayer automatically selects the appropriate bitrate via AdaptiveTrackSelection, but without proper buffering parameters the user sees a 'loading' screen every 10 seconds.

Configuration of DefaultLoadControl with specific numbers:

Parameter Recommended value Effect
minBufferMs 15000 (15 sec) Minimum buffer before playback start
maxBufferMs 50000 (50 sec) Maximum buffer for internet economy
bufferForPlaybackMs 2500 (2.5 sec) Buffer for start after pause
bufferForPlaybackAfterRebufferMs 5000 (5 sec) Buffer after rebuffering

Wrong values cause ExoPlayer to waste traffic on buffering high quality when signal is weak. We always test settings on 3G/4G network emulation. Time saved on debugging is up to 50% thanks to ready-made profiles.

Importance of correct DRM handling

Widevine DRM (L1/L3) is the standard for content protection on Android. L1 requires hardware TEE support and is not available on all devices. L3 is software-based, works everywhere, but quality may be limited to 540p. Integration code looks like:

val drmSessionManager = DefaultDrmSessionManager.Builder() .setUuidAndExoMediaDrmProvider(C.WIDEVINE_UUID, FrameworkMediaDrm.DEFAULT_PROVIDER) .setMultiSession(false) .build(drmCallback) 

Key issues: certificates on some Chinese devices (Xiaomi, Huawei) are handled specially, and the license server may reject a request without the correct keyRequestType. We account for this and write a fallback to L3 if L1 is unavailable. On Xiaomi and Huawei, hardware TEE for L1 is often missing. In such cases we automatically switch to L3 with user notification. Also requires correct handling of DrmInitData and MediaDrm version check.

Avoiding lifecycle and RecyclerView issues

ExoPlayer is not directly tied to Activity lifecycle, otherwise it gets recreated on screen rotation. The solution is to store the player in ViewModel or MediaSessionService. When going to background, use PiP:

  • requireActivity().enterPictureInPictureMode(PictureInPictureParams.Builder().build())
  • In onPictureInPictureModeChanged, toggle PlayerView.setPlayer().

RecyclerView with video: each item should not have its own player. Use one player for the entire list, attaching it to the visible PlayerView via findFirstCompletelyVisibleItemPosition. This saves memory and eliminates leaks.

Situation Without optimization With optimization
Scrolling list of 10 videos 10 players, 50+ MB memory 1 player, 15 MB memory
Entering PiP Screen goes dark Playback continues
Audio focus loss Sound overlaps Other apps pause

Steps for ExoPlayer Integration

  1. Add the Media3 ExoPlayer dependency to your build.gradle.
  2. Create an ExoPlayer instance using ExoPlayer.Builder.
  3. Configure the media source (HLS, DASH, or progressive).
  4. Set up DRM session manager if needed.
  5. Attach the player to a PlayerView.
  6. Handle lifecycle using ViewModel or MediaSessionService.
  7. Test on multiple devices.

Deliverables in the ExoPlayer integration service

When ordering ExoPlayer integration, you receive:

  • Player code with custom controls and support for HLS/DASH, subtitles, DRM.
  • Widevine setup — license server, L1/L3 fallback.
  • Testing on 5+ real devices (Samsung, Pixel, Xiaomi, Huawei) with different Android versions.
  • Configuration documentation — lifecycle diagram, parameter reference, build instructions.
  • Release support — help with Google Play moderation (especially for DRM content).
  • Team training — 2 online sessions on customization and debugging.

We have 5+ years of experience in mobile development and have completed over 50 media projects. Our engineers attend Google I/O and track Media3 updates.

Timelines and pricing

Estimated timelines:

Task Duration
Basic player + HLS 2-3 days
+ DRM Widevine +1 day
+ PiP +0.5 day
+ RecyclerView +1 day
+ Custom controls +1 day

Total time ranges from 3 to 7 business days depending on complexity. Pricing is calculated individually after analyzing your project. Basic integration starts at $1,500, full package from $3,500. Proper configuration can reduce buffering by 40%, saving user data and reducing support tickets. Contact us for a free consultation — we'll evaluate the task and propose an architectural solution. Order ExoPlayer integration from us and eliminate video problems.

When choosing a contractor, pay attention to experience with DefaultLoadControl and DrmSessionManager. According to our data, 70% of ExoPlayer projects require tuning of default parameters; without this, video may lag on devices with 2 GB RAM. We guarantee proper operation even on such models.

Technical details: ExoPlayer vs MediaPlayer ExoPlayer supports DASH and HLS natively, while MediaPlayer requires custom parsing. ExoPlayer's `TrackSelector` allows dynamic bitrate switching, MediaPlayer cannot switch mid-stream. ExoPlayer is updated via Jetpack, MediaPlayer only via system updates. For modern Android video player integration, ExoPlayer is the standard.

Source: Media3 official documentation