Native Media Playback on tvOS: AVPlayerViewController or AVPlayer/AVFoundation?

Wondering if AVPlayerViewController is preferred for playing arbitary video/audio streams on tvOS or if creating a custom UIViewController with AVPlayer is the way to go. I suspect the latter, but don't want to miss the boat if AVPlayerViewController somehow offers the best user experience. I don't see any way to assign externalMetadata if using an AVPlayerViewController, so unless I'm missing something that's probably a show-stopper right there.


Also, it seems like the TVML/client-server folks are getting all the love with their MediaItems capabilities. Is there an option for native developers who might be interested in things like media interstitials? Thanks!

We're pretty happy with AVPlayerViewController for displaying whole films or episodes. Has all the controls baked right in for audio tracks and subtitles etc. MediaItems seem to me like an AVPlayerItem in a playlist. Check out AVInterstitialTimeRange.

We would strongly recommend that you use AVPlayerViewController for media playback experiences. You may want to use a custom approach if you do not require playback controls, or if the media playback experience needs to be atypical in nature.


You can handle marking regions as interstitial content by setting the interstitialTimeRanges property of your AVPlayerItem. You can also set metadata for the item manually (if not contained in the media asset) using the externalMetadata property, and manage chapter groups using the navigationMarkerGroups property.


By setting an intersitial timerange, that region of the timeline will be collapsed, and you will receive callbacks to your AVPlayerViewControllerDelegate as the player enters and exits the interstitial regions, allowing you to adjust playback behaviour or seek past ads if appropriate.


Take a look at the discussion of these items in the documentation for AVPlayerViewController for more information.

Native Media Playback on tvOS: AVPlayerViewController or AVPlayer/AVFoundation?
 
 
Q