PlayerControllable
public protocol PlayerControllable : AnyObject
The player interface for controlling player
-
Undocumented
Declaration
Swift
var avURLAsset: AVURLAsset? { get } -
The underlying AVPlayer reference. Users are advised to use this object only for analytics purposes and not for anything else say manipulating playback. Doing so might result in undesired behaviors of player.
Declaration
Swift
var rawPlayer: Any? { get } -
The playback view. This is the view that all playback will be rendered to. Note that there may be additional subview or layers that are periodically added to the playback view or removed from the playback view. This playback view is available once the player enters
Loadedstate.Declaration
Swift
var playbackView: UIView? { get } -
A value that defines how the video is displayed within PlaybackView layer’s bounds rectangle. Check
AVLayerVideoGravityfor possible values.Declaration
Swift
var videoAspect: AVLayerVideoGravity { get set } -
The current player state. This property is Observable.
Declaration
Swift
var playbackState: Observable<PlayerState> { get } -
Indicates whether the first video frame of the player’s current item is ready for display.This property is Observable. The value remains false if the current item has no enabled video tracks.
Declaration
Swift
var isReadyForDisplay: Observable<Bool> { get } -
The buffering state of player. This property is Observable.
Declaration
Swift
var isBuffering: Observable<Bool> { get } -
The seeking state of player. This property is Observable.
Declaration
Swift
var isSeeking: Observable<Bool> { get } -
The duration of the content. This property is not Observable. Use
addPeriodicTimeObserver(:_:_:)to observe time.Declaration
Swift
var duration: TimeInterval { get } -
The currently playable duration of the content
Declaration
Swift
var bufferedRange: Range<TimeInterval>? { get } -
The currently seekable duration for Live contents
Declaration
Swift
var seekableRange: Range<TimeInterval>? { get } -
The current time of the play head in seconds
Declaration
Swift
var currentTime: TimeInterval { get } -
The current time of the play head in epoch seconds
Declaration
Swift
var currentEpochTime: TimeInterval { get } -
The current context of the player. Check
PlayerContextfor possible values.Declaration
Swift
var playerContext: PlayerContext { get } -
Indicates the desired rate of playback; 0.0 means “paused”, 1.0 indicates a desire to play at the natural rate of the current item.
Declaration
Swift
var rate: Float { get set } -
The current Stream information metadata
Declaration
Swift
var streamInformation: StreamInformation? { get } -
API to set play actions with this playback rate in the player.
Declaration
Swift
@available(iOS 16.0, tvOS 16.0, *) var defaultRate: Float { get set } -
Indicates the desired volume of the player; 0.0 means “muted”. The range is from 0.0 to 1.0
Declaration
Swift
var volume: Float { get set } -
A Boolean value that determines whether the audio output of the player is muted.
Setting this property to
truesilences audio playback regardless of thevolumelevel. When set tofalse, audio will play at the level specified by thevolumeproperty.This property does not affect the system volume or override hardware mute settings.
Declaration
Swift
var isMuted: Bool { get set } -
An array of text style rules to apply to WebVTT subtitles and other legible text.
Declaration
Swift
var textStyleRules: [AVTextStyleRule]? { get set } -
getAllVariantTracks(completion:Default implementation) API to get all HLS varients
Default Implementation
Declaration
Swift
@available(iOS 15.0, tvOS 15.0, *) func getAllVariantTracks(completion: @escaping ([AVAssetVariant]?) -> Void) -
API to observe playback time. The passed in block would be called with current time of player.
Declaration
Swift
func addPeriodicTimeObserver(forInterval interval: CMTime, queue: DispatchQueue?, using block: @escaping (CMTime) -> Void) -> Any? -
API to remove observed added using
addPeriodicTimeObserverDeclaration
Swift
func removeTimeObserver(_ observer: Any) -
replaceAsset(_:Default implementationautoPlay: thumbnailConfiguration: ) API to replace current asset of Player. The asset would be loaded and played.
Default Implementation
API to replace current asset of Player. The asset would be loaded and played.
Declaration
Swift
func replaceAsset(_ asset: AVURLAsset, autoPlay: Bool, thumbnailConfiguration: ContentThumbnailPreviewConfiguration?) -
Loads the player with the asset and prepares it for playback. Observer to
playbackStateto know the status.Declaration
Swift
func load() -
Plays the content if the player is already loaded. If not, load is performed prior to playback.
Declaration
Swift
func play() -
Pauses playback
Declaration
Swift
func pause() -
API to seek play head
Declaration
Swift
func seek(to time: Double, beforeTolerance: Double, afterTolerance: Double) -
API to seek play head
Declaration
Swift
func seek(to date: Date) -
Stops the playback
Declaration
Swift
func stop() -
Aborts playback and propagates error to delegate. Users are not advised to invoke this unless they know what they are doing. In all other cases,
stopmust be used to stop playback.Declaration
Swift
func abort(with error: FLError) -
API to get key-frame thumbnail image for given play head progress. Client can use this image to show key-frame images while seeking.
Declaration
Swift
func getThumbnail(for progress: TimeInterval, completionHandler: @escaping (UIImage) -> Void) -
API to adding interstitial time range in
PlayerThis method exposed outside but no need to call. Once player have
PlayerPreference.addInterstitialMarkerspreference forPlayer, this will be automatically getting called.Note
This API is designed for use with AVPlayerViewController.Note
Range will be overridden if you call multiple times this function -
getThumbnailUrl(for:Default implementation) API To fetch key frame data for specified position in
PlayerThis function retrieves the thumbnail URL corresponding to the specified position in the player timeline.
Default Implementation
Declaration
Swift
func getThumbnailUrl(for position: Double) -> String?Parameters
positionThe current seek position in seconds with up to three decimal places representing milliseconds.
Return Value
A string representing the URL of the thumbnail image, or
nilif key frame data is not available for the specified seek position. -
isLiveExtension methodAPI to check content playing is LIVE or not. It is suggested to use this API only after player load.
Declaration
Swift
var isLive: Bool { get } -
currentOffsetFromLiveEdgeExtension methodThe offset between current play head and live edge
Declaration
Swift
var currentOffsetFromLiveEdge: TimeInterval? { get } -
seekableRangeInEpochExtension methodThe seekable range of a Live content in Epoch time. In order to get this value accurately, the manifest should contain the accurate time representation in EXT-X-PROGRAM-DATE-TIME tag. Returns nil if the content is not live, or if seekable range or epoch time information is not available.
Declaration
Swift
var seekableRangeInEpoch: Range<TimeInterval>? { get } -
seek(to:Extension method) API to seek play head
Declaration
Swift
func seek(to time: Double) -
seekToLiveEdge()Extension methodAPI to seek play head to LIVE edge for a live content. No-op if content is not live.
Declaration
Swift
func seekToLiveEdge() -
togglePlayPause()Extension methodAPI to toggle Play and Pause
Declaration
Swift
func togglePlayPause()