AVPlayerViewController
A view controller that displays content from a player and presents a native user interface to control playback.
Declaration
@MainActor class AVPlayerViewControllerMentioned in
Overview
A player view controller makes it simple to add media playback capabilities to your app that match the styling and features of the native system players. Using this object also means that your app automatically adopts the new features and styling of future operating system releases.
Support AirPlay
AirPlay lets users stream media to Apple TV, HomePod, and AirPlay 2-compatible speakers and smart TVs. A player view controller supports AirPlay automatically, but you need to configure your app to enable it. See Configuring your app for media playback for more information about configuring your app for background playback.
Adopt Picture in Picture playback
AVPlayerViewController provides Picture in Picture (PiP) playback in iOS and tvOS. PiP playback lets users minimize the video player to a small floating window so they can perform other activities in the primary app or in another app.
Customize the tvOS playback experience
AVPlayerViewController in tvOS brings advanced Siri Remote control features to your app. This support lets users play and navigate your content, and access supporting features like subtitles and alternate audio tracks. This object also provides support for using Siri Remote voice commands, such as “Skip ahead 15 seconds” and “What did they say?”, to control playback of your content.
AVKit for tvOS extends the features of AVPlayerViewController and AVPlayerItem to provide additional ways to navigate and present content. Features unique to the tvOS player user interface include:
Navigation Marker Groups. A group of navigation markers that allow a viewer to jump between significant events in the media timeline. The most common type of navigation marker group is a chapter list, but you can also create additional or alternative means of navigation — for example, to allow the user to quickly jump between key moments in a recorded sporting event. The player view controller lets the user choose between multiple marker groups for navigating through the media timeline.
Use the AVNavigationMarkersGroup class to create and describe navigation markers, then use the navigationMarkerGroups property to associate marker groups with the current AVPlayerItem object.
Interstitial Content. Some content might not relate to the main content that your app presents, or might have different presentation requirements. For example, you might not allow the user to skip over advertisements when scrubbing through the playback timeline, or to skip mandatory legal notices.
Use the AVInterstitialTimeRange class to describe interstitial content, and the interstitialTimeRanges property to associate those time ranges with the current AVPlayerItem object.
Content Proposals. When presenting serialized content, like a TV show, you often want to propose additional content for the viewer to watch when the current episode ends. It’s straightforward to add this functionality to your app using content proposals.
Use the AVContentProposal class to describe the proposed content, and set it as the nextContentProposal property of the current AVPlayerItem object. You can implement the methods of the player view controller’s delegate object to prepare to present a content proposal, and perform actions in response to the viewer accepting, rejecting, or deferring the proposal.
Topics
Configuring presentation
showsPlaybackControlscontentOverlayViewvideoGravityvideoBoundsshowsTimecodesappliesPreferredDisplayCriteriaAutomatically
Customizing the tvOS player UI
playbackControlsIncludeTransportBarplaybackControlsIncludeInfoViewstransportBarIncludesTitleViewtransportBarCustomMenuItemscustomInfoViewControllersinfoViewActionscontextualActionscustomOverlayViewControllerunobscuredContentGuidecustomInfoViewController
Configuring the visionOS player UI
infoViewActionscustomInfoViewControllerscontextualActionscontextualActionsInfoViewcontextualActionsPreviewImagerequiresMonoscopicViewingModeexperienceControllergroupExperienceCoordinator