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 discontinous.
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 }
Set callback for playback stats.
Swift
var onStats: ((Stats) -> Void)? { get set }
Get playback stats. If stats are not available the returned value is nil
Swift
func getStats() -> Stats?
Prevent channel skipping in a live stream.
Initializes an instance of the PlayerViewControllerAPI protocol.
Swift
init?(
config playerConfig: PlayerConfiguration,
metadata: ChannelMetadata?,
nextChannelInfo: NextChannelInfo?,
analytics: [AnalyticsBackend?: AnalyticsMetadata]?)
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.
Swift
func replaceCurrentItem(
config playerConfig: PlayerConfiguration,
metadata: ChannelMetadata?,
nextChannelInfo: NextChannelInfo?,
analytics: [AnalyticsBackend?: AnalyticsMetadata]?) -> Bool
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. |
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: Float64)
Return the current playback position.
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 statePlaybackState.ready
.
Swift
func getLiveStartTime() -> TimeInterval?
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?