An object that displays the video content from a player object along with system-supplied playback controls.
- iOS 8.0+
- tvOS 9.0+
AVPlayer makes it easy for you to add media playback capabilities to your application matching the styling and features of the native system players. Since
AVPlayer is a system framework class, your playback applications automatically adopt the new aesthetics and features of future operating system updates without any additional work from you.
AirPlay lets users play your video content on an Apple TV and stream audio content to third-party AirPlay speakers and receivers.
AVPlayer automatically supports AirPlay, but you need to perform some project and audio session configuration before it can be enabled in your application. See Configuring Audio Settings for iOS and tvOS in Media Playback Programming Guide for more on how to perform this configuration.
See AirPlay Overview for more information about the features and capabilities of AirPlay.
Adopting Picture in Picture Playback
Starting in iOS 9, you can use
AVPlayer to provide Picture in Picture (PiP) playback on supported iPad models. PiP playback lets users minimize your video player to a small floating window so they can perform other activities in the primary application or even in another application. This brings a new level of multitasking capabilities to the iPad allowing users to continue playback while performing other activities on their devices. To learn more about how to support PiP playback in your iPad applications, see AVKit for iOS in Media Playback Programming Guide.
Using AVPlayerViewController in tvOS
AVPlayer in tvOS brings advanced Siri Remote control features to your application. This lets users easily play and navigate your content and access supporting features such as subtitles and alternate audio tracks.
AVPlayer also provides support for using Siri Remote voice commands such as “Skip ahead 15 seconds” and “What did she say?” to control playback of your content.
AVKit for tvOS extends the features of
AVPlayer to provide additional ways of navigating and presenting content.
External Metadata. If you use the
externalproperty to associate additional metadata with the
AVPlayerobject presented in the player view controller, the
AVPlayerUI can display that information.
Navigation Marker Groups. A group of navigation markers allows the user to jump between significant events in a media presentation. The most common form 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 content it presents.
AVNavigationclass to create and describe navigation markers, then use the
navigationproperty to associate marker groups with the
AVPlayerobject presented in the player view controller.
Interstitial Content. Some content might be unrelated to the main content presented in your player view controller, or have different presentation requirements. For example, you might not allow the user to skip over advertisements when scrubbing through the playback timeline, or require that the user not skip mandatory legal notices.
AVInterstitialclass to describe interstitial content, and the
interstitialproperty to associate those time ranges with the
AVPlayerobject presented in the player view controller. Then, you can use the player view controller’s
delegateobject to be notified when interstitial content plays, and change playback options such as the
Content Proposals. When presenting serialized content, such as a TV show, you often want to propose additional content for the user to watch when the current episode ends. Starting with tvOS 10, it’s easy to add this functionality to your app using AVKit content proposals.
AVContentclass to describe the proposed content, and set it as the
nextproperty of the
AVPlayerobject presented in the player view controller. You can implement the methods of the player view controller’s
delegateobject to prepare to present a content proposal and perform actions in response to a user accepting, rejecting, or deferring the proposal.