cordova-music-controls-plugin: play pause toggle not working

I’ve tried two ways (on android), i guess im just missing something simple :

`            
            case 'music-controls-pause':
                angular.element(document.getElementById('cont')).scope().playBtn().$apply();
                MusicControls.updateIsPlaying(true);
                console.log("pause");
           
                break;

                case 'music-controls-play':
                    angular.element(document.getElementById('cont')).scope().playBtn().$apply();
                    MusicControls.updateIsPlaying(false);///(or this?)//// isPlaying: false,
                    console.log("pause");

                    break;

and other way :

`               case 'music-controls-media-button-play-pause':
                    angular.element(document.getElementById('cont')).scope().playBtn().$apply();
                    if (MusicControls.updateIsPlaying(false)) {
                        MusicControls.updateIsPlaying(true);///(or this?)//// isPlaying: true,
                    }
                    else {
                        MusicControls.updateIsPlaying(false);
                    }
                    break;`

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 16 (1 by maintainers)

Most upvoted comments

I have the same issue here on iOS: ` this.musicControls.subscribe().subscribe(action => {

    function events(action) {
      const message = JSON.parse(action).message;
      switch(message) {
        case 'music-controls-pause':
          this.pause();
          break;
        case 'music-controls-play':
          this.play();
          break;
        default:
          break;
      }
    }

}); `

When the phone is locked and I click in pause nothing happens, any thoughts?