homerours / cordova-music-controls-plugin

A Cordova plugin displaying music controls in notifications (cordova-plugin-music-controls)
MIT License
155 stars 186 forks source link

Controls are not firing #159

Open Kannan2020 opened 4 years ago

Kannan2020 commented 4 years ago

Control are not firing event all the time, it is fairing one or twice after so many time of try

thomassimko commented 4 years ago

+1

simontribus commented 4 years ago

You have to wait until the control is created:

const options: MusicControlsOptions = {
        track: sender.name,
        isPlaying: true,
        dismissable: true,
        hasPrev: false,
        hasNext: false,
        hasClose: true
      };
      this.musicControls.create(options).catch((e) => {
        console.log(e);
      }).then( () => {
        this.musicControls.subscribe().subscribe(action => {
          console.log(action);
        });
        this.musicControls.listen();
      });