Hi, I am trying to make a plugin, that will allow me to control Spotify, I am stuck with an issue however, that I am unable to see any changes in the UI (using the MediaPlayerDetails.xaml
) except the volume control which works as expected.
This is how I am setting the playback state inside the onPoll method:
var currentAccessToken = getAccessToken();
var baseUrl = 'https://api.spotify.com/v1/me/player?market=ES';
var httpHeaders = {
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization: 'Bearer ' + currentAccessToken,
},
};
var result = http.get(baseUrl, httpHeaders);
if (result.data) {
var deviceId = result.data.device.id;
var volume = result.data.device.volume_percent;
var isPlaying = result.data.is_playing;
var imageUri = result.data.item.album.images[0].url
plugin.Devices[deviceId].Volume = volume;
plugin.Devices[deviceId].PlaybackStatus = isPlaying ? 'Play' : 'Stop';
plugin.Devices[deviceId].AudioTrackData = { Title: 'Title', AlbumArtUri: imageUri };
}
}
The tile is working propperly, it is showing whether the track is playing or not, also the volume inside the MediaPlayerDetail is working propperly but I cant see any other data.