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 discontinuous.

    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 }
  • Triggered when playback state has changed.

    Declaration

    Swift

    var onState: ((_ previous: PlaybackState, _ state: PlaybackState) -> Void)? { get set }
  • Set callback for playback stats.

    Declaration

    Swift

    var onStats: ((Stats) -> Void)? { get set }
  • Returns playback stats. If stats are not available the returned value is nil

    Declaration

    Swift

    func getStats() -> Stats?
  • Returns the current channel index of the playlist.

    Declaration

    Swift

    func getCurrentChannelIndex() -> Int
  • Prevent channel skipping in a live stream.

  • Initialises an instance of the PlayerViewControllerAPI protocol.

    Declaration

    Swift

    init?(
        channels: [ChannelItem],
        analytics: [AnalyticsBackend?: AnalyticsMetadata]?,
        loopChannels: Bool)

    Parameters

    channels

    A list of channels.

    analytics

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

    loopChannels

    Loop the channel list at the first or last channel. Only applicable if the number of channels is greater than 1.

  • Replace the current channel item.

    Declaration

    Swift

    func replaceCurrentChannel(with channel: ChannelItem) -> Bool

    Parameters

    channel

    The new channel item.

    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: Double)
  • Return the current playback position.

    Declaration

    Swift

    func getCurrentTime() -> CMTime
  • Returns stream current position.

    Declaration

    Swift

    var position: Double? { get }
  • 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() -> Double?
  • 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?