PlayerPreference
public enum PlayerPreference : Preference
Player preferences
-
Initial playback time from where the player should begin playback after loading media. If no preference is set by deafult VOD start playback from 0.0 and LIVE starts playback from live edge. Passing in 0.0 for live contents, starts playback from beginning of stream and not from live edge. Negative values has no effect. This value should be in seconds.
Declaration
Swift
case initialPlaybackTime(time: Double) -
Preferred max bit rate.
Declaration
Swift
case preferredPeakBitRate(bitrate: Double) -
Preferred initial forward buffer duration. To reset set the value to 0.0. it will use the system prefered buffer. Setting this preference before calling
play()orload()API will be effective. The value should be in seconds.Declaration
Swift
case preferredInitialForwardBufferDuration(duration: TimeInterval) -
Preferred forward buffer duration after a rebuffer. To reset set the value to 0.0. it will use the system prefered buffer. The value should be in seconds.
Declaration
Swift
case preferredForwardBufferDurationAfterRebuffer(duration: TimeInterval) -
Perform additional security checks on top of basic jailbreak detection and reverse engineering detections. Setting this preference without
allowPlaybackOnInsecureDevice(allow: false)will have no effect.Declaration
Swift
case enableSecurityChecks(additionalChecks: [SecurityChecks]) -
API to allow/disallow playback on Insecure Devices. When set to
true, no security checks would be performed. When set tofalse, playback would be aborted on insecure devices. Use this API with caution. Default value istrue.Declaration
Swift
case allowPlaybackOnInsecureDevice(allow: Bool) -
The desired maximum resolution of a video that is to be downloaded. Defaults to CGSizeZero, which indicates there is no limit on the video resolution. Any other value indicates a preferred maximum video resolution. This property only applies to HTTP Live Streaming assets
Declaration
Swift
case preferredMaximumResolution(size: CGSize) -
canUseNetworkResourcesForLiveStreamingWhilePaused property has been added to AVPlayerItem.
Declaration
Swift
case canUseNetworkResourcesForLiveStreamingWhilePaused(paused: Bool) -
An upper limit on the resolution of video to download when connecting over expensive networks. Available versions are above iOS 15.0+ and tvOS 15.0+
Declaration
Swift
case preferredMaximumResolutionForExpensiveNetworks(size: CGSize) -
API that indicates whether playback starts with the first eligible variant that appears in the stream’s main playlist. Available versions are above iOS 14.0+ and tvOS 14.0+
Declaration
Swift
case startsOnFirstEligibleVariant(eligibleVariant: Bool) -
API which limit of network bandwidth consumption by the item when connecting over expensive networks. Re-set it to zero to get the usual “highest quality/bitrate supported by connection”. Available versions are above iOS 15.0+ and tvOS 15.0+
Declaration
Swift
case preferredPeakBitRateForExpensiveNetworks(preferredPeakBitRate: Double) -
API will enable ad-markers in the AVPlayerViewController
-
Preference to allow/disallow playback to repeat when played till the end. When set to
true, when triggeringplay()after the playback reached the end time, will start the playback from the begining. When set tofalse, the playback wont be started once it reached the end time. Default value isfalseDeclaration
Swift
case allowRepeatPlayback(allow: Bool) -
API to customize default
MPRemoteCommandactions inMPRemoteCommandCenter.Default
MPRemoteCommandactions forVODcontent:MPRemoteCommand.togglePausePlayMPRemoteCommand.playMPRemoteCommand.pauseMPRemoteCommand.skipBackwardMPRemoteCommand.skipForwardMPRemoteCommand.changePlaybackPositionMPRemoteCommand.changePlaybackRateMPRemoteCommand.enableLanguageOptionMPRemoteCommand.disableLanguageOption
Default
MPRemoteCommandactions forLivecontent:MPRemoteCommand.togglePausePlayMPRemoteCommand.playMPRemoteCommand.pauseMPRemoteCommand.enableLanguageOptionMPRemoteCommand.disableLanguageOption
When this preference is enabled (
true):Automatically updates
MPRemoteCommandCenteractions:For Live content:
MPRemoteCommand.playMPRemoteCommand.stop
For VOD content:
- Default
MPRemoteCommandactions.
- Default
For multiple VOD content in a queue player:
MPRemoteCommand.togglePausePlayMPRemoteCommand.playMPRemoteCommand.pauseMPRemoteCommand.previousTrackMPRemoteCommand.nextTrackMPRemoteCommand.changePlaybackPositionMPRemoteCommand.changePlaybackRateMPRemoteCommand.enableLanguageOptionMPRemoteCommand.disableLanguageOption
If the preference is disabled (
false), default actions are used.- Developer Note: To activate this preference in the AdPlayer, ensure the player supports multicast delegate implementation.
Usage:
PlayerPreference.assignRemoteActions(true)Declaration
Swift
case assignRemoteActions(_: Bool) -
API to override remote command action forward and backward interval duration.
Note
Default value is 15.0Declaration
Swift
case setRemoteActionTraversalInterval(_: PreferedIntervals) -
Configures the behavior of the main remote command action, which can either toggle play/pause or stop playback.
Important
This setting is applicable only for Live content. VOD (Video on Demand) playback always uses play/pause, and does not support stop.Note
The default value is.togglePlayPause.Declaration
Swift
case setRemoteMainAction(_: RemoteMainAction)Parameters
centerDefines the preferred remote action using the
RemoteMainActionenum. -
API to handle interrupted resume playback by automatically or not
Note
Default value istrueDeclaration
Swift
case shouldAutoResumeAfterInterruption(_: Bool) -
API to enable or disable Picture in Picture (PiP) support
Note
Default value istrueDeclaration
Swift
case shouldSupportPIP(_: Bool) -
API to enable
AdditionalSubtitleFormatfor the playbackDeclaration
Swift
case enableAdditionalSubtitle(_: [AdditionalSubtitleFormat])Parameters
formatsAdditional subtitle format
-
API to handle player audio interruption by the application
Note
SDK won’t do pause / play action when audio interruption appear for the playerDeclaration
Swift
case shouldHandleAudioInterruption(_: Bool) -
Use
MPNowPlayingInfoCenteron tvOS instead of the defaultMPNowPlayingSession.Note
This is only applicable to tvOS. On iOS,MPNowPlayingInfoCenteris always used. -
Setting this preferred track will auto select the track if it is available. The application can still override the selected track by using the selectTrack API.
Declaration
Swift
case preferredTrack(trackType: MediaTrackType, mediaTrack: MediaTrack)Parameters
trackTypeThe type of media track (MediaTrackType).
mediaTrackThe MediaTrack to be configured as the preferred track. To enable pre-selection, the track should include at least a locale or an ISO language code.
-
Controls the player’s audiovisual background playback policy.
Determines how the player handles audiovisual content when the app transitions to the background.
automatic: The system decides whether playback continues when the app goes to the background.continuesIfPossible: The app continues playback in the background, if possible.pauses: The app pauses playback when entering the background.
Use this preference to customize how playback behaves when your app transitions to the background. The default is
.automatic.Note
Available on iOS 15.0+ and tvOS 15.0+.Declaration
Swift
case audiovisualBackgroundPlaybackPolicy(_: PlayerAudiovisualBackgroundPlaybackPolicy)