Closed fabdrol closed 4 years ago
:tada: This issue has been resolved in version 1.12.5 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
If you specify the spotify track without the query string, it just works. I also changed the sample (with your song!!)
I'm still having trouble with this. Calling device.play( uri ) results in subsequent calls to device.currentTrack() returns the below. I've tried removing the querystring also but that just plays the first track in the album.
All thoughts welcome, thanks
{
id: null,
parentID: null,
title: null,
artist: null,
album: null,
albumArtist: null,
albumArtURI: null,
uri: 'x-sonos-spotify:spotify%3atrack%3a3Fa3zWAeTGC1urAGjZxDX7?sid=9&flags=8224&sn=1',
duration: 0,
queuePosition: 12
}
Albums have to be added to the queue.
For the rest, just remove the query string and you should be good to go.
The album is in the queue; I'm getting the uri from a track that's in the return from device.getQueue().
By way of clarification, with an album queued and playing:
import { Sonos } from 'sonos'
const device = new Sonos( ipAddressOfDevice );
device.getQueue() .then( queue => {
// console.log( "Queue", queue )
const firstTrack = queue.items[0];
// console.log( "Track", firstTrack )
device.currentTrack().then( currentTrack => {
console.log( "CurrentTrack Before device.play()", currentTrack )
device.play( firstTrack.uri ).then( () => {
device.currentTrack().then( currentTrack => {
console.log( "CurrentTrack after device.play", currentTrack )
})
})
})
})
Gives the following output:
CurrentTrack Before device.play() {
id: null,
parentID: null,
title: 'Spirit Power and Soul',
artist: 'Johnny Marr',
album: 'Fever Dreams Pts 1 - 4',
albumArtist: null,
albumArtURI: '/getaa?s=1&u=x-sonos-spotify%3aspotify%253atrack%253a6OivYrVu0KrssrUuy3GUr6%3fsid%3d9%26flags%3d8224%26sn%3d1',
position: 11,
duration: 278,
albumArtURL: 'http://192.168.1.68:1400/getaa?s=1&u=x-sonos-spotify%3aspotify%253atrack%253a6OivYrVu0KrssrUuy3GUr6%3fsid%3d9%26flags%3d8224%26sn%3d1',
uri: 'x-sonos-spotify:spotify%3atrack%3a6OivYrVu0KrssrUuy3GUr6?sid=9&flags=8224&sn=1',
queuePosition: 1
}
13:21:28.515 CurrentTrack after device.play {
id: null,
parentID: null,
title: null,
artist: null,
album: null,
albumArtist: null,
albumArtURI: null,
position: 0,
duration: 0,
albumArtURL: null,
uri: 'x-sonos-spotify:spotify%3atrack%3a6OivYrVu0KrssrUuy3GUr6?sid=9&flags=8224&sn=1',
queuePosition: 17
}
The trach uri that you get back is from the speaker. Those cannot yet be used to start playback.
Some urls are mapped to guess the required metadata.
You'll see sonos:track:...
mapped here for instance.
got it. Many thanks.
When I attempt to
play
a track using a spotify track URN (e.g.spotify:track:6sYJuVcEu4gFHmeTLdHzRz?sid=9&flags=8224&sn=1
), allcurrentTrack
data disappears. The track URN is shown in the title instead.Expected Behavior
I'd expect the currentTrack data to be updated according to the new playing track
Current Behavior
No track meta data is visible in
currentTrack
. The URN is set as the title instead.Sample code or executed example
Versions (and Environment)
Node version: 8.12.0 node-sonos version: ^1.12.4 OS: MacOS