Picture-in-Picture mode

Picture-in-Picture (PiP) is an essential part of video calls on mobile. It provides users the possibility to perform other actions on their phones, while still being on a call. The StreamVideo iOS SDK has PiP support out of the box, on devices running iOS 15 and above.

If you use our view components, as soon as you enter background, the native iOS PiP view will appear. It will show the first participant (based on the participant sorting criteria), that is not the current user. If a user is screen sharing, the screen sharing track would be shown instead.

Toggling Picture-in-Picture support

You have control over when the Picture-in-Picture is enabled by accessing the isPictureInPictureEnabled property on the CallViewModel. By default, the value is set to true.

Picture-in-Picture on custom Views

In case where you implement your own CallView but still want StreamVideo SDK to manage Picture in Picture, you can use the enablePictureInPicture ViewModifier on your CallView. Internally that will hool StreamVideo’s PictureInPicture logic on your View. Below you can see an example usage of the ViewModifier from our DemoApp:

public struct CallView<Factory: ViewFactory>: View {

    ...

    @ObservedObject var viewModel: CallViewModel

    ...

    public var body: some View {
        ...
        .enablePictureInPicture(viewModel.isPictureInPictureEnabled)
    }

    ...
}

Current user camera

By default, iOS does not allow access to the user’s camera, while in background. There are two possibilities to display the user’s camera in video calls and PiP in this state:

  • Your app has the multitasking camera access entitlement. This entitlement can be requested directly from Apple.
  • iPads with Stage Manager support, starting from iOS 16 can access the camera in the background, without the entitlement above. Our SDK already does the required steps to setup the capture session with background support. More details about this topic can be found here.

Note that the second option has limited devices support. If you are building an app for mass usage, you would need Apple’s entitlement. However, the approval of such entitlement can take a longer time.

© Getstream.io, Inc. All Rights Reserved.