UserInterfaceApi

@objc(BMPUserInterfaceApi)
public protocol UserInterfaceApi : NSObjectProtocol

API methods related to the user interface.

  • Returns true if the player is currently in fullscreen mode.

    Declaration

    Swift

    var isFullscreen: Bool { get }
  • Returns true if the players playback controls are currently shown, false if they are hidden.

    Declaration

    Swift

    var areControlsShown: Bool { get }
  • Returns if Picture-In-Picture is available.

    Picture-In-Picture is available in the following use-cases:

    • on iOS 14.2 and above. (We disabled PiP on iOS 14.0 and 14.1 due to an underlying iOS bug)
    • on tvOS 14 and above.
    • if explicitly enabled through PlaybackConfiguration#isPictureInPictureEnabled (default is disabled)

    Declaration

    Swift

    var isPictureInPictureAvailable: Bool { get }

    Return Value

    true if Picture-In-Picture is available.

  • Returns true if player is currently in Picture-in-Picture (PiP) mode.

    Declaration

    Swift

    var isPictureInPicture: Bool { get }
  • A value defining how the video is displayed within the parent container’s bounds. Possible values are defined in ScalingMode.

    When a value was set before the Player was added to the view, it will have precedence over the value configured in StyleConfig.scalingMode.

    Declaration

    Swift

    var scalingMode: ScalingMode { get set }
  • The player enters Picture-In-Picture mode. Has no effects if already in picture in picture.

    • Starting Picture-In-Picture during casting is not supported and will result in a no-op.
    • This has no effect when using system UI.

    Declaration

    Swift

    func enterPictureInPicture()
  • The player exits Picture-In-Picture mode. Has no effect if not in Picture-In-Picture mode.

    This has no effect when using system UI.

    Declaration

    Swift

    func exitPictureInPicture()
  • The player enters fullscreen mode. Has no effect if in fullscreen.

    Declaration

    Swift

    func enterFullscreen()
  • The player exits fullscreen mode. Has no effect if not in fullscreen.

    Declaration

    Swift

    func exitFullscreen()
  • Sets a poster image which will be displayed before playback starts.

    Declaration

    Swift

    @objc(setPosterImage:keepPersistent:)
    func setPosterImage(url: URL, keepPersistent: Bool)

    Parameters

    url

    The URL to the poster image.

    keepPersistent

    Flag to set the poster image persistent so it is also displayed during playback.

  • Set the subtitle styles which should be applied to WebVTT subtitles and other legible text. Setting subtitle styles using this method completely replaces all previously set subtitle styles.

    Setting subtitle styles is only supported when the userInterfaceType in the StyleConfig is set to .system or .subtitle.

    Declaration

    Swift

    func setSubtitleStyles(_ subtitleStyles: [AVTextStyleRule]?)

    Parameters

    subtitleStyles

    The subtitle styles which should be applied.