Skip to content

feat(cast): add Google Cast support and :output command#40

Open
oca-agent wants to merge 8 commits into
mainfrom
feat/cast-integration-v2
Open

feat(cast): add Google Cast support and :output command#40
oca-agent wants to merge 8 commits into
mainfrom
feat/cast-integration-v2

Conversation

@oca-agent
Copy link
Copy Markdown
Collaborator

@oca-agent oca-agent commented May 15, 2026

Summary of Changes

Implemented Google Cast support for Smoc, enabling users to cast music to Cast-enabled devices.

Core Features

  • SharpCaster v3.0.0 Upgrade: Upgraded to the latest version of SharpCaster, utilizing its modern async/await APIs and Native AOT compatibility.
  • Device Discovery: Added CastDiscoveryService to discover Chromecast devices on the local network using mDNS via ChromecastLocator.
  • Remote Playback: Implemented CastAudioService and CastPlaybackService to control playback on remote devices.
  • Testable Architecture: Introduced IChromecastClient and ChromecastClientWrapper to allow for robust unit testing of Cast services via mocking.
  • Streaming Proxy: Built a StreamingProxyService to bridge Smoc's internal audio streams to Chromecast using a local HTTP listener.
  • Output Management: Added a new :output command to switch between local and remote playback.
  • Tab Completion: Enhanced the command line with tab-completion support for commands and arguments (e.g., :output [tab]).

Technical Details

  • Refactored playback logic to handle Sharpcaster.Models.Media.MediaStatus updates and map them to Smoc's internal PlaybackState.
  • Updated StandardPlaybackQueueService to support dynamic audio service switching without losing queue state.
  • Improved CommandService with a plugin-based completion architecture.

Test Coverage

Added unit tests for all major new components:

  • StreamingProxyServiceTest: Verifies the local HTTP streaming proxy functionality.
  • CastAudioServiceTest: Tests the creation of playback services and proxy integration using mocked client.
  • CastPlaybackServiceTest: Validates state management (Play/Pause/Stop) for remote playback using mocked client.
  • CommandServiceTest: Added coverage for the new tab-completion logic.
  • CommandLineTest: Verified UI-level tab-completion handling.
  • StandardPlaybackQueueServiceTest: Verified the seamless audio service switching logic.

Resolves #39

@oca-agent oca-agent requested a review from mrazza May 15, 2026 02:42
@oca-agent oca-agent self-assigned this May 15, 2026
@mrazza
Copy link
Copy Markdown
Owner

mrazza commented May 15, 2026

This should use the latest version of SharpCaster.

public PlaybackState PlaybackState => _state;
public Song Song => _song;

public async void Play() {
Copy link
Copy Markdown
Owner

@mrazza mrazza May 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These methods are not async in the underlying interface breaking assumptions about ordering. Functions where we call Stop() then Play() may execute in the wrong order.

Copy link
Copy Markdown
Owner

@mrazza mrazza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

XML doc comments are required on all public classes and public methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Google Cast Support via SharpCaster

2 participants