AVPlayerItem
An object that models the timing and presentation state of an asset during playback.
Declaration
@MainActor class AVPlayerItemMentioned in
Overview
A player item stores a reference to an AVAsset object, which represents the media to play. If you require inspecting an asset before you enqueue it for playback, call its load(_:isolation:) method to retrieve the values of one or more properties. Alternatively, you can tell the player item to automatically load the required properties by passing them to its init(asset:automaticallyLoadedAssetKeys:) initializer. When the player item is ready to play, the asset properties you request are ready to use.
Topics
Creating a player item
init(url:)init(asset:)init(asset:)init(asset:automaticallyLoadedAssetKeys:)init(asset:automaticallyLoadedAssetKeys:)init(asset:automaticallyLoadedAssetKeys:)
Accessing tracks
Accessing metadata
Determining readiness
Determining playback capabilities
Setting playback boundaries
Stepping through media
Seeking through media
seek(to:completionHandler:)seek(to:toleranceBefore:toleranceAfter:completionHandler:)seek(to:completionHandler:)cancelPendingSeeks()
Selecting media options
select(_:for:)preferredCustomMediaSelectionSchemeseffectiveMediaPresentationSettings(for:)selectMediaPresentationLanguage(_:for:)selectedMediaPresentationLanguage(for:)selectedMediaPresentationSettings(for:)currentMediaSelectionselect(_:in:)selectMediaOptionAutomatically(in:)
Setting variant behavior
Configuring interstitial events
integratedTimelineautomaticallyHandlesInterstitialEventstranslatesPlayerInterstitialEventsinterstitialTimeRangestemplate
Accessing timing information
Determining available time ranges
Determining buffering status
Configuring expensive network behavior
Accessing text style rules
Accessing logging information
accessLog()AVPlayerItemAccessLogAVPlayerItemAccessLogEventerrorLog()AVPlayerItemErrorLogAVPlayerItemErrorLogEvent
Observing notifications
didPlayToEndTimeNotificationfailedToPlayToEndTimeNotificationtimeJumpedNotificationplaybackStalledNotificationmediaSelectionDidChangeNotificationrecommendedTimeOffsetFromLiveDidChangeNotificationnewAccessLogEntryNotificationnewErrorLogEntryNotification
Managing time offsets
Configuring presentation
Accessing Now Playing information
Configuring HDR settings
Configuring video compositing
Configuring audio
audioMixaudioTimePitchAlgorithmallowedAudioSpatializationFormatsAVAudioSpatializationFormatsisAudioSpatializationAllowed
Managing player item outputs
Managing player item data collectors
Configuring network behavior
Configuring player items for AVKit
Requesting playback authorization in tvOS
Managing playback authorization in macOS
isContentAuthorizedForPlaybackisAuthorizationRequiredForPlaybackisApplicationAuthorizedForPlaybackrequestContentAuthorizationAsynchronously(withTimeoutInterval:completionHandler:)contentAuthorizationRequestStatusAVContentAuthorizationStatuscancelContentAuthorizationRequest()