PlayerViewControllerAPI Protocol

public protocol PlayerViewControllerAPI : UIViewController

Control and manage the player view controller.

  • The delegate for handling player view controller events.

    Declaration

    Swift

    var playerDelegate: PlayerViewControllerProtocol? { get set }
  • Playback state

    Declaration

    Swift

    var playbackState: PlaybackState? { get }
  • Return true for live streams, false otherwise.

    Declaration

    Swift

    var isLive: Bool? { get }
  • A collection of time ranges that the player can seek to. The ranges provided might be discontinous.

    Declaration

    Swift

    var seekableTimeRanges: [CMTimeRange]? { get }
  • Determines whether the Picture in Picture feature is enabled.

    Declaration

    Swift

    var allowsPictureInPicturePlayback: Bool { get set }
  • Determines whether the player automatically closes when playback ends.

    Declaration

    Swift

    var closeWhenPlaybackEnd: Bool { get set }
  • Determines whether the content can be skipped by the user.

    Declaration

    Swift

    var requiresLinearPlayback: Bool { get set }
  • Prevent channel skipping in a live stream.

  • Initializes an instance of the PlayerViewControllerAPI protocol.

    Declaration

    Swift

    init?(
        config playerConfig: PlayerConfiguration,
        metadata: ChannelMetadata?,
        nextChannelInfo: NextChannelInfo?,
        analytics: [AnalyticsBackend?: AnalyticsMetadata]?)

    Parameters

    config

    Configuration for the player item.

    metadata

    Additional metadata for the item - title, subtitle, artwork image, and description.

    nextChannelInfo

    Details about the next/prev interstitial view that will be used when changing channels in live stream.

    analytics

    A dictionary containg analytic backend type and metadata for the backend.

  • Replace the current player item.

    Declaration

    Swift

    func replaceCurrentItem(
        config playerConfig: PlayerConfiguration,
        metadata: ChannelMetadata?,
        nextChannelInfo: NextChannelInfo?,
        analytics: [AnalyticsBackend?: AnalyticsMetadata]?) -> Bool

    Parameters

    config

    Configuration for the player item.

    metadata

    Additional metadata for the item - title, subtitle, artwork image, and description.

    nextChannelInfo

    Details about the next/prev interstitial view that will be used when changing channels in live stream.

    analytics

    A dictionary containg analytic backend type and metadata for the backend.

    Return Value

    A boolean indicating the success of the replacement.

  • Start playback

    Declaration

    Swift

    func play()
  • Pause playback

    Declaration

    Swift

    func pause()
  • Close the player controller

    Declaration

    Swift

    func close()
  • Add custom action controls to the transport bar.

  • Add custom actions to the info tab.

  • Show custom contextual actions.

  • Update the state, title, and image of an action.

  • Update the title, subtitle, description, and artwork image of the player item.

    Declaration

    Swift

    func setChannelMetadata(_ metadata: ChannelMetadata)

    Parameters

    metadata

    Additional metadata for the item - title, subtitle, artwork image, and description.

  • Move the playback position.

    Declaration

    Swift

    func seek(_ time: CMTime)
  • Change the playback rate.

    Declaration

    Swift

    func setRate(_ rate: Float64)
  • Return the current playback position.

    Declaration

    Swift

    func getCurrentTime() -> CMTime
  • Returns the live start time in seconds since the epoch or nil if unknown or not applicable.

    Remark

    Available when player is in state PlaybackState.ready.

    Declaration

    Swift

    func getLiveStartTime() -> TimeInterval?
  • Return the currently selected audio track or null if no track is active and selected.

    Declaration

    Swift

    func getAudioTrack() -> AudioTrack?
  • Return the currently selected text track or null if no track is active and selected.

    Declaration

    Swift

    func getTextTrack() -> TextTrack?