Plan: Spotify Integration for SMoC
1. Product Requirements
Background & Relevance
Spotify is the world's most popular streaming service. While it is the most difficult to integrate due to its lack of direct audio stream access via the Web API, it is the most requested feature for any music player.
Feature Scope
- Full Catalog Access: Search and play any song on Spotify.
- Librespot Integration: Use the
librespot open-source protocol to function as a "Spotify Connect" device.
- Authentication: Support for Spotify Premium accounts (required by librespot).
2. Technical Implementation Plan
Architecture Overview
Unlike other providers, Spotify cannot be implemented via simple REST calls for playback. The SpotifyStreamingClient will act as a bridge to a Librespot-DotNet instance.
Proposed Code Changes
1. Configuration (Smoc.Configuration)
- Create
SpotifyConfig.cs:
Username / Password: Required for Librespot authentication.
CacheDirectory: For Spotify's encrypted blob cache.
2. Streaming Client (Smoc.Streaming.Spotify)
SpotifyStreamingClient.cs:
- Implement
IStreamingClient.
- Metadata: Use the official Spotify Web API for searching and entity lookups (faster and better documented).
- Playback:
GetSongStreamAsync will trigger Librespot to fetch the track and provide the PCM/Ogg stream.
- Challenge: Librespot usually outputs directly to a sound device. SMoC will need to configure it to output to a
PipeStream or MemoryStream that SoundFlow can consume.
Libraries & Dependencies
- SpotifyAPI-NET: For Web API metadata and search.
- Librespot-DotNet: For the actual playback engine.
Implementation Milestones
- Web API Integration: Get search and metadata working first using Client Credentials.
- Librespot Service: Integrate the Librespot player into SMoC's service layer.
- Stream Redirection: Redirect Librespot's audio output into SMoC's
SoundFlow engine.
- Connect Support: Allow SMoC to appear as a "Spotify Connect" device in the official Spotify app.
3. Future Considerations
- Premium Requirement: Clear UI feedback that a Spotify Premium account is required for playback.
Plan: Spotify Integration for SMoC
1. Product Requirements
Background & Relevance
Spotify is the world's most popular streaming service. While it is the most difficult to integrate due to its lack of direct audio stream access via the Web API, it is the most requested feature for any music player.
Feature Scope
librespotopen-source protocol to function as a "Spotify Connect" device.2. Technical Implementation Plan
Architecture Overview
Unlike other providers, Spotify cannot be implemented via simple REST calls for playback. The
SpotifyStreamingClientwill act as a bridge to aLibrespot-DotNetinstance.Proposed Code Changes
1. Configuration (
Smoc.Configuration)SpotifyConfig.cs:Username/Password: Required for Librespot authentication.CacheDirectory: For Spotify's encrypted blob cache.2. Streaming Client (
Smoc.Streaming.Spotify)SpotifyStreamingClient.cs:IStreamingClient.GetSongStreamAsyncwill triggerLibrespotto fetch the track and provide the PCM/Ogg stream.PipeStreamorMemoryStreamthatSoundFlowcan consume.Libraries & Dependencies
Implementation Milestones
SoundFlowengine.3. Future Considerations