Skip to content

Transfer playback when changing device#408

Merged
Rigellute merged 1 commit into
Rigellute:masterfrom
TimotheeGerber:transfer_playback
Oct 21, 2020
Merged

Transfer playback when changing device#408
Rigellute merged 1 commit into
Rigellute:masterfrom
TimotheeGerber:transfer_playback

Conversation

@TimotheeGerber
Copy link
Copy Markdown
Contributor

Warning: This PR will not work before PR #90 in rspotify has been merged and a new version has been released. If you want to test it, you can clone my patched version of rspotify and ask cargo to use it instead of the one in crates.io by adding the following in your Cargo.toml:

[patch.crates-io]
rspotify = { path = "../relative/path/to/patched_rspotify" }

Currently, selecting another device changes the device in the internal representation but does not transfer playback to the selected device. This is counter intuitive and lead to strange situations.

Imagine I have 2 devices, receiver_1 and receiver_2, and I am currently playing a song on receiver_1. If I select receiver_2, receiver_1 continues to play the song. Nevertheless, commands (pause, next, previous, etc) are sent to receiver_2. So, a pause command will not pause the song because receiver_1 does not get the command. receiver_2 gets the command and cannot do anything with it.

This PR changes that behavior and transfer playback when selecting a device.

I hope that the modifications I have made are OK. Don't hesitate to comment them if needed!

Closes #366

Copy link
Copy Markdown
Owner

@Rigellute Rigellute left a comment

Choose a reason for hiding this comment

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

Good work @TimotheeGerber 👍 Thank you.

Will wait until rspotify has released and then will merge this.

Comment thread src/network.rs
}

async fn set_device_id_in_config(&mut self, device_id: String) {
async fn transfert_playback_to_device(&mut self, device_id: String) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Nice 👍

Comment thread README.md
| current_playback | Yes | Get Information About The User’s Current Playback | Yes |
| current_playing | No | Get the User’s Currently Playing Track | No |
| transfer_playback | No | Transfer a User’s Playback | No |
| transfer_playback | Yes | Transfer a User’s Playback | Yes |
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for updating this

@TimotheeGerber TimotheeGerber changed the title WIP: Transfer playback when changing device Transfer playback when changing device Oct 14, 2020
@TimotheeGerber
Copy link
Copy Markdown
Contributor Author

A new version of rspotify has been released this summer and spotify-tui already use it. This PR can now be integrated. It still works and will improve playback transfer for people using multiple receivers.

@Rigellute
Copy link
Copy Markdown
Owner

@TimotheeGerber awesome, thanks

@Rigellute Rigellute merged commit 00b1acd into Rigellute:master Oct 21, 2020
@TimotheeGerber TimotheeGerber deleted the transfer_playback branch October 21, 2020 09:32
lanej pushed a commit to lanej/spotify-tui that referenced this pull request Jul 13, 2021
nighi pushed a commit to nighi/spotify-tui that referenced this pull request Jul 11, 2025
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.

Cannot change device.

2 participants