This sample demonstrates support for custom interactive overlays, and parental controls, using AVPlayer
.
SDKs
- tvOS 13.0+
- Xcode 11.0+
Framework
- AVKit
Overview
Note
This sample code project is associated with WWDC 2019 session 503: Delivering Intuitive Media Playback with AVKit.
Video
hosts instances of AVPlayer
. This class has all of the new API calls.
Custom
and Custom
describe the custom overlay and its behavior. In this example, the overlay is purely for show: It displays several “up next” items, but does not perform any action if they are selected.
Configure the Sample Code Project
To test channel flipping, you will need to replace the assets in the sample with live streams, as channel-flipping is only supported for navigation from a live stream.
By default, this sample demonstrates automatic support for parental restrictions. To demonstrate, you will need to activate parental restrictions: • Navigate to Settings > General > Restrictions • Turns on “Restrictions” and set a passcode (for demonstration purposes, “1111” is fine; do not lose this passcode!) • Scroll down to the “Allowed Content” section, select “Movies” and/or “TV Shows,” and set a restriction level, e.g. “PG” or “PG-13” if you are in the United States. The first demo video has a rating of “PG” and the second has a rating of “PG-13”; you can find/edit these ratings in Main
. This sample also demonstrates explicit support for parental restrictions, by directly calling player
. You can test this by changing the value of check
to true.