32
Best Practices in Media Playback Hassan ABID @hassanabidpk +HassanAbid hassanabid.com

Best Practices in Media Playback

Embed Size (px)

Citation preview

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

MediaSessionor 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

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

Thank You!