cupertino-sample-code/avkit-working-with-overlays-and-parental-controls-in-tvos
Mihaela Mihaljevic 37fd4fb24f Initial commit: 606 Apple sample code projects
MIT License - Apple Developer sample code
Downloaded via Cupertino (https://github.com/mihaelamj/cupertino)
2025-12-03 00:19:12 +01:00
..
Configuration Initial commit: 606 Apple sample code projects 2025-12-03 00:19:12 +01:00
TVAVPlayerViewControllerDemo Initial commit: 606 Apple sample code projects 2025-12-03 00:19:12 +01:00
.gitignore Initial commit: 606 Apple sample code projects 2025-12-03 00:19:12 +01:00
LICENSE.txt Initial commit: 606 Apple sample code projects 2025-12-03 00:19:12 +01:00
README.md Initial commit: 606 Apple sample code projects 2025-12-03 00:19:12 +01:00

Working with Overlays and Parental Controls in tvOS

Add interactive overlays, parental controls, and livestream channel flipping using a player view controller.

Overview

Configure the Sample Code Project

Only navigation from live streaming supports channel flipping, so you need to replace the assets in this sample with your live content to demonstrate this behavior.

By default, the sample demonstrates automatic support for parental controls. Activate parental restrictions by following the steps below:

  1. Go to Settings > General > Restrictions.
  2. Turn on Restrictions.
  3. Set a passcode (1111 for demonstration purposes; remember this passcode).
  4. Scroll down to the Allowed Content section.
  5. Select Movies and/or TV Shows.
  6. Set a restriction level (for example, 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 or edit these ratings in MainViewController.swift.

This sample also demonstrates explicit support for parental restrictions by directly calling playerItem.requestPlaybackRestrictionsAuthorization(_ completion). You can test explicit support by changing the value of checkParentalControlsExplicitly in the sample.