alxhotel / chromecast-api

:tv: Chromecast Node.js module
MIT License
155 stars 49 forks source link

No IDLE state #76

Open cedrictailly opened 3 years ago

cedrictailly commented 3 years ago

Hi,

I had an issue on my side using status events, it seems there is no IDLE playerState at all, I debugged the code and add a temporary fix in the file lib/device.js at line 46 :

    // TODO: might be useful for callback?
    this.client.on('error', (err) => {
      debug('Error: %s', err.message)
      this.client.close()
    })

    this.client.on('status', status => {
      if ( !status.applications )
        this.emit('status', { playerState: 'IDLE' });
    });

    debug('Connecting to device: ' + this.host)

If you have a better one I'm very interested.

Thanks in advance...