Implementing Picture In Picture Mode In Android
Implement Picture In Picture mode to allow users to watch videos even while they use other apps. See how a real-world app uses PiP, then learn how to add awesome media playback controls to PiP mode for ease of use! By Filip Babić.
Learning path
This is part of the Android UI & UX: Beyond the Basics learning path. View path.
Who is this for?
Intermediate and advanced Android developers looking to implement Picture In Picture (PiP) mode to provide cool ways for users to keep using their apps while working on other things with their phone.
You should be familiar with Android Studio and Kotlin. Knowledge about using advanced code structures to build different layers in your apps and communicate between them is welcomed.
This course covers a feature from the raywenderlich.com app! Check out the open-source repo here.
Covered concepts
- Android Screen Resizing
- Multi-tasking Android apps
- Picture-In-Picture mode in Android
- Picture-In-Picture Parameters
- Picture-In-Picture Lifecycle
- Configuration Changes
- BroadcastReceivers
- MediaPlayer
- MediaPlayer Actions
Part 1: Implement Picture In Picture Mode
Picture In Picture allows users to control an app while they're doing something else! Learn the basics about PIP mode and how it changes the way users can interact with your apps.
Check out the Emitron app, then set up the sample project with Firebase and build configuration.
Learn how to enable PiP mode for Activities through the Android Manifest, and how to enter the PiP mode & attach it to the Activity lifecycle.
Extend your PiP mode functionality to your Fragment, and learn how to expose it through a BroadcastReceiver.
Build the functions of one of the core classes that will let you handle the PiP mode and communicate its state.
Add actions to the PiP container to display different media controls and prepare their actions.
Learn how to process media control by observing the PipAction value from the BroadcastReceiver, allowing the user to use the PiP mode completely.