Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep player position when toggle switch on/off #13

Merged
merged 1 commit into from
Jan 17, 2017

Conversation

himynameisjonas
Copy link
Contributor

I'm not sure if this is by design or not. But I wanted the Sonos player toggle between play and pause instead of play and stop when using the switch in the Home app. So I can resume the track where i was when i turned the switch off.

@ebaauw
Copy link
Owner

ebaauw commented Jan 12, 2017

Thanks, Jonas, @himynameisjonas

Actually it's more by accident than by design. I implemented stop, it seemed to work and I never looked at it. I didn't even realise there was a pause command.

@leoneleone

Personally, I prefer turning a Sonos Speaker (HomeKit Switch- Characteristic.On) using Siri Commands and have that "Stop" rather than "Pause" the Sonos Speaker.

Why your preference for stop instead of pause?

I tested pause while playing Line-In, TuneIn Radio, TV, and Sonos Library Songs. The first two don't support pause and it seems to do exactly the same as stop: it changes the TransportState in the AVTransport service to STOPPED. For TV pause results in the same HTTP 500 response code as stop. For library songs, pause changes TransportState to PAUSED_PLAYBACK. The ZonePlayer actually closes its network connection to the music library server, just as on stop. On a subsequent play, playback resumes immediately, but it takes a while (until the next song is played?) before the network connection is re-established. On play after stop, the network connection is re-established immediately. It looks like pause causes the ZonePlayer to retain the playback buffer in memory (with the current playback position). Other than that, pause doesn't seem to consume more resources than stop.

@ebaauw ebaauw merged commit c7c83b3 into ebaauw:master Jan 17, 2017
@leoneleone
Copy link

@ebaauw
I could be wrong, but I believe Pause does not turn the Sonos speaker/room "off". I can still hear the electronic hum of the speakers being "on".
With Stop, the hum subsides. My preference is for Stop because of this reason.

Again, I'm not entirely sure. I'll double check once I'm back home.

@himynameisjonas
Copy link
Contributor Author

@leoneleone if that's the case, how do you turn it off using the Sonos app on iOS? I can only find a pause button in the app.

ebaauw added a commit that referenced this pull request Jan 21, 2017
Use pause instead of stop, so Sonos remembers last position in song.
@ebaauw
Copy link
Owner

ebaauw commented Jan 21, 2017

Just published v0.1.6 which includes this pull request.

@leoneleone please check if this works for you. Worst case, I could add a config.json parameter to choose between pause and stop.

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

Successfully merging this pull request may close these issues.

3 participants