2025.04 19.chromecasting push - SergeiGolos/wod-wiki GitHub Wiki

Findings

  • The current implementation lacks a standalone Chromecast receiver app; only a React component (CastReceiver.tsx) exists, which is not a real receiver.
    • Important: This will be done in another project, that will consume the useCastReciver coder we shold not need to implment this.
  • There is no clear separation between useCastSender, useCastReceiver, and useLocalCast hooks; only a sender-focused hook is present.
  • The Chromecast namespace is defined in multiple places and is inconsistent, which can break sender/receiver communication.
  • There is no observable-based event system for the receiver; sender logic is not fully decoupled from the UI.
  • Chromecast receiver lifecycle events (READY, SENDER_CONNECTED, etc.) are not fully handled, and error/debug logging is limited.
  • The implementation does not fully align with best practices from the Google Cast CAF v3 SDK, as outlined in the grounding document.

Summary

To achieve the desired architecture and robust Chromecast integration, we must:

  • Unify the namespace and protocol across sender/receiver.
  • Separate hooks for sender, receiver, and local dev/test logic.
  • Implement a real standalone receiver app per SDK best practices.
  • Ensure all communication uses observables and robust event handling.
  • Add comprehensive lifecycle and error/debug handling.

To Do

  • Unify Chromecast namespace in all files (#chromecast #future)
  • Refactor hooks: implement useCastSender, useCastReceiver, useLocalCast (#chromecast #future)
  • Decouple ChromecastButton to use only useCastSender (#chromecast #future)
  • Create standalone receiver app with proper SDK initialization and event handling (#chromecast #future)
  • Add debug/error logging and documentation (#chromecast #future)

Goals (Original)

  • 3 hooks useCastSender and useCastReceiver, useLocalCast
  • 1 component ChromecastButton that use useCastSender.

useCastSender should expose:

  • state$ : Observable
  • connect : start a connection
  • disconnect : send messges will not get sent anymore
  • sendMessage(event: ChromecastEvent) (if a connection is not there simply ingnore message that are sent.)

useCastReceiver should expose:

  • event$ : Observable

useLocalCast should expose:

  • event$ : Observable
  • state$ : Observable
  • sendMessage(event: ChromecastEvent)
  • assume always connected state with all the events that would be genearted by the useCaseReceiver.
⚠️ **GitHub.com Fallback** ⚠️