best practices in media playback

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

Upload: hassan-abid

Post on 15-Apr-2017

324 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Best Practices in Media Playback

Best Practices in Media Playback

Hassan ABID@hassanabidpk +HassanAbid hassanabid.com

Page 2: Best Practices in Media Playback

Agenda

•Media playback APIs

•ExoPlayer

Page 3: Best Practices in Media Playback

Goal

When to use the

right APIs

to build the best audio or video playback app

possible

Page 4: Best Practices in Media Playback

Important Events in Media Playback

Page 5: Best Practices in Media Playback

Media Playback and Android Life Cycle

Page 6: Best Practices in Media Playback

Media playback the right way

Page 7: Best Practices in Media Playback

Playing Media

Page 8: Best Practices in Media Playback

Right Way

Action Becoming Noisy

MediaSession

Audio Focus

Notifications

Local

Always

Page 9: Best Practices in Media Playback

Audio Focus

Ensure apps don’t talk over one another

Hold audio focus until we’ve stopped playback

Page 10: Best Practices in Media Playback

Audio Focus (Code)

Permission 승인

onStop

Page 11: Best Practices in Media Playback

Audio Focus (AudioFocusChangeListener)

Page 12: Best Practices in Media Playback

ACTION_AUDIO_BECOMING_NOISY

PAUSE

Page 13: Best Practices in Media Playback

Life cycle of media playback

Page 14: Best Practices in Media Playback

MediaSessionor MediaSessionCompat (Video)

Page 15: Best Practices in Media Playback

MediaSessionCompat

Page 16: Best Practices in Media Playback

Role of Callback class

onPlay(),onPause(), etc,

Serves as a single point in your app for all media control callbacks

Page 17: Best Practices in Media Playback

MediaSessionCompat

Page 18: Best Practices in Media Playback

PlaybackStateCompat

Page 19: Best Practices in Media Playback

MediaMetadataCompat

Page 20: Best Practices in Media Playback

Media Notifications (NotificationCompat.MediaStyle)

Page 21: Best Practices in Media Playback

MediaControllerCompat & MediaBrowserCompat

Page 22: Best Practices in Media Playback

Minimum Viable Product

Page 23: Best Practices in Media Playback

UAMP Apphttps://github.com/googlesamples/android-UniversalMusicPlayer

Page 24: Best Practices in Media Playback

ExoPlayerhttps://github.com/google/ExoPlayer

Page 25: Best Practices in Media Playback

TERMS

DASH : Dynamic Adaptive Streaming over HTTP

HLS : Http Live Streaming

DRM : Digital Rights Management

MPD : Media Presentation

ABR : Adaptive Bitrate Streaming

Page 26: Best Practices in Media Playback

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.

Page 27: Best Practices in Media Playback

Pros

Supports DASH,HLS, Smooth-Streaming …

DRM protected content

Customizable

Easily Updatable

Few device specific issues

Page 28: Best Practices in Media Playback

Adaptive Media Playback (DASH,HLS etc.)

Page 29: Best Practices in Media Playback

DASH object Model

Page 30: Best Practices in Media Playback

Sample Code

Page 32: Best Practices in Media Playback

Thank You!