Skip to main content

Implementing Picture in Picture Mode

Overview

iOS supports Picture-in-Picture (PiP) mode starting from iOS 9 for iPads and iOS 14 for iPhones. Picture-in-Picture (PiP) allows users to continue watching video content in a small, resizable window while navigating through other apps or interacting with the home screen. This provides a seamless multitasking experience, where the PiP window floats over the active app, allowing users to switch between apps without interrupting the video.

How users can interact with the PiP window

On iOS, users can interact with the Picture-in-Picture (PiP) window in the following ways:

  • Drag the PiP window: Users can drag the PiP window to any corner of the screen by tapping and holding the window.

  • Resize the PiP window: Starting from iOS 15, users can resize the PiP window by pinching in or out with two fingers, making the window larger or smaller as needed.

  • Hide the PiP window temporarily: Users can swipe the PiP window off the screen to hide it temporarily. A small arrow remains visible, and they can swipe it back in to restore the PiP window.

  • Controls on PiP window: Users can tap the PiP window to reveal playback controls, which include play/pause, fast forward, rewind, and a button to return the video to full-screen mode.

  • Close the PiP window: Tapping the close (X) button will stop the video and close the PiP window.

Picture in picture implementation

Enable Picture-in-Picture (PiP) mode in an iOS app using Xcode, as mentioned below:

Enable PiP capability: Open your project in Xcode and go to the "Signing & Capabilities" tab of your target. Click on the "+" button to add a new capability, then search for and add "Background Modes". In the list of background modes, check the option labeled "Audio, AirPlay, and Picture in Picture".

PiP preview