how to play audio on screen lock/background mode

Viewed 825

im having issue with playing audio in ios device with my ionic 3 app.when i lock the device or moves to background the audio playing for 15 to 20 seconds and getting stopped. i tried with enabling background mode and settings in xcode.nothing is working

 platform.ready().then(() => {

      if (platform.is('cordova')){

        //Subscribe on pause i.e. background
        this.platform.pause.subscribe(() => {
          console.log("background");
          this.bg.enable();

        });

        //Subscribe on resume i.e. foreground
        this.platform.resume.subscribe(() => {
          console.log("foreground");
          this.bg.disable();

        });
      }
    });

this is how i'm doing the background enable in player.ts file.enter image description here this is xcode capabilites settings. this issue not producing in andorid

1 Answers
Related