Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function init() {
sonos.DeviceDiscovery(function (device) {
debug(`Found ZP at ${device.host}:${device.port}`);
thePlayer = device;
console.log(thePlayer.getName().then((name) => {
SonosWeb.menu.playerName = name;
}));
//thePlayer.selectQueue();
var listener = Listener;
listener.startListener();
listener.subscribeTo(device).then(result => {
console.log('Manually subscribed to sonos events')
})
// Or start listening for events on the sonos itself, will call the listener in the background
device.on('CurrentTrack', track => {
startPairing(_timeoutSeconds) {
this.deviceDiscovery = DeviceDiscovery({
timeout: _timeoutSeconds * 1000
}, (device) => {
this.addDevice(device).catch(console.warn);
});
}