Best Practices in Media Playback
Hassan ABID
@hassanabidpk +HassanAbid hassanabid.com
Agenda
•Media playback APIs
•ExoPlayer
Goal
When to use the
right APIs
to build the best audio or video playback app
possible
Important Events in Media Playback
Media Playback and Android Life Cycle
Media playback the right way
Playing Media
Right Way
Action Becoming
Noisy
MediaSession
Audio
Focus
Notifications
Local
Always
Audio Focus
Ensure apps don’t talk over one another
Hold audio focus until we’ve stopped
playback
Audio Focus (Code)
Permission 승인
onStop
Audio Focus (AudioFocusChangeListener)
ACTION_AUDIO_BECOMING_NOISY
PAUSE
Life cycle of media playback
MediaSession
or MediaSessionCompat (Video)
MediaSessionCompat
Role of Callback class
onPlay(),onPause(), etc,
Serves as a single point in your app for all
media control callbacks
MediaSessionCompat
PlaybackStateCompat
MediaMetadataCompat
Media Notifications (NotificationCompat.MediaStyle)
MediaControllerCompat
&
MediaBrowserCompat
Minimum Viable Product
UAMP App
https://github.com/googlesamples/android-UniversalMusicPlayer
ExoPlayer
https://github.com/google/ExoPlayer
TERMS
DASH : Dynamic Adaptive Streaming over HTTP
HLS : Http Live Streaming
DRM : Digital Rights Management
MPD : Media Presentation
ABR : Adaptive Bitrate Streaming
What is ExoPlayer
The ExoPlayer provides many sophisticated features
such as Dynamic adaptive streaming over HTTP
(DASH), SmoothStreaming and Common Encryption.
It's designed
to be easy to customize and extend, and many
components can be replaced with custom
implementations. Because ExoPlayer is a library that
you include in your application, it can be easily
updated along with your app.
Pros
Supports DASH,HLS, Smooth-Streaming …
DRM protected content
Customizable
Easily Updatable
Few device specific issues
Adaptive Media Playback (DASH,HLS etc.)
DASH object Model
Sample Code
Talks to follow
Streaming Media with ExoPlayer (I/O 16)
High Performance Audio (I/O 16)
Best Practices in Media playback (I/O 16)
ExoPlayer Talk (Hassan)
Thank You!

Best Practices in Media Playback