cordova-spotify-plugin icon indicating copy to clipboard operation
cordova-spotify-plugin copied to clipboard

No Events Firing

Open paullryan opened this issue 9 years ago • 5 comments

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.

paullryan avatar Jun 09 '15 21:06 paullryan

Oh and I'm calling login after I've added the event listeners.

paullryan avatar Jun 09 '15 21:06 paullryan

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.

paullryan avatar Jun 09 '15 22:06 paullryan

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.

paullryan avatar Jun 10 '15 04:06 paullryan

I'll have a look at this issue as soon as I have some time later this week. Great work on initiating the fix.

timflapper avatar Jun 10 '15 14:06 timflapper

I believe I found a fix for this issue. I'll create a new release as soon as possible.

timflapper avatar Jul 14 '15 07:07 timflapper