One Logo Pool Ball
AVFoundation · IOS API REFERENCE

AVPlayer

class · iOS 4.0+ · SDK 27.1

@MainActor class AVPlayer

Members (77)

get · iOS 13.4+

eligibleForHDRPlaybackDidChangeNotification

TypeScript
static get eligibleForHDRPlaybackDidChangeNotification(): Promise<_Foundation_NSNotification_Name>
Swift declaration
class let eligibleForHDRPlaybackDidChangeNotification: NSNotification.Name
get · iOS 15.0+

rateDidChangeNotification

TypeScript
static get rateDidChangeNotification(): Promise<_Foundation_NSNotification_Name>
Swift declaration
class let rateDidChangeNotification: NSNotification.Name
get · iOS 15.0+

rateDidChangeOriginatingParticipantKey

TypeScript
static get rateDidChangeOriginatingParticipantKey(): Promise<string>
Swift declaration
class let rateDidChangeOriginatingParticipantKey: String
get · iOS 15.0+

rateDidChangeReasonKey

TypeScript
static get rateDidChangeReasonKey(): Promise<string>
Swift declaration
class let rateDidChangeReasonKey: String
get · iOS 11.2+ · Deprecated in iOS 26.0

availableHDRModes

TypeScript
static get availableHDRModes(): Promise<AVPlayer_HDRMode>
Swift declaration
nonisolated class var availableHDRModes: AVPlayer.HDRMode { get }
get · iOS 13.4+

eligibleForHDRPlayback

TypeScript
static get eligibleForHDRPlayback(): Promise<boolean>
Swift declaration
nonisolated class var eligibleForHDRPlayback: Bool { get }
get · iOS 26.0+

isObservationEnabled

TypeScript
static get isObservationEnabled(): Promise<boolean>
Swift declaration
nonisolated class var isObservationEnabled: Bool { get set }
set · iOS 26.0+

isObservationEnabled

TypeScript
static setIsObservationEnabled(value: boolean): Promise<void>
Swift declaration
nonisolated class var isObservationEnabled: Bool { get set }
method

addBoundaryTimeObserver

TypeScript
addBoundaryTimeObserver(times: Array<_Foundation_NSValue>, queue: (_Dispatch_DispatchQueue) | null, block: (() => void)): Promise<unknown>
Swift declaration
nonisolated func addBoundaryTimeObserver(forTimes times: [NSValue], queue: dispatch_queue_t?, using block: @escaping @Sendable () -> Void) -> Any
method

addPeriodicTimeObserver

TypeScript
addPeriodicTimeObserver(interval: _CoreMedia_CMTime, queue: (_Dispatch_DispatchQueue) | null, block: ((arg0: _CoreMedia_CMTime) => void)): Promise<unknown>
Swift declaration
nonisolated func addPeriodicTimeObserver(forInterval interval: CMTime, queue: dispatch_queue_t?, using block: @escaping @Sendable (CMTime) -> Void) -> Any
method · iOS 6.0+

cancelPendingPrerolls

TypeScript
cancelPendingPrerolls(): Promise<void>
Swift declaration
nonisolated func cancelPendingPrerolls()
method

currentTime

TypeScript
currentTime(): Promise<_CoreMedia_CMTime>
Swift declaration
nonisolated func currentTime() -> CMTime
init · iOS 4.0+

init

TypeScript
static init(): Promise<AVPlayer>
Swift declaration
nonisolated init()
init · iOS 4.0+

init

TypeScript
static initPlayerItem(item?: (AVPlayerItem) | null): Promise<AVPlayer>
Swift declaration
nonisolated init(playerItem item: AVPlayerItem?)
init · iOS 4.0+

init

TypeScript
static initUrl(URL: string): Promise<AVPlayer>
Swift declaration
nonisolated init(url URL: URL)
method · iOS 7.0+

mediaSelectionCriteria

TypeScript
mediaSelectionCriteria(mediaCharacteristic: AVMediaCharacteristic): Promise<(AVPlayerMediaSelectionCriteria) | null>
Swift declaration
nonisolated func mediaSelectionCriteria(forMediaCharacteristic mediaCharacteristic: AVMediaCharacteristic) -> AVPlayerMediaSelectionCriteria?
method

pause

TypeScript
pause(): Promise<void>
Swift declaration
nonisolated func pause()
method

play

TypeScript
play(): Promise<void>
Swift declaration
nonisolated func play()
method · iOS 10.0+

playImmediately

TypeScript
playImmediately(rate: number): Promise<void>
Swift declaration
nonisolated func playImmediately(atRate rate: Float)
method · iOS 6.0+

preroll

TypeScript
preroll(rate: number, completionHandler?: (((arg0: boolean) => void)) | null): Promise<void>
Swift declaration
nonisolated func preroll(atRate rate: Float) async -> Bool
method

removeTimeObserver

TypeScript
removeTimeObserver(observer: unknown): Promise<void>
Swift declaration
nonisolated func removeTimeObserver(_ observer: Any)
method

replaceCurrentItem

TypeScript
replaceCurrentItem(item?: (AVPlayerItem) | null): Promise<void>
Swift declaration
nonisolated func replaceCurrentItem(with item: AVPlayerItem?)
method

seek

TypeScript
seekTo(date: globalThis.Date): Promise<void>
Swift declaration
nonisolated func seek(to date: Date)
method · iOS 5.0+

seek

TypeScript
seekToCompletionHandler(date: globalThis.Date, completionHandler: ((arg0: boolean) => void)): Promise<void>
Swift declaration
nonisolated func seek(to date: Date) async -> Bool
method

seek

TypeScript
seekTo47742(time: _CoreMedia_CMTime): Promise<void>
Swift declaration
nonisolated func seek(to time: CMTime)
method · iOS 5.0+

seek

TypeScript
seekToCompletionHandler28014(time: _CoreMedia_CMTime, completionHandler: ((arg0: boolean) => void)): Promise<void>
Swift declaration
nonisolated func seek(to time: CMTime) async -> Bool
method

seek

TypeScript
seekToToleranceBeforeToleranceAfter(time: _CoreMedia_CMTime, toleranceBefore: _CoreMedia_CMTime, toleranceAfter: _CoreMedia_CMTime): Promise<void>
Swift declaration
nonisolated func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime)
method · iOS 5.0+

seek

TypeScript
seekToToleranceBeforeToleranceAfterCompletionHandler(time: _CoreMedia_CMTime, toleranceBefore: _CoreMedia_CMTime, toleranceAfter: _CoreMedia_CMTime, completionHandler: ((arg0: boolean) => void)): Promise<void>
Swift declaration
nonisolated func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime) async -> Bool
method · iOS 7.0+

setMediaSelectionCriteria

TypeScript
setMediaSelectionCriteria(criteria: (AVPlayerMediaSelectionCriteria) | null, mediaCharacteristic: AVMediaCharacteristic): Promise<void>
Swift declaration
nonisolated func setMediaSelectionCriteria(_ criteria: AVPlayerMediaSelectionCriteria?, forMediaCharacteristic mediaCharacteristic: AVMediaCharacteristic)
method · iOS 6.0+

setRate

TypeScript
setRate(rate: number, itemTime: _CoreMedia_CMTime, hostClockTime: _CoreMedia_CMTime): Promise<void>
Swift declaration
nonisolated func setRate(_ rate: Float, time itemTime: CMTime, atHostTime hostClockTime: CMTime)
get

actionAtItemEnd

TypeScript
get actionAtItemEnd(): Promise<AVPlayer_ActionAtItemEnd>
Swift declaration
nonisolated var actionAtItemEnd: AVPlayer.ActionAtItemEnd { get set }
set

actionAtItemEnd

TypeScript
setActionAtItemEnd(value: AVPlayer_ActionAtItemEnd): Promise<void>
Swift declaration
nonisolated var actionAtItemEnd: AVPlayer.ActionAtItemEnd { get set }
get · iOS 26.4+

allowsCaptureOfClearKeyVideo

TypeScript
get allowsCaptureOfClearKeyVideo(): Promise<boolean>
Swift declaration
nonisolated var allowsCaptureOfClearKeyVideo: Bool { get set }
set · iOS 26.4+

allowsCaptureOfClearKeyVideo

TypeScript
setAllowsCaptureOfClearKeyVideo(value: boolean): Promise<void>
Swift declaration
nonisolated var allowsCaptureOfClearKeyVideo: Bool { get set }
get · iOS 6.0+

allowsExternalPlayback

TypeScript
get allowsExternalPlayback(): Promise<boolean>
Swift declaration
nonisolated var allowsExternalPlayback: Bool { get set }
set · iOS 6.0+

allowsExternalPlayback

TypeScript
setAllowsExternalPlayback(value: boolean): Promise<void>
Swift declaration
nonisolated var allowsExternalPlayback: Bool { get set }
get · iOS 7.0+

appliesMediaSelectionCriteriaAutomatically

TypeScript
get appliesMediaSelectionCriteriaAutomatically(): Promise<boolean>
Swift declaration
nonisolated var appliesMediaSelectionCriteriaAutomatically: Bool { get set }
set · iOS 7.0+

appliesMediaSelectionCriteriaAutomatically

TypeScript
setAppliesMediaSelectionCriteriaAutomatically(value: boolean): Promise<void>
Swift declaration
nonisolated var appliesMediaSelectionCriteriaAutomatically: Bool { get set }
get · iOS 26.0+

audioOutputSuppressedDueToNonMixableAudioRoute

TypeScript
get audioOutputSuppressedDueToNonMixableAudioRoute(): Promise<boolean>
Swift declaration
var audioOutputSuppressedDueToNonMixableAudioRoute: Bool { get }
get · iOS 15.0+

audiovisualBackgroundPlaybackPolicy

TypeScript
get audiovisualBackgroundPlaybackPolicy(): Promise<AVPlayerAudiovisualBackgroundPlaybackPolicy>
Swift declaration
nonisolated var audiovisualBackgroundPlaybackPolicy: AVPlayerAudiovisualBackgroundPlaybackPolicy { get set }
set · iOS 15.0+

audiovisualBackgroundPlaybackPolicy

TypeScript
setAudiovisualBackgroundPlaybackPolicy(value: AVPlayerAudiovisualBackgroundPlaybackPolicy): Promise<void>
Swift declaration
nonisolated var audiovisualBackgroundPlaybackPolicy: AVPlayerAudiovisualBackgroundPlaybackPolicy { get set }
get · iOS 10.0+

automaticallyWaitsToMinimizeStalling

TypeScript
get automaticallyWaitsToMinimizeStalling(): Promise<boolean>
Swift declaration
nonisolated var automaticallyWaitsToMinimizeStalling: Bool { get set }
set · iOS 10.0+

automaticallyWaitsToMinimizeStalling

TypeScript
setAutomaticallyWaitsToMinimizeStalling(value: boolean): Promise<void>
Swift declaration
nonisolated var automaticallyWaitsToMinimizeStalling: Bool { get set }
get · iOS 4.0+ · Deprecated in iOS 11.0

isClosedCaptionDisplayEnabled

TypeScript
get isClosedCaptionDisplayEnabled(): Promise<boolean>
Swift declaration
var isClosedCaptionDisplayEnabled: Bool { get set }
set · iOS 4.0+ · Deprecated in iOS 11.0

isClosedCaptionDisplayEnabled

TypeScript
setIsClosedCaptionDisplayEnabled(value: boolean): Promise<void>
Swift declaration
var isClosedCaptionDisplayEnabled: Bool { get set }
get

currentItem

TypeScript
get currentItem(): Promise<(AVPlayerItem) | null>
Swift declaration
nonisolated var currentItem: AVPlayerItem? { get }
get · iOS 16.0+

defaultRate

TypeScript
get defaultRate(): Promise<number>
Swift declaration
nonisolated var defaultRate: Float { get set }
set · iOS 16.0+

defaultRate

TypeScript
setDefaultRate(value: number): Promise<void>
Swift declaration
nonisolated var defaultRate: Float { get set }
get · iOS 27.0+

disconnectedFromSystemAudio

TypeScript
get disconnectedFromSystemAudio(): Promise<boolean>
Swift declaration
nonisolated var disconnectedFromSystemAudio: Bool { get }
get · iOS 4.0+

error

TypeScript
get error(): Promise<(NativeError) | null>
Swift declaration
nonisolated var error: (any Error)? { get }
get · iOS 6.0+

isExternalPlaybackActive

TypeScript
get isExternalPlaybackActive(): Promise<boolean>
Swift declaration
nonisolated var isExternalPlaybackActive: Bool { get }
get · iOS 6.0+

externalPlaybackVideoGravity

TypeScript
get externalPlaybackVideoGravity(): Promise<AVLayerVideoGravity>
Swift declaration
nonisolated var externalPlaybackVideoGravity: AVLayerVideoGravity { get set }
set · iOS 6.0+

externalPlaybackVideoGravity

TypeScript
setExternalPlaybackVideoGravity(value: AVLayerVideoGravity): Promise<void>
Swift declaration
nonisolated var externalPlaybackVideoGravity: AVLayerVideoGravity { get set }
get · iOS 6.0+ · Deprecated in iOS 18.0

masterClock

TypeScript
get masterClock(): Promise<(_CoreMedia_CMClock) | null>
Swift declaration
nonisolated var masterClock: CMClock? { get set }
set · iOS 6.0+ · Deprecated in iOS 18.0

masterClock

TypeScript
setMasterClock(value?: (_CoreMedia_CMClock) | null): Promise<void>
Swift declaration
nonisolated var masterClock: CMClock? { get set }
get · iOS 7.0+

isMuted

TypeScript
get isMuted(): Promise<boolean>
Swift declaration
nonisolated var isMuted: Bool { get set }
set · iOS 7.0+

isMuted

TypeScript
setIsMuted(value: boolean): Promise<void>
Swift declaration
nonisolated var isMuted: Bool { get set }
get · iOS 26.0+

networkResourcePriority

TypeScript
get networkResourcePriority(): Promise<AVPlayer_NetworkResourcePriority>
Swift declaration
var networkResourcePriority: AVPlayer.NetworkResourcePriority { get set }
set · iOS 26.0+

networkResourcePriority

TypeScript
setNetworkResourcePriority(value: AVPlayer_NetworkResourcePriority): Promise<void>
Swift declaration
var networkResourcePriority: AVPlayer.NetworkResourcePriority { get set }
get · iOS 6.0+

isOutputObscuredDueToInsufficientExternalProtection

TypeScript
get isOutputObscuredDueToInsufficientExternalProtection(): Promise<boolean>
Swift declaration
nonisolated var isOutputObscuredDueToInsufficientExternalProtection: Bool { get }
get · iOS 15.0+

playbackCoordinator

TypeScript
get playbackCoordinator(): Promise<AVPlayerPlaybackCoordinator>
Swift declaration
nonisolated var playbackCoordinator: AVPlayerPlaybackCoordinator { get }
get · iOS 12.0+

preventsDisplaySleepDuringVideoPlayback

TypeScript
get preventsDisplaySleepDuringVideoPlayback(): Promise<boolean>
Swift declaration
nonisolated var preventsDisplaySleepDuringVideoPlayback: Bool { get set }
set · iOS 12.0+

preventsDisplaySleepDuringVideoPlayback

TypeScript
setPreventsDisplaySleepDuringVideoPlayback(value: boolean): Promise<void>
Swift declaration
nonisolated var preventsDisplaySleepDuringVideoPlayback: Bool { get set }
get

rate

TypeScript
get rate(): Promise<number>
Swift declaration
nonisolated var rate: Float { get set }
set

rate

TypeScript
setRate26889(value: number): Promise<void>
Swift declaration
nonisolated var rate: Float { get set }
get · iOS 10.0+

reasonForWaitingToPlay

TypeScript
get reasonForWaitingToPlay(): Promise<(AVPlayer_WaitingReason) | null>
Swift declaration
nonisolated var reasonForWaitingToPlay: AVPlayer.WaitingReason? { get }
get · iOS 15.0+

sourceClock

TypeScript
get sourceClock(): Promise<(_CoreMedia_CMClock) | null>
Swift declaration
nonisolated var sourceClock: CMClock? { get set }
set · iOS 15.0+

sourceClock

TypeScript
setSourceClock(value?: (_CoreMedia_CMClock) | null): Promise<void>
Swift declaration
nonisolated var sourceClock: CMClock? { get set }
get · iOS 4.0+

status

TypeScript
get status(): Promise<AVPlayer_Status>
Swift declaration
nonisolated var status: AVPlayer.Status { get }
get · iOS 10.0+

timeControlStatus

TypeScript
get timeControlStatus(): Promise<AVPlayer_TimeControlStatus>
Swift declaration
nonisolated var timeControlStatus: AVPlayer.TimeControlStatus { get }
get · iOS 6.0+

usesExternalPlaybackWhileExternalScreenIsActive

TypeScript
get usesExternalPlaybackWhileExternalScreenIsActive(): Promise<boolean>
Swift declaration
nonisolated var usesExternalPlaybackWhileExternalScreenIsActive: Bool { get set }
set · iOS 6.0+

usesExternalPlaybackWhileExternalScreenIsActive

TypeScript
setUsesExternalPlaybackWhileExternalScreenIsActive(value: boolean): Promise<void>
Swift declaration
nonisolated var usesExternalPlaybackWhileExternalScreenIsActive: Bool { get set }
get · iOS 17.2+

videoOutput

TypeScript
get videoOutput(): Promise<(AVPlayerVideoOutput) | null>
Swift declaration
nonisolated var videoOutput: AVPlayerVideoOutput? { get set }
set · iOS 17.2+

videoOutput

TypeScript
setVideoOutput(value?: (AVPlayerVideoOutput) | null): Promise<void>
Swift declaration
nonisolated var videoOutput: AVPlayerVideoOutput? { get set }
get · iOS 7.0+

volume

TypeScript
get volume(): Promise<number>
Swift declaration
nonisolated var volume: Float { get set }
set · iOS 7.0+

volume

TypeScript
setVolume(value: number): Promise<void>
Swift declaration
nonisolated var volume: Float { get set }
method · iOS 27.0+

setDisconnectedFromSystemAudio

TypeScript
setDisconnectedFromSystemAudio(disconnected: boolean, completionHandler?: ((() => void)) | null): Promise<void>
Swift declaration
nonisolated func setDisconnectedFromSystemAudio(_ disconnected: Bool, completionHandler: (@Sendable () -> Void)? = nil)

Changes whether the player is disconnected from system audio. This method allows you to dynamically change the player's system audio connection. The operation is asynchronous. Each call to this method will invoke its own completion handler when the operation completes. When changing from `false` to `true`, you should typically call this method first, then deactivate the `AVAudioSession` to allow other audio to resume. ## Using the completion handler In a scenario where changing the value from `false` to `true` should also allow other system audio to resume, you should only deactivate the audio session once the player has disconnected from system audio. ```swift // Disconnect from system audio and let other audio resume player.setDisconnectedFromSystemAudio(true) { try AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation) } ``` - Parameter disconnected: `true` to disconnect from system audio, `false` to connect to it. - Parameter completionHandler: A block that is called when the connection state change is complete. This block is called on an arbitrary queue. Defaults to `nil`.

Skipped declarations

No declarations were skipped in this snapshot.

All AVFoundation types →