bencevans / node-sonos

🔈 Sonos Media Player Interface/Client
https://www.npmjs.com/package/sonos
MIT License
702 stars 147 forks source link

togglePlayback's restrictive playback states limit restarting of radio stations #421

Closed AwesomeIndustry closed 5 years ago

AwesomeIndustry commented 5 years ago

The sonos.Sonos.togglePlayback() method "Currently only works for state playing or paused." However, would it be possible to have togglePlayback be able to restart a radio station (TuneIn/etc)? When a radio station is stopped, the transport state is also stopped, which is why I assume that togglePlayback() is refusing to restart the radio station due to the required playing or paused state. When I use play() radio restarts fine. Could you look into adding a special case for radio?

Expected Behavior

togglePlayback() should restart live radio (like Tunein)

Current Behavior

togglePlayback() refuses to restart radio because the current state is stopped

Possible Solution

Include a special case for Tunein radio (there may be other services affected; I'm not sure) to allow restarting of radio stations.

Sample code or executed example

  1. Initialise a Sonos object for a sonos speaker
  2. Play Tunein radio on the speaker (via mobile app)
  3. Run speaker.togglePlayback(). The radio should stop.
  4. Inspect speaker.getCurrentState(). It should be stopped.
  5. Run speaker.togglePlayback() again. This should not restart the radio station due to the current state being stopped.

Versions (and Environment)

Node version: v8.10.0 node-sonos version: ^1.11.1 OS: Ubuntu 18.04 LTS

bencevans commented 5 years ago

:tada: This issue has been resolved in version 1.12.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: