PlayBridge Extension
Establish ownership
- Work from
extension/; source lives primarily underextension/src/and is built with TypeScript and esbuild. - Shared pure detection logic lives in
extension/src/core/(media-candidate, synthetic-hls, hls-parser). Desktop store hosts and the phone GeckoView detector both import it. - Desktop hosts:
src/background.ts,src/content.ts, popup →dist/firefox/dist/chrome. - Phone host:
src/geckoview/*→dist/geckoview, copied on build intomobile/android/app/src/main/assets/extensions/video_detector/. - Modify source and manifests rather than hand-editing generated
dist/or Android asset JS. - Load
playbridge-desktop-proxywhen native messaging, Desktop discovery, reconnection, or proxy routing changes. - Load
playbridge-protocolwhen message envelopes, payloads, pairing, or authentication change. - Load
playbridge-androidwhen KotlinVideoDetector/ cast consumption ofplaylistBody/audioUrlchanges. - The GeckoView page API lives in
src/geckoview/page-bridge.ts,page-cast.tsandbackground.ts. Read rootdocs/bridged-apps.mdforplay(), destination selection, and linked queues; coordinate contract changes with the Android host and Apple page API. Companion apps live in the separatebridged-appsrepo.
Work safely
- Follow the root
AGENTS.mdand preserve Chrome/Firefox target compatibility. - Keep content-script, page, popup, background, and native-host trust boundaries explicit.
- Validate origins, frame identity, lifecycle state, and externally supplied media metadata before acting on them.
- Never log pairing credentials, authenticated headers, cookies, or complete protected stream URLs.
- Keep the lightweight page API available while bridged-site detection is off. Detection policy changes must stop disabled DOM observers, probes and body scanners and reject late results; page/document generations fence both detector and linked-session messages. Preserve the background's linked-session heartbeat and cancellation cleanup.
Verify
From extension/:
pnpm typecheck
pnpm test
pnpm build
For store or manifest work, also run the relevant store validation or the complete check:
pnpm store:check