Picture-in-Picture support in Bitmovin iOS player SDK

Hello Community,

Picture-in-Picture or PiP is a popular feature for video applications. This feature can be used in multiple use cases and scenarios. It allows the video playback continue in a smaller screen while allowing user to use another application or other pages/views in same application.

  • Video application is put to background. Real world scenario could be

    • Incoming call when watching a video content.
    • User putting application in background to check something on device’s home screen or another application(non-video).
  • Within same video application, user navigates to a different page.

    • User browsing other content in the app.
    • User checking game analysis, score cards etc. while watching a game.

Bitmovin player SDK on iOS supports PiP functionality out of the box. It is advised to use Bitmovin player iOS version 3.34.0 or later to get all available PiP functionality. This is supported for all following UI configurations.

  • Bitmovin default UI (HTML/CSS based) : StyleConfig.isUiEnabled=true AND StyleConfig.userInterfaceType=.bitmovin

  • iOS System UI : StyleConfig.isUiEnabled=true AND StyleConfig.userInterfaceType=.system

  • Bitmovin UI for Subtitles only : StyleConfig.isUiEnabled=true AND StyleConfig.userInterfaceType=.subtitle

  • No Bitmovin UI but application implementing PlayerView : StyleConfig.isUiEnabled=false

Bitmovin iOS SDK provides following configuration object, APIs and events to configure and use PiP functionality.

PiP Configuration

Sample code snippet demonstrating PiP config

let config = PlayerViewConfig()
        config.pictureInPictureConfig.isEnabled = true
        config.pictureInPictureConfig.restoreUserInterfaceHandler = {restored in
            // restore custom views
            restored(true)
        }

#if os(iOS)
        if #available(iOS 14.0, *) {
            config.pictureInPictureConfig.showSkipControls = false
        }

        if #available(iOS 14.2, *) {
            config.pictureInPictureConfig.shouldEnterOnBackground = true
        }
#endif
       
        let playerView = PlayerView(player: player, frame: .zero, playerViewConfig: config)

PiP APIs

Events

Please let us know if there are any questions/doubts about PiP functionality.