argent-tv-interact
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseArgent TV (Apple TV + Android TV + Fire TV)
Argent TV (Apple TV + Android TV + Fire TV)
Critical
关键注意事项
- A TV is focus-driven, not touch-driven. Drive every interaction with +
describe+tv-remote; never usekeyboard/ coordinate taps — they don't apply on any TV platform.gesture-* - Always before navigating to find the live cursor and your target — never guess focus from a screenshot. The cursor is the focused element; on Vega the toolkit often leaves
describefalse and marks the highlighted itemfocused, so treat[selected]as the cursor when nothing reports[selected].[focused] - Pass the from
udid— an Apple TV simulator UDID or an Android TV / Vegalist-devices. Dispatch is automatic from the id; the same tools drive all three.serial
- TV 应用是以焦点为驱动,而非触控驱动。所有交互都需通过 +
describe+tv-remote完成;切勿使用keyboard/ 坐标点击——这些操作在任何 TV 平台上都不适用。gesture-* - 导航前务必调用 ,以找到实时光标和目标元素——切勿通过截图猜测焦点位置。光标即为已聚焦元素;在 Vega 平台上,工具包常将
describe标记为 false,而是用focused标记高亮项,因此当没有元素显示[selected]时,需将[focused]视为光标。[selected] - 传入 返回的
list-devices——可以是 Apple TV 模拟器的 UDID,也可以是 Android TV / Vega 的udid。工具会根据 ID 自动分发指令;同一套工具可驱动上述三种平台。serial
The navigation loop
导航流程
- — find the cursor and your target (returns the focused element + all focusable ones, not a tap tree).
describe - — move focus toward the target. Prefer one call with a path ending in
tv-remote, e.g.select; count rows/columns from the frames to build the path.{button:["down","right","select"]} - again to confirm. On a miss, repeat.
describe
- —— 找到光标和目标元素(返回已聚焦元素 + 所有可聚焦元素,而非点击树)。
describe - —— 将焦点移向目标元素。优先使用单次调用并传入包含
tv-remote的路径,例如select;根据框架计算行数/列数以构建路径。{button:["down","right","select"]} - 再次调用 确认。若操作失败,重复上述步骤。
describe
Tools
工具列表
- — focus view: the focused /
describe {udid}element + focusable elements with labels and normalized frames. The discovery tool — call before and after navigating. Empty tree → see the per-platform notes.[selected] - — D-pad / remote.
tv-remote {udid, button}is one key or a whole path (run in one call). Keys:button/up/down/left,right,select,back,menu,home, plus media keysplayPause/rewind/fastForward/next/previous/volumeUp/volumeDown. Single:mute; repeat:{button:"down"}; path:{button:"down", repeat:3}.{button:["up","right","select"]} - — type into the focused field (focus it with
keyboard {udid, text}first). Namedtv-remotepresses (e.g.key) work on Vega; on Apple TV / Android TV move focus with{key:"enter"}instead.tv-remote - /
launch-app/restart-app—reinstall-app {udid, bundleId}from the app manifest. VegabundleIdtakesreinstall-app= aappPath..vpkg - — Apple TV via
screenshot {udid, scale?}(downscaled); Android TV / Vega host-side viaxcrun simctl io/adb.screencap
- —— 获取焦点视图:返回已聚焦/
describe {udid}元素以及带有标签和标准化框架的可聚焦元素。这是核心发现工具——导航前后都需调用。若返回空树,请查看各平台说明。[selected] - —— 方向键/遥控器操作。
tv-remote {udid, button}可以是单个按键或完整路径(单次调用执行)。支持的按键:button/up/down/left、right、select、back、menu、home,以及媒体按键playPause/rewind/fastForward/next/previous/volumeUp/volumeDown。单个按键示例:mute;重复按键示例:{button:"down"};路径示例:{button:"down", repeat:3}。{button:["up","right","select"]} - —— 在已聚焦的输入框中输入文本(需先通过
keyboard {udid, text}聚焦输入框)。Vega 平台支持指定按键(例如tv-remote);而在 Apple TV / Android TV 上,请使用{key:"enter"}移动焦点。tv-remote - /
launch-app/restart-app——reinstall-app {udid, bundleId}来自应用清单。Vega 平台的bundleId需传入reinstall-app,即appPath文件路径。.vpkg - —— Apple TV 平台通过
screenshot {udid, scale?}实现(支持降采样);Android TV / Vega 平台通过主机端的xcrun simctl io/adb实现。screencap
Per-platform
各平台说明
Apple TV (tvOS simulator)
Apple TV (tvOS 模拟器)
- Boot like any iOS sim (); the AX + HID daemons auto-start on the first
boot-device/describe(first call may take a few seconds). Give the RN bundle a few seconds to render before the firsttv-remote.describe - Media-transport / volume keys are rejected — the sim's HID stack ignores them (they work on Android TV / Vega).
- Dev build: (
open-url {udid, url:"<scheme>://expo-development-client/?url=http%3A%2F%2F<HOST_IP>%3A8081"}= your Mac's LAN IP, shown on the launcher).<HOST_IP>
- 像启动 iOS 模拟器一样启动设备();首次调用
boot-device/describe时,AX + HID 守护进程会自动启动(首次调用可能需要几秒)。首次调用tv-remote前,请给 RN 包几秒渲染时间。describe - 媒体传输/音量按键会被拒绝——模拟器的 HID 栈会忽略这些按键(它们在 Android TV / Vega 平台上可用)。
- 开发构建:使用 (
open-url {udid, url:"<scheme>://expo-development-client/?url=http%3A%2F%2F<HOST_IP>%3A8081"}为你的 Mac 局域网 IP,可在启动器中查看)。<HOST_IP>
Android TV (leanback emulator)
Android TV (leanback 模拟器)
- Boot the leanback AVD like any emulator — see .
argent-android-emulator-setup - may report zero focusables on a screen with visible tiles: many
describescreens use RN's own focus engine, invisible to the OS accessibility tree.react-native-tvosauto-falls-back to the full UI tree (and says so in the hint);describestill moves focus, so drive blind +tv-remoteto confirm.screenshot - Dev build: , deep-link
adb -s <serial> reverse tcp:8081 tcp:8081, dismiss the first dev-menu with<pkg>://expo-development-client/?url=http%3A%2F%2F10.0.2.2%3A8081(not Back — Back exits the app).adb shell input keyevent KEYCODE_DPAD_CENTER
- 像启动普通模拟器一样启动 leanback AVD——参考 。
argent-android-emulator-setup - 可能在有可见磁贴的屏幕上返回零个可聚焦元素:许多
describe屏幕使用 RN 自身的焦点引擎,该引擎对系统无障碍树不可见。react-native-tvos会自动回退到完整 UI 树(并在提示中说明);describe仍可移动焦点,因此可盲操并通过tv-remote确认结果。screenshot - 开发构建:执行 ,通过深度链接
adb -s <serial> reverse tcp:8081 tcp:8081打开应用,使用<pkg>://expo-development-client/?url=http%3A%2F%2F10.0.2.2%3A8081关闭首次弹出的开发菜单(不要用 Back 键——Back 键会退出应用)。adb shell input keyevent KEYCODE_DPAD_CENTER
Fire TV (Vega / VVD)
Fire TV (Vega / VVD)
- shows a
list-devices(use asserial) and audid.vvdImage(e.g.boot-device {vvdImage}) starts the single SDK-managed VVD; skip if one already runs."tv" - Stop the VVD with in your shell. The CLI only tracks VVDs it started in the foreground, so it may report "not running" for one started via
vega virtual-device stop; to restart that one useboot-device(stops then re-boots).boot-device {vvdImage, force:true} - Empty tree →
describe(the automation toolkit attaches at launch), then retry. Input ignored → enable developer mode in the VVD:restart-app.vsm developer-mode enable - Editing has no effect on a Release build — only Debug
node_modulesbuilds load patchable JS..vpkg - Profiling / crashes → server (
amazon-devices-buildertools-mcp,analyze_perfetto_traces,get_app_hot_functions); docs via itssymbolicate_acrtool.search_documentation
- 会返回
list-devices(用作serial)和udid。使用vvdImage(例如boot-device {vvdImage})启动由 SDK 管理的单个 VVD;若已有 VVD 在运行,可跳过此步骤。"tv" - 停止 VVD:在终端中执行 。CLI 仅跟踪其在前台启动的 VVD,因此对于通过
vega virtual-device stop启动的 VVD,可能会显示“未运行”;如需重启该 VVD,请使用boot-device(先停止再重启)。boot-device {vvdImage, force:true} - 若 返回空树 → 执行
describe(自动化工具会在启动时附加到应用),然后重试。若输入无响应 → 在 VVD 中启用开发者模式:restart-app。vsm developer-mode enable - 编辑 对 Release 构建无影响——只有 Debug 版
node_modules构建会加载可补丁的 JS。.vpkg - 性能分析/崩溃排查 → 使用 服务器(包含
amazon-devices-buildertools-mcp、analyze_perfetto_traces、get_app_hot_functions等工具);可通过其symbolicate_acr工具查看文档。search_documentation
Common gotchas
常见问题
- Empty focus right after /
launch-appis the splash / loading window —restart-appretries internally; wait ~2-3s and retry on a cold start.describe - Passing a phone/tablet () udid to
runtimeKind: "mobile"fails with a clear "tvOS-only" / "Android-TV-only" error — pick a TV target fromtv-remote.list-devices
- 启动应用/重启应用后焦点为空:这是启动页/加载窗口导致的——会自动重试;冷启动时请等待约 2-3 秒后重试。
describe - 若将手机/平板()的 udid 传入
runtimeKind: "mobile",会返回明确的“仅 tvOS”/“仅 Android TV”错误——请从tv-remote中选择 TV 目标设备。list-devices
Fast Refresh (dev builds)
Fast Refresh(开发构建)
Needs a Debug build + Metro running. argent only connects to Metro — start Metro and port-forward yourself (any platform). Metro is fixed on :8081.
- Apple TV / Android TV: use the dev-build deep-links above; for Metro.
npm start - Vega: build/install a Debug (
.vpkg),vega device install-app -p <path>,npm start, thenvega device start-port-forwarding --port 8081 --forward false. Confirmvega device launch-app -a <appId>shows ahttp://localhost:8081/json/listtarget;Hermes React Nativeedits then hot-reload..tsx
需要 Debug 构建 + Metro 运行。argent 仅负责连接到 Metro——请自行启动 Metro 并进行端口转发(所有平台通用)。Metro 固定使用端口 :8081。
- Apple TV / Android TV:使用上述开发构建的深度链接;执行 启动 Metro。
npm start - Vega:构建并安装 Debug 版 (
.vpkg),执行vega device install-app -p <path>,执行npm start,然后执行vega device start-port-forwarding --port 8081 --forward false。确认vega device launch-app -a <appId>显示http://localhost:8081/json/list目标;修改Hermes React Native文件后即可热重载。.tsx