Dunfey · Hotel WWDC as data, est. 1983
Front desk everything
Years
Topics

2021 SwiftUI & UI FrameworksAudio & Video

WWDC21 · 11 min · SwiftUI & UI Frameworks / Audio & Video

Deliver a great playback experience on tvOS

Find out how you can use Apple TV’s redesigned playback interface to build great media experiences in your apps. Learn how the latest interface helps people access relevant controls and information while maintaining focus on content. We’ll show you how you can adopt AVPlayerViewController and other APIs for your tvOS app to help people find, play, and enjoy content. To get the most out of this session, we recommend having a basic understanding of AVKit.

Watch at developer.apple.com ↗

Transcript all transcripts

Code shown on screen · 4 snippets

Transport Bar Controls Example swift · at 4:42 ↗
let favoriteAction = UIAction(title: "Favorites", image: UIImage(systemName: "heart")) {
    // Add to favorites
}

let submenu = UIMenu(title: "Speed", options: [.displayInline, .singleSelection],
                     children: [ UIAction() ])

let menu = UIMenu(image: UIImage(systemName: "gearshape"), children: [submenu, UIAction()])
playerViewController.transportBarCustomMenuItems = [favoriteAction, menu]
Content Tabs Example swift · at 6:11 ↗
// Initialize content tab view controller

customViewController.preferredContentSize = CGSize(width: 0, height: 140)
customViewController.title = "Recommended"
TVMediaItemContentConfiguration Example swift · at 7:08 ↗
// Configure 16:9 UICollectionView cell
import TVUIKit

var contentConfiguration = TVMediaItemContentConfiguration.wideCell()
contentConfiguration.image = UIImage(imageLiteralResourceName: "tanu")
contentConfiguration.text = "Title"
contentConfiguration.secondaryText = "Secondary text"
contentConfiguration.badgeText = "NEW"
contentConfiguration.badgeProperties.backgroundColor = .systemRed
contentConfiguration.playbackProgress = 0.75

cell.contentConfiguration = contentConfiguration
TVMonogramContentConfiguration Example swift · at 7:36 ↗
// Configure monogram UICollectionView cell
import TVUIKit

var contentConfiguration = TVMonogramContentConfiguration.cell()
contentConfiguration.image = UIImage(imageLiteralResourceName: "jad")
contentConfiguration.text = "Jad"

cell.contentConfiguration = contentConfiguration

Resources