Skip to content

Commit a3abb07

Browse files
committed
feat: Add audio/local to device capabilities
Spotify Connect does not allow you to move playback of a local file to the librespot device as it says that it "can't play this track". Note that this is slightly inconsistent as Spotify allows you to switch to a local file if librespot is already playing a non-local file, which currently fails with an error. However, it is possible for the desktop and iOS client to accept playback of local files. In looking at the PUT request sent to `connect-state/v1/devices/<id>` from the iOS client, it can be seen that it includes `audio/local` as an entry in the `supported_types` capability field. This commit introduces this field to the capabilities that librespot sends. For now, it is a complete lie as we do not support local file playback, but it will make the ongoing development of this feature easier, as we will not have to queue up a non-local track and attempt to switch to a local one. Testing shows that with this flag the "can't play this track" message disappears and allows librespot to (attempt) to play a local file before erroring out.
1 parent 61f517b commit a3abb07

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7070
- [connect] Add `pause` parameter to `Spirc::disconnect` method (breaking)
7171
- [connect] Add `volume_steps` to `ConnectConfig` (breaking)
7272
- [connect] Add and enforce rustdoc
73+
- [connect] Add `audio/local` to the `supported_types` field of the device capabilities.
7374
- [playback] Add `track` field to `PlayerEvent::RepeatChanged` (breaking)
7475
- [playback] Add `PlayerEvent::PositionChanged` event to notify about the current playback position
7576
- [core] Add `request_with_options` and `request_with_protobuf_and_options` to `SpClient`
7677
- [core] Add `try_get_urls` to `CdnUrl`
7778
- [oauth] Add `OAuthClient` and `OAuthClientBuilder` structs to achieve a more customizable login process
7879

80+
7981
### Fixed
8082

8183
- [test] Missing bindgen breaks crossbuild on recent runners. Now installing latest bindgen in addition.

connect/src/state.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,11 @@ impl ConnectState {
161161
supports_gzip_pushes: true,
162162
// todo: enable after logout handling is implemented, see spirc logout_request
163163
supports_logout: false,
164-
supported_types: vec!["audio/episode".into(), "audio/track".into()],
164+
supported_types: vec![
165+
"audio/episode".into(),
166+
"audio/track".into(),
167+
"audio/local".into(),
168+
],
165169
supports_playlist_v2: true,
166170
supports_transfer_command: true,
167171
supports_command_request: true,

0 commit comments

Comments
 (0)