Player
public protocol Player : EventSendable, PlayerControllable, PlayerMediaTrackSelectable, PlayerNowPlayable, PlayerPictureInPicturePlayable, PlayerPreferable, PlayerQueuable
The primary player interface
-
Undocumented
Declaration
Swift
var delegate: PlayerDelegate? { get set } -
API to add a block to be executed before player load.
If the block is async and fails to return before player load which is also a async operation, it is possible that this block might be executed after player load. It is entirely the responsibility of a block to be sync so that it is executed before player load.
Declaration
Swift
func addPreloadBlock(block: @escaping (Player) -> Void)Parameters
blockA closure accepting
Playeras input -
API to add a block to be executed on player state change.
Declaration
Swift
func addStateChangeBlock(block: @escaping (Player) -> Void)Parameters
blockA closure accepting
Playeras input -
API to add a block to be executed on heart beat or playback progress every second.
Declaration
Swift
func addHeartBeatBlock(block: @escaping (Player) -> Void)Parameters
blockA closure accepting
Playeras input -
API to add multiple delegates to listen playback events
Declaration
Swift
func addDelegate(_ delegate: PlayerDelegate) -
API to remove delegates that were added using addDelegate function
Declaration
Swift
func removeDelegate(_ delegate: PlayerDelegate) -
API to invoke when the application received AVPlayerViewControllerDelegate callbacks for playback.
-
updatePlayPostionInControlCenter(duration:Extension methodrate: currentTime: isLive: ) Updating player current positions to the
MPRemoteCommandCenterDeclaration
Swift
func updatePlayPostionInControlCenter(duration: Double, rate: Float, currentTime: Double, isLive: Bool)Parameters
durationTotal duration of the player content
ratePlayer rate position play/pause (1 or 0)
currentTimePlayer current time position