DorisPlayer
public class DorisPlayer : DorisPlayerInputProtocol
AVPlayer wrapper with extras
-
audiosession route(airplay, headphones, builtInSpeaker, etc..)
Declaration
Swift
public var currentAudioSessionRoute: DorisAudioSessionRoute { get }
-
If true will automatically transition to PIP mode when app is backgrounded and Phone settings have Start PiP Automatically set to true, default value is true
Note
This setting only works with custom UI, using with AVPlayerViewController has no effectDeclaration
Swift
public var allowsPictureInPicturePlayback: Bool { get set }
-
mute player
Declaration
Swift
public var isMuted: Bool { get set }
-
resume rate to apple when play() is called
Declaration
Swift
public var resumeRate: Float
-
playback rate
Declaration
Swift
public var rate: Float { get set }
-
playback rate
Declaration
Swift
public var volume: Float { get set }
-
Replaces the current player item with the new one generated based on source data
Declaration
Swift
public func load(source: DorisSource, initialSeek: DorisSeekType? = nil, delay: Double? = nil, autoStart: Bool = true)
Parameters
source
source with .url, .item .csai .ssai type
startAt
seek position
-
Replaces the current player item with nil
Declaration
Swift
public func unload(forcePlaybackFailure: Bool = false)
-
Begins playback of the current item
Declaration
Swift
public func play()
-
Pauses playback of the current item
Declaration
Swift
public func pause()
-
Stops playback of the current item then seeks to 0
Declaration
Swift
public func stop()
-
Sets the media current time to the specified position
Declaration
Swift
public func seek(_ type: DorisSeekType, callback: ((_ isCompleted: Bool) -> Void)? = nil)
Parameters
type
type of seek could be: date, position, offset
-
Select subtitles by its display name, returns
true
if current mediaSelection has changed after calling this methodNote
this method expects value returned byDorisPlayerOutputProtocol.onPlayerEvent(...)
where event isDorisPlayerEvent.availableMediaSelectionLoaded(...)
Declaration
Swift
@discardableResult public func selectSubtitles(code: String?) -> Bool
Parameters
code
ISO 639-2 language code of subtitle to select
-
Select audio track by its display name, returns
true
if current mediaSelection has changed after calling this methodNote
this method expects value returned byDorisPlayerOutputProtocol.onPlayerEvent(...)
where event isDorisPlayerEvent.availableMediaSelectionLoaded(...)
Declaration
Swift
@discardableResult public func selectAudioTrack(code: String?) -> Bool
Parameters
code
ISO 639-2 language code of audio to select
-
Select subtitles by its display name, returns
true
if current mediaSelection has changed after calling this methodNote
this method expects value returned byDorisPlayerOutputProtocol.onPlayerEvent(...)
where event isDorisPlayerEvent.availableMediaSelectionLoaded(...)
Declaration
Swift
@discardableResult public func selectSubtitles(title: String?) -> Bool
Parameters
title
title specified in manifest file under NAME tag, or localized display name of language code
-
Select audio track by its display name, returns
true
if current mediaSelection has changed after calling this methodNote
this method expects value returned byDorisPlayerOutputProtocol.onPlayerEvent(...)
where event isDorisPlayerEvent.availableMediaSelectionLoaded(...)
Declaration
Swift
@discardableResult public func selectAudioTrack(title: String?) -> Bool
Parameters
title
title specified in manifest file under NAME tag, or localized display name of language code
-
Replaces the current item metadata and updates now playing info (lock screen controls)
Declaration
Swift
public func updateMetadata(_ metadata: DorisPlayerMediaMetadata)
Parameters
metadata
metadata to load
-
Configure MPRemoteCommandCenter
Declaration
Swift
public func updateRemoteCommands(with config: DorisRemoteCommandsConfig)
Parameters
config
Configuration for MPRemoteCommandCenter commands, enable/disable ones that you need
-
If load(source:) was called with delay parameter, it can be canceled with this method
Declaration
Swift
public func cancelDelayedLoad(type: CancelationType)
Parameters
type
if CancelationType.cancel is passed previosly called load(source:) will be canceled if if CancelationType.loadInstantly is passed load(source:) will be called immidiatelly without delay
-
Pauses Client side ads playback
Declaration
Swift
public func pauseClientSideAds()
-
Resumes Client side ads playback
Declaration
Swift
public func resumeClientSideAds()
-
Limit Seekable Range for Live streams
Note
Should be set beforeDorisPlayerEvent.streamTypeRecognized(...)
is called as it affects its outcomeNote
Set back tonil
before loading new stream if you do not need Limited Seekable Range applied for that streamDeclaration
Swift
public func setLimitedSeekableRange(range: (start: Date?, end: Date?)?)
Parameters
range
if
nil
is specified, original range will be used, ifrange.end
is specified LIVE stream will be considered as VOD -
Select desired playback quality
Note
if connected to Cellular: Auto will switch between low and high based on system preferencesSettings
->Mobile Data
->Mobile Data Options
->Low Data Mode
Note
if connected to WIFI: Auto will be same as HighDeclaration
Swift
public func setPlaybackQuality(_ quality: DorisPlaybackQuality)
Parameters
quality
auto / low / high
-
Replace initial ad tag parameters
Note
this method does nothing if you have not includeedAVDorisPlugin.ima(...)
plugin initially and if current source is not loaded withDorisPlayer.load(...)
Declaration
Swift
public func replaceAdTagParameters(adTagParameters: [String : Any], validFrom: Date?, validUntil: Date?)
Parameters
adTagParameters
Parameters to replace.
validFrom
Start date parameters are valid from.
validUntil
End date parameters are valid until. */
-
Setup player monitoring with MUXSDK
Note
this method does nothing if you have not includeedAVDorisPlugin.mux(...)
plugin initiallyDeclaration
Swift
public func startMuxMonitoring(playerData: DorisMuxCustomerPlayerData, videoData: DorisMuxCustomerVideoData, viewData: DorisMuxCustomerViewData? = nil, customData: DorisMuxCustomData? = nil, shouldUpdate: Bool = true)
Parameters
playerData
Player metadata
videoData
Video metadata */