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() or load() 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 to false, playback would be aborted on insecure devices. Use this API with caution. Default value is true.

    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 triggering play() after the playback reached the end time, will start the playback from the begining. When set to false, the playback wont be started once it reached the end time. Default value is false

    Declaration

    Swift

    case allowRepeatPlayback(allow: Bool)
  • API to customize default MPRemoteCommand actions in MPRemoteCommandCenter.

    • Default MPRemoteCommand actions for VOD content:

      • MPRemoteCommand.togglePausePlay
      • MPRemoteCommand.play
      • MPRemoteCommand.pause
      • MPRemoteCommand.skipBackward
      • MPRemoteCommand.skipForward
      • MPRemoteCommand.changePlaybackPosition
      • MPRemoteCommand.changePlaybackRate
      • MPRemoteCommand.enableLanguageOption
      • MPRemoteCommand.disableLanguageOption
    • Default MPRemoteCommand actions for Live content:

      • MPRemoteCommand.togglePausePlay
      • MPRemoteCommand.play
      • MPRemoteCommand.pause
      • MPRemoteCommand.enableLanguageOption
      • MPRemoteCommand.disableLanguageOption

    When this preference is enabled (true):

    Automatically updates MPRemoteCommandCenter actions:

    • For Live content:

      • MPRemoteCommand.play
      • MPRemoteCommand.stop
    • For VOD content:

      • Default MPRemoteCommand actions.
    • For multiple VOD content in a queue player:

      • MPRemoteCommand.togglePausePlay
      • MPRemoteCommand.play
      • MPRemoteCommand.pause
      • MPRemoteCommand.previousTrack
      • MPRemoteCommand.nextTrack
      • MPRemoteCommand.changePlaybackPosition
      • MPRemoteCommand.changePlaybackRate
      • MPRemoteCommand.enableLanguageOption
      • MPRemoteCommand.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.0

    Declaration

    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

    center

    Defines the preferred remote action using the RemoteMainAction enum.

  • API to handle interrupted resume playback by automatically or not

    Note

    Default value is true

    Declaration

    Swift

    case shouldAutoResumeAfterInterruption(_: Bool)
  • API to enable or disable Picture in Picture (PiP) support

    Note

    Default value is true

    Declaration

    Swift

    case shouldSupportPIP(_: Bool)
  • API to enable AdditionalSubtitleFormat for the playback

    Declaration

    Swift

    case enableAdditionalSubtitle(_: [AdditionalSubtitleFormat])

    Parameters

    formats

    Additional 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 player

    Declaration

    Swift

    case shouldHandleAudioInterruption(_: Bool)
  • Use MPNowPlayingInfoCenter on tvOS instead of the default MPNowPlayingSession.

    Note

    This is only applicable to tvOS. On iOS, MPNowPlayingInfoCenter is 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

    trackType

    The type of media track (MediaTrackType).

    mediaTrack

    The 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)