cordova-spotify-plugin
cordova-spotify-plugin copied to clipboard
No Events Firing
After calling createAudioPlayer with a working player (I can play and manipulate a queue) I can't get any events to fire. I've tried registering as follows:
var audioPlayer = spotify.createAudioPlayer(clientId);
audioPlayer.addEventListener(spotify.AudioPlayer.EVENT_LOGIN, function(message){
console.log('logged into player ' + message);
});
audioPlayer.addEventListener(spotify.AudioPlayer.EVENT_MESSAGE, function(message){
console.log('Got spotify message ' + message);
});
audioPlayer.addEventListener(spotify.AudioPlayer.EVENT_PLAYBACK_STATUS, function(status){
console.log('got playback status ' + status);
});
audioPlayer.addEventListener(spotify.AudioPlayer.EVENT_ERROR, function(error){
console.error(error);
});
audioPlayer.addEventListener('volumeChanged', function(error, value){
console.log('volumeChanged')
});
audioPlayer.addEventListener('skippedToNextTrack', function(error, value){
console.log('skippedToNextTrack')
});
audioPlayer.addEventListener('skippedToPreviousTrack', function(error, value){
console.log('skippedToPreviousTrack')
});
None of these ever get fired but my music is playing after calling audioPlayer play on a playlist. Any suggestions as to what I'm doing wrong.
Oh and I'm calling login after I've added the event listeners.
I've been digging and it appears the events are making it to eventNotificationFromAudioPlayer
they just are not getting thrown back up into onEventCallback
. I'm wondering if the registration for the callbackID is valid.
I've added a branch on my repository at https://github.com/ambientBOX/cordova-spotify-plugin/tree/fix-event-callback that fixes this issue but I don't believe it's complete. Can you please review it, if it's good enough I'll submit as pull.
I'll have a look at this issue as soon as I have some time later this week. Great work on initiating the fix.
I believe I found a fix for this issue. I'll create a new release as soon as possible.