atv-core README

项目的 README,来自 github.com/corvofeng/atv-core。合并为一个 markdown 文件:README.md。

Fake Apple TV (atv-core) 📺

English Version | 中文版本

Turn the Apple TV Remote that's already built into your iPhone into a controller for Android TV and Mac. Pull down Control Center, pick your device, and start navigating — no jailbreak, no third-party app, no extra hardware.

iPhone: Find the Remote and Start Using

Swipe down from the top-right corner to open Control Center, tap "Apple TV Remote", select the device running the receiver, pair it, and you're ready to swipe and click.

Find the Remote Use the Remote
Apple TV Remote in Control Center Native Apple TV Remote Interface
Swipe down from top-right to open Control Center, tap the circled remote icon
(If missing, go to Settings → Control Center to add it)
Touchpad on top for swipes / cursor navigation
Buttons below for Select, Back, Play/Pause, Volume, etc.

📖 Full walkthrough & demo: Blog Post


Download

Prebuilt binaries are attached to the latest release:

Platform Download
macOS (Apple Silicon) AppleTVRemote-arm64.dmg
macOS (Intel) AppleTVRemote-x86_64.dmg
Windows (x86_64) AppleTVRemote-windows-x86_64.zip / .exe
Android TV / Google TV FakeAtv-release.apk

Prefer to build it yourself? See Build from source.


Compatibility

Supported Notes
Controller iPhone / iPad with the native Apple TV Remote in Control Center No app install needed on the phone
macOS targets Apple Silicon & Intel Macs (menu bar app + CLI) Requires Accessibility permission
Android targets Android TV, Google TV, TV boxes, emulators Requires network ADB; see limitations
Network Controller and target on the same LAN AP isolation / guest Wi-Fi must be off

Tested on :

Limitations


Quick start

  1. Install the DMG (Mac) or APK (Android TV) from Download.
  2. Put your iPhone and the target on the same Wi-Fi (AP isolation off).
  3. Grant permissions — Accessibility on macOS; network ADB + the on-screen "Always allow" prompt on Android TV. Details below.
  4. Open Control Center to find the Remote:
    • Swipe down from the top-right corner of your screen to open Control Center, then tap the circled Apple TV Remote icon.
    • (If the icon is not in Control Center, go to iOS Settings → Control Center and add "Apple TV Remote" from "More Controls").
    • Select your target device from the top dropdown, and enter PIN 1111 when prompted.

macOS

After installing, macOS Gatekeeper will flag the self-signed app. Clear it once:

# Option A (recommended): trust the bundled certificate
./scripts/import_certificate.sh Corvo_Development.p12

# Option B: strip the quarantine attribute
xattr -dr com.apple.quarantine /Applications/AppleTVRemote.app

Then grant System Settings → Privacy & Security → Accessibility → AppleTVRemote (or your terminal if running the CLI). Launch the app and use the menu bar icon.

Windows

Download and extract AppleTVRemote-windows-x86_64.zip (or run AppleTVRemote-windows-x86_64.exe directly). It runs silently in the background with a system tray icon (no terminal window needed). The web console (http://127.0.0.1:8765) opens automatically on first launch for switching trackpad mode and adjusting sensitivity. On first launch, allow private-network access in the Windows Firewall prompt so your iPhone can discover the device.

Supported: System tray icon with right-click menu (start/stop service, switch trackpad mode, launch at startup, view logs, quit), D-pad / select / back (Esc), mouse cursor & click, play/pause (double-click = next, triple-click = previous), volume / mute, power button turns the monitor off/on.

Android TV

  1. Enable developer options: Settings → About → tap Build Number 7 times.
  2. Enable USB Debugging and Network Debugging: Settings → System → Developer Options.
  3. Install and launch the APK. On first run, an Android security dialog appears — with the TV remote, check "Always allow from this computer" and tap Allow. (Rejecting it causes an Unauthorized error and no input.)
  4. (Optional fallback) Enable the Accessibility Service: main dashboard → ACCESSIBILITY SETTINGS → find Apple TV Remote Receiver → turn it On.

Why ADB? Android prevents regular apps from injecting global D-pad / Select keys into third-party streaming apps. The bundled dadb driver connects to 127.0.0.1:5555 and dispatches Linux keycodes directly (measured <8 ms over local loopback). The Accessibility Service can't do this on its own — it only serves as a fallback and for global Back / Home actions.


Key & gesture mapping

Apple TV Remote action Android TV macOS
Swipe (D-pad mode) KEYCODE_DPAD_UP/DOWN/LEFT/RIGHT Arrow keys ↑ ↓ ← →
Swipe (cursor mode) Touch drag / cursor Smooth cursor via CGEvent
Tap / SELECT KEYCODE_DPAD_CENTER Enter / left click
Back (<) GLOBAL_ACTION_BACK Escape
TV / Home GLOBAL_ACTION_HOME Desktop / configurable
Single click ⏯ KEYCODE_MEDIA_PLAY_PAUSE Play / Pause (NX_KEYTYPE_PLAY)
Double click ⏯ Next / fast-forward Next track (⏭)
Triple click ⏯ Previous / rewind Previous track (⏮)
Volume +/- KEYCODE_VOLUME_UP/DOWN Master volume + native HUD
Mute KEYCODE_VOLUME_MUTE System mute
Side Siri key Voice search (KEYCODE_SEARCH) Toggle cursor ⇄ D-pad / Siri
Power GLOBAL_ACTION_POWER_DIALOG Display sleep / wake

Build from source

# macOS — build the standalone DMG
./scripts/build_dmg.sh
# → build/AppleTVRemote-arm64.dmg ; drag to /Applications

# Android TV — build and install the APK
./scripts/build_android.sh
adb install -r android-tv/app/build/outputs/apk/debug/app-debug.apk
adb shell am start -n com.corvofeng.fakeatv/.MainActivity

Developer docs & internals

Android emulator bridge

For testing in an Android Studio Android TV AVD (physical devices can't discover the emulator's isolated NAT subnet, 10.0.2.15):

# 1. Launch an Android TV AVD (API 30+), verify with: adb devices
# 2. Install the receiver
./scripts/build_android.sh
adb -s emulator-5554 install -r android-tv/app/build/outputs/apk/debug/app-debug.apk
adb -s emulator-5554 shell am start -n com.corvofeng.fakeatv/.MainActivity

# 3. Start the bridge daemon
python3 scripts/bridge_emulator.py start        # or: start -f (foreground, live logs)
python3 scripts/bridge_emulator.py status       # port-forward & mDNS state
python3 scripts/bridge_emulator.py logs -f      # tail logs
python3 scripts/bridge_emulator.py stop         # stop daemon

Then pair from iPhone → Control Center → Apple TV Remote → Android TV Emulator → PIN 1111.

The bridge forwards ports 49152/49153/49154 via adb forward and proxies the Bonjour records (_mediaremotetv._tcp, _companion-link._tcp) onto the physical Wi-Fi, so the iPhone connects to the host and is transparently routed to the emulator.

Emulator bridge workflow

macOS Web Inspector (port 8765)

With the daemon or menu bar app running, open http://127.0.0.1:8765:

macOS Web Inspector

  • Live touch-vector canvas: finger coordinates, gesture phases (Began/Moved/Ended), velocity vectors, direction detection.
  • On-page virtual remote to trigger Mac/TV responses without holding the phone.
  • Ballistics presets: 0.5x Precise, 1.0x Standard, 1.5x Fast, 2.2x Ultra-Wide.
  • Connected-device metadata and live volume telemetry.

macOS host diagnostics (port 8766)

Open http://127.0.0.1:8766 to inspect process health, port bindings, and live protocol handshakes:

macOS host diagnostics

  • Session tracing: Companion client connections, SRP auth, MRP encrypted channel init.
  • Process telemetry: Core API (8765), Web debug (8766), MediaRemote (49152), background PID, log filter, restart controls.

Touchpad gestures & focus accumulation

The Companion Link protocol streams high-frequency delta coordinates. atv-core turns them into grid focus shifts (Android TV) or accelerated cursor motion (macOS):

Remote swipe & navigation flow

  1. Delta accumulator — aggregates micro-displacements to suppress jitter and accidental touches.
  2. Direction deadzone — resolves horizontal vs. vertical intent and filters diagonal noise.
  3. Platform dispatch — Android TV emits KEYCODE_DPAD_*; macOS computes velocity-based ballistics and emits CGEvent motion.

Driver dispatch hierarchy

Driver hierarchy & permissions

  • Android — Primary: dadb loopback to 127.0.0.1:5555 for direct keycode dispatch. Fallback: Accessibility Service for global window actions.
  • macOS — Accessibility API (CGEvent) for cursor/keystrokes; CoreAudio / MediaRemote for hardware volume and media HUD.

Android TV dashboard & configuration

Main dashboard Input injection mode Menu key binding
Main dashboard Injection mode Menu key binding
  • Driver health for /dev/input/event*, local dadb (127.0.0.1:5555), and AtvAccessibilityService.
  • Injection strategy: Local ADB Only, Accessibility Only, ADB Preferred (Accessibility fallback), or Hardware Preferred.
  • Menu key rebinding: remap Play/Pause, Home, or Mute to KEYCODE_MENU for legacy TV apps.

Accessibility setup screens:

Service list Confirmation dialog Ready
Service list Permission dialog Ready

Troubleshooting & FAQ

Device doesn't appear in Control Center?

  1. Confirm iPhone and target are on the same Wi-Fi subnet (disable AP isolation / guest mode).
  2. On macOS, run dns-sd -B _mediaremotetv._tcp to verify Bonjour advertisement.
  3. For the emulator, check the bridge: python3 scripts/bridge_emulator.py status.

Keys don't respond on TV / ADB connection error?

  1. Verify "Network ADB" and "USB Debugging" are on in Developer Options.
  2. Relaunch the app and watch for the RSA fingerprint dialog — check "Always allow" and tap Allow.
  3. If no prompt appears, run adb connect <TV_IP>:5555 from a computer to trigger initial trust.

Can't find Accessibility settings on Android TV? Some TV skins hide the menu. Use the "ACCESSIBILITY SETTINGS" dialog in the app, or run:

adb shell settings put secure enabled_accessibility_services com.corvofeng.fakeatv/.AtvAccessibilityService
adb shell settings put secure accessibility_enabled 1

macOS says the app is damaged / from an unidentified developer?

xattr -dr com.apple.quarantine /Applications/AppleTVRemote.app
# or trust the bundled certificate:
./scripts/import_certificate.sh Corvo_Development.p12

License

MIT. Intended for educational and local device interoperability research.

atv-core (corvofeng/atv-core)

正在搜索数据库…

这是什么?atv-core 是 Apple TV Companion Link 和 MediaRemote(MRP)协议的高性能 Rust 实现,让你无需越狱或专用硬件,就能用 iOS/iPadOS 控制中心里原生的 Apple TV 遥控器小组件来发现、配对和控制 Apple TV 目标设备。
这是一个应用,还是几个独立的部分?它分为三部分:核心 Rust 库/CLI、macOS 原生 Swift 菜单栏应用(AppleTVRemote.app),以及面向 Android TV/Google TV 的独立 Android APK,后者通过 JNI、内置 ADB 客户端(dadb)和无障碍服务来驱动输入。
怎么让它在 macOS 和 Android TV 上跑起来?在 macOS 上,挂载 build/AppleTVRemote-arm64.dmg 并把应用拖入 /Applications,然后从菜单栏控制它;在 Android TV 上,安装独立 APK,启用网络/USB ADB 调试,接受内置 ADB 的 RSA 指纹提示,并开启“Apple TV Remote Receiver”无障碍服务。
需要在电视上开启 ADB 和开发者模式吗?需要——Android TV 要求开启开发者选项、USB 调试和网络调试,然后接受内置 Dadb 的 RSA 指纹提示;应用还需要开启它自己的无障碍服务作为备用输入通道。
配对之前有哪些需要注意的坑?macOS Gatekeeper 可能把未签名的应用标记为“已损坏”或来自未知开发者,需要你移除隔离属性或导入仓库自带的自签名证书;此外,开启 AP 隔离/访客模式的路由器会阻断配对所依赖的 Bonjour(UDP 5353)发现。
Android 应用需要深层系统权限吗?需要,Android TV 应用依赖无障碍服务注入全局的十字键/确认/返回/主屏幕操作,并通过本地 ADB 连接发送按键码,因为普通应用无法向第三方流媒体应用注入输入。
默认配对 PIN 是多少?是 1111,在 iPhone 上首次连接 Mac 或 Android TV 目标时,于 SRP 加密握手过程中输入。
没有真实的 Apple TV 或 Android TV 盒子也能测试吗?可以——atv-core 支持 Android TV 模拟器方案,转发 ADB 端口并把 mDNS Bonjour 记录代理到局域网,让 iPhone 能直接发现并控制模拟器。
内置的诊断仪表板显示什么?macOS 应用在 8765 端口提供 Web Inspector,在 8766 端口提供 Swift Host Diagnostics 仪表板,实时可视化触控板手势、硬件音量等级和毫秒级的协议事件。
它如何把 iPhone 的滑动变成电视导航?它从 Companion Link 触摸数据流中累积高频增量坐标,用方向死区过滤噪声,然后在 Android 上分发十字键焦点事件,或在 macOS 上通过 CGEvent 实现基于速度的光标移动。
作者
corvofeng
大小
9.4 MB
星标
439
时长
2个月
提交 · 90 天