How to implement Background Mode for Cordova Media Plugin Playlist on IOS

I have successfully implement a playlist feature for a Cordova Media plugin ( in my application .

However, on IOS, once the app screen is locked the current playlist item completes but it won’t move on to the next item .

I tried to use the cordova-plugin-background-mode but this didn’t solve my problem or I don’t know how to make it solve my issue.
Below is my code

PlayAllList(i, tracks: AudioFile[],surah) {
    var self = this;
    let fileDir = "";
      fileDir = this.file.externalDataDirectory
       fileDir = this.file.documentsDirectory.substr(7)
    this.Audiofile = + tracks[i].trackUrl);{playAudioWhenScreenIsLocked:true})
    this.Audiofile.onSuccess.subscribe(() => {
      if ((i + 1) == tracks.length) {
       this.Notplaying = true;
      this.Audiofile = undefined;
      } else {
        self.PlayAllList(i + 1, tracks,surah)


While things appears to work well on IOS. I got Background task expired while holding WebKit ProcessAssertion (isMainThread? 1). in IOS 13

I have been on this for days. any suggestion will be appreciated

You need to add in your AndroidXml…

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

I hope the help!


Thanks man. But I don’t have any issue with Android.