LAB-010keiver/tomotv
Player · Up Next

Up Next on Apple TV with AVContentProposal

tomo-tvapple-tvavkittvosavcontentproposal

Tomo TV on Apple TV uses AVContentProposal, AVKit's built-in card for offering the next episode. Leaving didReject unimplemented makes AVKit dismiss the player view controller. The card's time must be one playback really passes: the outro's end sat 44 ms past the player's own duration, so the card never appeared.

keiver.dev/lab/10

When an episode ends on Apple TV, Tomo TV offers the next one on a card: poster, title, Play Now, and a countdown. The card is AVContentProposal, AVKit's own Up Next API on tvOS, and it slides in over the credits while they keep rolling. The work was in AVKit's defaults: a callback you leave out, a race during the slide-in, a time playback never reaches, and a countdown that never fires.

AVContentProposal brings the Up Next card to tvOS

You hand AVKit a proposal and a view controller, and AVKit decides when to show them. The proposal carries the next title, a poster, and a contentTimeForTransition. Your AVContentProposalViewController subclass draws the card. When playback passes that time, AVKit slides the card in over the video.

Tomo TV on Apple TV with an Up Next card in the lower left: a poster, the next episode's title, and Play Now and Close buttons, over a cartoon frog and pig eating mangoes under a tree
The card over the still-playing episode. Play Now has focus, and there is no countdown yet: it starts when the episode ends.

Play Now and Close both call dismissContentProposal(for:animated:completion:). AVKit answers with the didAccept or didReject delegate callback. React Native Video does not expose any of this, so it lives in Tomo TV's patch of that library.

Apple's header says the accept callback should swap in the next player item. We do not. Both callbacks go straight to JS, which owns the play queue and the route, and the native side never touches the player item.

Swipe down and AVKit's info panel opens on its own Info tab. Tomo TV adds an Up Next tab beside it, listing up to 30 items from the same queue the card reads.

The Apple TV player's swipe-down Info tab: the episode's thumbnail, number and name, its genre and runtime, and From Beginning and Add to favorites buttons
AVKit's own Info tab. From Beginning is AVKit's action; Add to favorites is ours, appended to it.
The Up Next tab beside Info in the same panel: four episode cards in a row, each with its title and episode number
Our Up Next tab lists up to 30 queued items. Picking a card jumps playback there.

Leave didReject unimplemented and AVKit closes the player

The three most important lines are also the easiest to skip:

func playerViewController(_: AVPlayerViewController, didReject _: AVContentProposal) {
    _handlers?.handleContentProposalRejected()
}

AVKit's header is plain about the default: if the client does not implement this method, the player view controller is dismissed. For a player presented full screen on its own, that is right: Close means done. In Tomo TV the player view controller is an embedded child, not a presentation, and the route belongs to JS. Implementing the callback keeps the decision there: JS hears Close and pops the player route.

Anchor the card at the credits, not at the end

The card appears when playback passes contentTimeForTransition, so that time must be one playback really reaches. The obvious values are not. On a test episode, the outro's end and the runtime were the same tick, 1926.5707 s. AVPlayer reported the item's duration as 1926.5266 s, 44 ms earlier. Playback never got there, so the card never came.

The queue stalled with it, because on Apple TV the card owns the advance. The card is anchored at the start of the credits instead, from Jellyfin's media segments (10.10 or later). Playback passes that frame on its way to the end, and it is where a viewer expects the offer.

Without an outro marker, the card is timed a second before the item's own duration. Leaving the time out, AVKit's default for the end of the item, never presented the card either. Tomo TV's engine ends the item with its last frame, so the duration is where playback stops. A guess of runtime minus 30 seconds was tried and dropped: a fixed guess can land on the last line of dialogue.

The Skip Credits pill steps aside when a card is coming. Both would land on the credits, and the card already has Play Now. On the last episode of a queue, with no card coming, the pill is back.

A cartoon pig in a straw hat in a mango orchard in Tomo TV on Apple TV, with a Skip Intro button in the lower right corner
The Skip Intro pill reads the same Jellyfin media segments. The intro times this pill; the outro times the Up Next card and the Skip Credits pill.

One card at a time

A seek across the transition point can ask AVKit to present twice inside one slide-in. AVKit's boundary-time observer and its user-navigation handler both fire. Its own guard, isPresentingContentProposal, turns on only after the slide-in finishes. The second present then dismissed the card mid-animation, and AVKit asserted.

The fix is the shouldPresent delegate method. It returns false while the card's presentingViewController is set, and AVKit sets that when the slide-in starts.

The Up Next countdown starts when the episode ends

AVKit has a countdown of its own. automaticAcceptanceInterval counts from the end of playback, and AVKit accepts when it runs out. Here it never does. tvOS 26 left dateOfAutomaticAcceptance in the distant future, and React Native Video pauses the player and zeroes its rate the moment the item ends. An earlier card counted 5 to 1 and then sat there forever.

The card keeps its own clock instead, on this timeline:

flowchart LR
  A["Credits start<br/>(Jellyfin marker)"] --> B["Card slides in,<br/>credits keep playing"]
  B --> C["Episode ends"]
  C --> D["Backdrop goes black,<br/>5 s countdown"]
  D --> E["Play Now or zero:<br/>didAccept"]
  E --> F["JS plays the<br/>next episode"]
  B -->|Close| G["didReject:<br/>JS closes the player"]

While the credits roll, the card shows no countdown at all. When the end-of-item notification arrives, the card notes the time, the backdrop turns black, and the count starts.

The timer ticks every half second in the run loop's common mode, so moving focus between the buttons cannot stall it. At zero it makes the same dismiss call as Play Now.

The countdown answers to Jellyfin's own "Play next episode automatically" setting, saved per user as EnableNextEpisodeAutoPlay. Tomo TV reads it as each queued episode starts and never changes it, so a change in Jellyfin's web app lands on the Apple TV with the next episode. With the setting off there is no countdown: the card sits over the black backdrop until the viewer presses Play Now or Close.


The rule behind all of it: an AVKit default assumes a presentation stack and a timeline. When yours differ, implement the delegate method, pick a time playback really reaches, and route the event yourself. The same AVKit-first approach drives channel surfing on Apple TV. Getting the next episode started fast is its own story: why Jellyfin subtitles delay playback. The app is Tomo TV.

Tested on
Server
Jellyfin 10.11.11
Devices
Apple TV, tvOS 26
App
Tomo TV 2.2.10
Checked
2026-10-23
References
  1. AVContentProposal, Apple Developer Documentation
  2. Jellyfin MediaSegmentsController.cs at v10.10.0 media segments arrived in 10.10
  3. Jellyfin API reference UserConfiguration.EnableNextEpisodeAutoPlay

Drafted with Claude from Tomo TV's code and device measurements. Reviewed, edited and verified by Keiver Hernandez.

Next readLAB-009keiver/tomotv
Live TV · Channel wall

Live TV channel previews that loop

tomo-tvapple-tvlive-tvtvosffmpeg

Tomo TV loops a five-second live TV channel preview clip on every card of its channel wall. Each channel is opened once: the first keyframe becomes the card still and the next five seconds are encoded on device to 360p at 1 Mbps. Clips are written as a temporary file and renamed only when whole. A red badge reads LIVE for 15 seconds after the picture changes, and the strip under the card turns red, then fades to black over two minutes. The player pool starts at 12 on Apple TV and lowers itself when the hardware decoder reports busy.

6 min read