public protocol PlayerViewControllerAPI : UIViewController
Control and manage the player view controller.
public protocol PlayerViewControllerAPI : UIViewController
Control and manage the player view controller.
The delegate for handling player view controller events.
Swift
var playerDelegate: PlayerViewControllerProtocol? { get set }
Playback state
Swift
var playbackState: PlaybackState? { get }
Return true
for live streams, false
otherwise.
Swift
var isLive: Bool? { get }
A collection of time ranges that the player can seek to. The ranges provided might be discontinuous.
Swift
var seekableTimeRanges: [CMTimeRange]? { get }
Determines whether the Picture in Picture feature is enabled.
Swift
var allowsPictureInPicturePlayback: Bool { get set }
Determines whether the player automatically closes when playback ends.
Swift
var closeWhenPlaybackEnd: Bool { get set }
Determines whether the content can be skipped by the user.
Swift
var requiresLinearPlayback: Bool { get set }
Triggered when playback state has changed.
Swift
var onState: ((_ previous: PlaybackState, _ state: PlaybackState) -> Void)? { get set }
Set callback for playback stats.
Swift
var onStats: ((Stats) -> Void)? { get set }
Returns playback stats. If stats are not available the returned value is nil
Swift
func getStats() -> Stats?
Returns the current channel index of the playlist.
Swift
func getCurrentChannelIndex() -> Int
Prevent channel skipping in a live stream.
Initialises an instance of the PlayerViewControllerAPI protocol.
Swift
init?(
channels: [ChannelItem],
analytics: [AnalyticsBackend?: AnalyticsMetadata]?,
loopChannels: Bool)
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.
Swift
func replaceCurrentChannel(with channel: ChannelItem) -> Bool
channel
|
The new channel item. |
A boolean indicating the success of the replacement.
Start playback
Swift
func play()
Pause playback
Swift
func pause()
Close the player controller
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.
Swift
func setChannelMetadata(_ metadata: ChannelMetadata)
metadata
|
Additional metadata for the item - title, subtitle, artwork image, and description. |
Move the playback position.
Swift
func seek(_ time: CMTime)
Change the playback rate.
Swift
func setRate(_ rate: Double)
Return the current playback position.
Swift
func getCurrentTime() -> CMTime
Returns stream current position.
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 statePlaybackState.ready
.
Swift
func getLiveStartTime() -> Double?
Return the currently selected audio track or null if no track is active and selected.
Swift
func getAudioTrack() -> AudioTrack?
Return the currently selected text track or null if no track is active and selected.
Swift
func getTextTrack() -> TextTrack?