ExoPlayer (Media3)
Android media playback library (now part of AndroidX Media3) — handles audio and video playback with support for progressive download, HLS, DASH, and SmoothStreaming. ExoPlayer/Media3 features: ExoPlayer instance with MediaItem.fromUri() for playback, PlayerView for built-in UI controls, MediaSession integration for background audio, track selection (quality, subtitle, audio language), adaptive bitrate streaming (HLS/DASH auto quality), DRM (Widevine, ClearKey), and offline download. Replaced Android's MediaPlayer for complex media requirements. Media3 unifies ExoPlayer, MediaSession, and UI components under androidx.media3 namespace. Used for agent video tutorials, voice recording playback, and media-rich agent applications.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
ExoPlayer downloads and caches media locally — cached agent video content may contain sensitive training data; use encrypted offline storage with DownloadManager configured with CacheDataSource.Factory pointing to encrypted cache directory. DRM (Widevine) provides content protection for premium agent video content.
⚡ Reliability
Best When
Your Android agent app needs video streaming (HLS/DASH), adaptive bitrate playback, background audio, or DRM-protected content — Media3 ExoPlayer is the production-grade solution for complex Android media.
Avoid When
You only need simple audio file playback (use MediaPlayer), you're playing WebRTC streams, or you're building image-based content without audio/video.
Use Cases
- • Agent tutorial video playback — Media3 ExoPlayer with PlayerView plays HLS agent onboarding videos with adaptive quality; MediaItem.fromUri(hlsUrl) with HlsMediaSource handles m3u8 playlists for agent tutorial streaming
- • Background agent audio playback — MediaSessionService with ExoPlayer enables agent podcast/audio playback to continue when user backgrounds app; MediaSession integration provides lock screen controls for agent audio content
- • Agent voice message playback — ExoPlayer.Builder(context).build(); player.setMediaItem(MediaItem.fromUri(voiceMessageUrl)); player.prepare(); player.play() plays agent voice responses with minimal boilerplate
- • Adaptive bitrate agent video — HLS DASH source with DefaultTrackSelector adjusts agent video quality automatically based on network conditions; no manual quality switching code required
- • Offline agent content — DownloadManager with DownloadService downloads agent video lessons for offline playback; DownloadHelper prepares HLS/DASH streams for offline caching
Not For
- • Simple audio playback — if playing a single MP3 file, MediaPlayer is simpler than ExoPlayer; ExoPlayer complexity justified for streaming, multiple sources, or advanced features in agent apps
- • Image display or GIF animation — ExoPlayer is audio/video only; use Glide or Coil for agent image loading including GIF
- • WebRTC or live streaming — ExoPlayer handles recorded content and HLS/DASH streams; for real-time WebRTC agent communication, use libwebrtc or Agora SDK
Interface
Authentication
No auth — ExoPlayer loads media URLs. For authenticated media streams, use DefaultHttpDataSource.Factory with custom headers for agent CDN auth tokens. DRM uses Widevine license server credentials.
Pricing
ExoPlayer/Media3 is Apache 2.0 licensed, maintained by Google/Android team. Free for all use.
Agent Metadata
Known Gotchas
- ⚠ ExoPlayer must be created and accessed on main thread — all ExoPlayer methods are not thread-safe; creating player or calling play()/pause() from background thread causes IllegalStateException; use Looper.getMainLooper() for player creation in non-Activity contexts for agent background playback
- ⚠ release() must be called to free resources — ExoPlayer holds audio focus, surface, and codec resources; failing to call player.release() in onStop() or onDestroy() causes audio focus lock, surface leaks, and MediaCodec resource exhaustion on agent screens with video
- ⚠ Media3 namespace vs standalone ExoPlayer — legacy com.google.android.exoplayer2 and new androidx.media3.exoplayer are different artifacts; mixing imports from both causes ClassNotFoundException at runtime; migrate fully to Media3 for new agent projects; legacy ExoPlayer is deprecated
- ⚠ PlayerView must be attached before setPlayer — calling playerView.player = exoPlayer before playerView is laid out causes surface attachment failures and black screen; set player in onViewCreated or after layout inflation for agent video fragment; check playerView.isAttachedToWindow if uncertain
- ⚠ Background playback requires foreground service — Android 8+ kills background media playback without foreground service; agent audio apps need MediaSessionService implementation with notification to continue playback in background; PlaybackService extending MediaSessionService handles Android foreground service requirements
- ⚠ HLS token URLs expire during playback — for agent authenticated video streams with short-lived presigned URLs, tokens expire mid-playback causing ERROR_CODE_IO_NETWORK_CONNECTION_FAILED after initial buffering; use DefaultHttpDataSource.Factory with RequestHeaders provider that refreshes tokens; static URL approach fails for long agent video sessions
Alternatives
Full Evaluation Report
Comprehensive deep-dive: security analysis, reliability audit, agent experience review, cost modeling, competitive positioning, and improvement roadmap for ExoPlayer (Media3).
AI-powered analysis · PDF + markdown · Delivered within 30 minutes
Package Brief
Quick verdict, integration guide, cost projections, gotchas with workarounds, and alternatives comparison.
Delivered within 10 minutes
Score Monitoring
Get alerted when this package's AF, security, or reliability scores change significantly. Stay ahead of regressions.
Continuous monitoring
Scores are editorial opinions as of 2026-03-07.