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

Sonos.getTrack: track.albumArtURI.startsWith is not a function. #516

Open
michaelhthomas opened this issue Aug 28, 2021 · 0 comments · May be fixed by #525
Open

Sonos.getTrack: track.albumArtURI.startsWith is not a function. #516

michaelhthomas opened this issue Aug 28, 2021 · 0 comments · May be fixed by #525

Comments

@michaelhthomas
Copy link

Expected Behavior

Calling Sonos.getTrack() should return null for the album art if no album art is returned from Sonos, rather than causing an error.

Current Behavior

When calling Sonos.getTrack(), the following error is shown

UnhandledPromiseRejectionWarning: TypeError: track.albumArtURI.startsWith is not a function.

Possible Solution

The issue is most likely that track.albumArtURI is returning null or some non-string value, causing an exception, but I have not confirmed that to be the case. This issue only occurs about every other time I run the example code below, so it may be that the Sonos is not returning the proper response in time?

Sample code or executed example

const { DeviceDiscovery } = require('sonos')

// find one device
DeviceDiscovery().once('DeviceAvailable', (device) => {
  console.log('found device at ' + device.host)
  device.currentTrack().then((response) => console.log(response))
})

Versions (and Environment)

Node version: 14.17.4
node-sonos version: 1.14.1
OS: Linux

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

Successfully merging a pull request may close this issue.

1 participant