Open untitledlt opened 6 years ago
It seems that when joining an already existing app (instead of launching it) the current session isn't registered.
This happened to me once and I solved it by calling the app.getStatus()
first. You can even check if the variable is undefined to avoid calling getStatus()
unnecessarily. Try and see if this fixes it.
client.getSessions(function(err, sessions) {
const session = sessions[0];
client.join(session, DefaultMediaReceiver, function(err, app) {
if (!app.media.currentSession){
app.getStatus(function() {
app.pause();
});
} else {
app.pause();
}
});
});
});
Here's my code
And it causes this error:
I can read app status with
app.on('status', () => {})
so i guess connection is fine. Tried while playing Spotify and Google Play Music.Do I need to set
currentSession
myself or is it a bug? Any easy fixes for it?