nstudio / nativescript-audio

:microphone: NativeScript plugin to record and play audio :musical_note:
Other
149 stars 104 forks source link

Still playing in background #199

Open rotibi opened 1 year ago

rotibi commented 1 year ago

I use
"nativescript-audio": "6.2.6". "@nativescript/android": "8.4.0", "@nativescript/angular": "~15.0.0", Android 11 (API level 30).

const musicPlayer = new TNSPlayer();
musicPlayer.playFromFile({
                audioFile: filepath,
                loop: true,
                audioMixing: true,
                completeCallback: console.log,
                errorCallback: console.log
})
.then(() => {})
.catch(() => {});

Audio is still playing even if the power button is pressed, even if I switch to another app. I want to stop playing when app is loosing the focus and resume it again when come back to app. I spent a lot of time with this issue and no solution yet. I mention that I set debugger to true and no errors occurs. Am I miss something? I appreciate any help!

liamcharmer commented 1 year ago

Is this on Android or iOS? It seems on iOS for me the background gets paused.

rotibi commented 1 year ago

I'm using Android 8