jishi / node-sonos-discovery

Simplified framework for Sonos built on node.js
MIT License
146 stars 75 forks source link

Unable to get state of player #115

Open ryjohnson opened 4 years ago

ryjohnson commented 4 years ago

Everything was working great up until yesterday. Now whenever I play a track through Spotify (Sonos App, AirPlay, Spotify Connect), I can't get the current state of the player (play/pause, current track, etc). Looking at the avTransportUriMetadata, for some reason, it keeps thinking I'm using line-in.

'<DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="spotify" parentID="0" restricted="false"><dc:title>Spotify</dc:title>**<upnp:class>object.item.audioItem.linein</upnp:class>**<res protocolInfo="x-sonos-vli:*:audio:*">x-sonos-vli:RINCON_347E5C0EE19701400:2,spotify:5e9de992040a26982081102f3cf2b1b0</res><vli cookie="1" group=""></vli></item></DIDL-Lite>'
const SonosDiscovery = require('sonos-discovery');

const settings = {
  port: 1234,
  cacheDir: './cache',
};

const discovery = new SonosDiscovery(settings);

discovery.on('initialized', function(data) {
  console.log('EVENT: initialized');
});

discovery.on('topology-change', function(data) {
  console.log('EVENT: topology-change');
});

discovery.on('transport-state', function(data) {
  console.log('EVENT: transport-state');
  console.log(discovery.zones);
});