dispatchKeyEvent() intercepts DPAD/media keys and re-dispatches real
KeyEvents into the WebView per the design spec's mapping table:
- DPAD center / Play-Pause -> Space
- DPAD Left/Right tap -> Arrow (5s seek); held -> Shift+Arrow (30s
seek), throttled to ~1 event/200ms since Android's own key-repeat
rate would otherwise flood the room's sync socket
- DPAD Up/Down + media Prev/Next -> P/N (title change, not
ArrowUp/Down - those are explicit no-ops in the website's TV mode
since volume is TV/AVR-controlled)
- Back: room list -> no-op; in a room + fullscreen -> Escape
(browser exits fullscreen natively); in a room + not fullscreen ->
navigate to /tv (native WebView navigation, not a website reaction)
- Menu (KEYCODE_MENU) deliberately NOT intercepted - passed through
unchanged, matching the already-confirmed-working raw-browser test
Fullscreen state comes from WebChromeClient.onShowCustomView/
onHideCustomView (needed for HTML5 video fullscreen support anyway).
Current-page tracking comes from WebViewClient.onPageFinished.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LHgWjmEJXsJEi1EVAoTp4K