Skip to content

VOD load option to reuse the native AVPlayer across loads so system PiP survives next-episode transitions #158

Closed

Description

@superuser404notfound

Context

Sodalite tvOS PiP (host-built AVPictureInPictureController around a second AVPlayerLayer, Sodalite feature/tvos-pip) works for start, restore, close, background keepalive (5.11.0), and subtitles. The one unsupported flow is next-episode auto-advance while the PiP window is open: the window closes mid-transition.

Device evidence (Apple TV 4K 3rd gen, console-attached)

The next-episode reload builds a fresh NativeAVPlayerHost (log: #1 -> #2, fresh t+0.00 KVO stamps) with a new loopback session. Three host-side mitigations were tried and all failed on device:

  1. Keeping the AVPictureInPictureController alive through the currentAVPlayer nil gap.
  2. Keeping the old (stopped) player attached to the source layer through the gap and skipping AVKit re-binds.
  3. Firing the advance 4s early so the swap lands while the old item still plays (no didPlayToEndTime before the swap; window still closed while host HDR10+ and Dolby Vision missing dynamic metadata #2 was coming up).

The system closes the PiP window whenever its source layer's player is replaced or left without an active item. Platform behavior matches Apple's guidance: PiP survives item transitions only on the SAME player instance (AVQueuePlayer / replaceCurrentItem patterns).

Requested capability

A load path (option or dedicated API) that keeps the current AVPlayer instance and swaps only the AVPlayerItem onto the new loopback session, ideally with the new item prepared before the swap (gapless handover, queue-style). NativeAVPlayerHost reuse infrastructure partially exists (stopInternal keepNativeHost, issue #15 MediaRemote re-registration), but a regular load() still ends in a fresh player as observed by the layer.

Host adoption (Sodalite): re-enable next-episode auto-advance during PiP once the player identity is stable across the transition. Until then the host disables auto-advance while PiP is active (v1, episode runs out inside the window).

🤖 Generated with Claude Code

https://claude.ai/code/session_01NAPCg4tCDdSqkK6tPkNptw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions