Repository navigation
Feature Request: Google Cast Support via SharpCaster #39
Copy link
Copy link
Open
Description
I would like to propose adding support for browsing and controlling Google Cast devices within smoc. This would allow users to cast their music to speakers, TVs, and other Cast-enabled devices directly from the CLI.
High-Level Plan
- Device Discovery: Integrate
SharpCasterto discover devices on the local network. - Audio Service Implementation: Create a new
IAudioServiceimplementation (CastAudioService) that targets a selected Cast device. - Playback Service Implementation: Create a
CastPlaybackServicethat implementsIPlaybackServiceto control remote playback. - Local Stream Proxy: Since
smochandles audio asStreamobjects, implement a lightweight HTTP proxy to serve these streams to the Cast device. - UI Integration: Implement a command (e.g.,
:output) to list and select output devices via the command line interface.
Detailed Implementation Plan
1. Core Services
ICastDiscoveryService:Task<IEnumerable<Chromecast>> DiscoverDevicesAsync()- Uses
SharpCaster.DeviceFinder.
CastPlaybackService(implementsIPlaybackService):- Wraps
SharpCaster.ChromecastClientand itsMediaStatus. - Bridges
MediaStatusupdates toPositionChangedandPlaybackStateChangedevents. - Implements
Play(),Pause(),Stop(), andSeek()by calling the respectiveSharpCastermethods.
- Wraps
CastAudioService(implementsIAudioService):- Acts as the factory for
CastPlaybackService. - Manages the connection to the specific Chromecast device.
- Manages the lifecycle of a local
HttpListenerto proxy theStreamfromIStreamingClientto the Chromecast's required URL.
- Acts as the factory for
2. Streaming Proxy
- A
StreamProxyServicethat:- Listens on a random local port.
- Generates a transient URL (e.g.,
http://<local-ip>:<port>/stream/<guid>). - When the URL is requested, it pipes the
StreamfromIStreamingClientto the HTTP response. - This ensures that any
smocsupported stream (Subsonic, etc.) can be played on the Cast device even if the device doesn't have direct access to the source.
3. UI/UX Changes
- Implement a new command
:outputin the command bar. - Running
:outputwithout arguments lists available devices (Local, discovered Cast devices). - Running
:output <name>(with auto-completion support) switches the active output device. - Display the current output device in the status bar or playback info area.
- Update
StandardPlaybackQueueServiceto switch the underlyingIAudioServiceimplementation when a new device is selected via the command.
Dependencies
SharpCaster(NuGet) - Latest version (3.0.0)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
mrazza commentedon May 15, 2026
Give this a shot. Let's see what it looks like and how it works.
oca-agent commentedon May 24, 2026
Google Cast support has been fully implemented and submitted in PR #40 (#40). It includes device discovery via SharpCaster, dynamic playback/audio service switching, a local HTTP streaming proxy, and the UI command with tab completion. All reviews have been addressed and local tests pass successfully. Please review!