Skip to content

iOS: play on a connected TV (cable or AirPlay), picture capped at 1080p - #367

Closed
zorrobyte wants to merge 2 commits into
seedds:mainfrom
zorrobyte:ios-tv
Closed

zorrobyte wants to merge 2 commits into
seedds:mainfrom
zorrobyte:ios-tv

Conversation

@zorrobyte

Copy link
Copy Markdown
Contributor

What

Play on a TV. When a TV is connected by cable, or Screen Mirroring to an Apple TV or AirPlay TV is started, iOS gives the app the TV as a scene of its own instead of mirroring the phone. The game's Metal view moves there, 16:9 fills the TV, the game switches to console mode (Docked), and the phone keeps the touch pad. Unplugging puts the view back on the phone and restores the earlier mode.

  • iOS 27 offers the TV scene only to a registered scene accessory (registerSceneAccessory); the Info.plist entry (project.yml) stays for iOS 26.
  • The TV picture is capped at 1080p. The game renders 1080p docked, so a 4K drawable only added an upscale pass and a 4K stream. An Apple TV over AirPlay showed black without the cap (GPU 15 to 60 ms a frame).
  • docs/settings.md gets a TV section.

Game-neutral: front_ios.m, main.m (scene configuration name), project.yml, docs.

Tested

  • GAME=0100F2C0115B6000 python3 dm/ios/tools/compile_check.py: 178 files, 0 failed
  • python3 -m unittest dm/tools/tests/test_docs.py: OK
  • On the author's iPhone with a TV by cable and an Apple TV over AirPlay (see the 1080p note above). The change touches only the iOS front end, not the host, chain or translator, so regress.py was not run.

🤖 Generated with Claude Code

@maxdavidson

Copy link
Copy Markdown
Contributor

Thanks, this matches what I found on iOS 27. One case it misses: under LiveContainer, registering the accessory is not enough.

On an iPhone 17 Pro (iOS 27, LiveContainer guest, USB-C monitor), a build that registers the accessory the way this PR does still mirrored the phone: registration.available stayed NO and the delegate was never called (LiveContainer#1694). The system still connects an unclaimed ExternalDisplayNonInteractive scene with no delegate and no window, and keeps mirroring until a window is put in it.

What fixed it for me: watch UISceneWillConnectNotification (and connectedScenes once at start) for an external-display scene with no windows and a delegate that isn't DmTVSceneDelegate, then create the same UIWindow + DmTVVC there and call tv_attach(). About 30 lines. The game then showed on the monitor with the controls on the phone.

I haven't tried AirPlay under LiveContainer (the issue reports black, which your 1080p cap may avoid) or a direct install. I can send this as a follow-up PR once this lands, or as a suggestion here.

— Claude

@v0lumehi

Copy link
Copy Markdown
Contributor

Heads-up: seedds asked in #388 to agree on one settings schema and one store for player choices before the launchers are extended. I posted a proposal there (#388 (comment)): one optional meta column (key=value;…) in settings.tsv, a versioned launcher.json, and one store with one precedence. If TV output gets a player-facing setting, it would be one row in that schema (platform=ios). Input welcome in #388.

zorrobyte and others added 2 commits October 27, 2026 11:19
A TV gets the game's view through an external display scene: 16:9 fills it, the game
switches to console mode, and the phone keeps the pad. Unplugging moves the view back
and restores the earlier mode. iOS 27 offers the TV scene only to a registered scene
accessory (registerSceneAccessory); the Info.plist entry stays for iOS 26.

The TV picture is at most 1080p: the game renders 1080p docked, and a 4K drawable only
added an upscale pass and a 4K stream. An Apple TV over AirPlay showed black with it
(GPU 15 to 60 ms a frame).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI builds with an Xcode whose iOS SDK lacks UISceneAccessory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zorrobyte

Copy link
Copy Markdown
Contributor Author

Rebased onto main (conflict in docs/settings.md, both the Mac settings window and TV sections kept). CI is green.

@maxdavidson thanks for the LiveContainer finding. A follow-up PR for the unclaimed external-display scene after this lands would be welcome, so this one stays scoped to the direct-install path. Noted on #388: a TV setting, if added, would be one row in that schema.

seedds added a commit that referenced this pull request Oct 30, 2026
…e capped at 1080p (PR #367, GitHub issue #705)

A TV gets the game's view through an external display scene: 16:9 fills it, the game
switches to console mode (operation mode notification, as a Switch on its dock), and
the iPhone or iPad keeps the pad. Unplugging moves the view back and restores the
earlier mode. An app built with the iOS 27 SDK is offered the TV scene only after it
registers a scene accessory (registerSceneAccessory); the manifest entry alone is
ignored and iOS mirrors the whole screen, pad included (issue #705). The Info.plist
entry stays for iOS 26.

The TV picture is at most 1920 pixels across the 16:9 picture (taken from the picture,
not the screen, so a display of another shape keeps the full 1080p): the game renders
1080p docked, and a 4K drawable only added an upscale pass and a 4K stream. An Apple TV
over AirPlay showed black with it (GPU 15 to 60 ms a frame). Only the external display
role gets the TV scene configuration; every other role keeps Default.

Tested by the author on an iPhone with a TV by cable and an Apple TV over AirPlay, and
in issue #705 on an iPad Air M3 (iPadOS 27.2) with a 4K TV by USB-C: the game fills the
TV, the iPad keeps the pad, the game is docked. Open: unplugging and plugging in again
on a device, the iOS 26 manifest-only path, and LiveContainer (it connects an unclaimed
external display scene; a follow-up was offered in the PR).

Co-authored-by: Zorrobyte <[email protected]>
@seedds

seedds commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Landed on main as a5bf542, with you as co-author. Thanks!

It was rebased onto current main (the only conflict was docs/settings.md; the Cloud saves and TV sections are both kept), with three small changes:

  • main.m: only UIWindowSceneSessionRoleExternalDisplayNonInteractive gets the TV configuration; every other role keeps Default.
  • The 1080p cap is taken from the 16:9 picture's width instead of the TV's, so a display of another shape still gets 1920 pixels across the picture. The connect log line now gives the screen in points and the picture in pixels.
  • The TV section says "TV or monitor" and "iPhone or iPad" (iOS: on an external display the game is only mirrored (iOS 27 SDK needs a registered scene accessory) #705 confirmed it on an iPad Air M3 with a 4K TV).

Still open: unplugging and plugging the TV in again has no device test yet (asked in #705), and the iOS 26 manifest-only path is untested. @maxdavidson, a follow-up PR for the unclaimed external display scene under LiveContainer is welcome on top of this.

@seedds seedds closed this Oct 30, 2026
Know-It-All-Brother pushed a commit to Know-It-All-Brother/nxnative that referenced this pull request Nov 9, 2026
…e capped at 1080p (PR seedds#367, GitHub issue seedds#705)

A TV gets the game's view through an external display scene: 16:9 fills it, the game
switches to console mode (operation mode notification, as a Switch on its dock), and
the iPhone or iPad keeps the pad. Unplugging moves the view back and restores the
earlier mode. An app built with the iOS 27 SDK is offered the TV scene only after it
registers a scene accessory (registerSceneAccessory); the manifest entry alone is
ignored and iOS mirrors the whole screen, pad included (issue seedds#705). The Info.plist
entry stays for iOS 26.

The TV picture is at most 1920 pixels across the 16:9 picture (taken from the picture,
not the screen, so a display of another shape keeps the full 1080p): the game renders
1080p docked, and a 4K drawable only added an upscale pass and a 4K stream. An Apple TV
over AirPlay showed black with it (GPU 15 to 60 ms a frame). Only the external display
role gets the TV scene configuration; every other role keeps Default.

Tested by the author on an iPhone with a TV by cable and an Apple TV over AirPlay, and
in issue seedds#705 on an iPad Air M3 (iPadOS 27.2) with a 4K TV by USB-C: the game fills the
TV, the iPad keeps the pad, the game is docked. Open: unplugging and plugging in again
on a device, the iOS 26 manifest-only path, and LiveContainer (it connects an unclaimed
external display scene; a follow-up was offered in the PR).

Co-authored-by: Zorrobyte <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants