ionic-audio icon indicating copy to clipboard operation
ionic-audio copied to clipboard

Ionic 2 version: Audio pauses when device goes to standby / app is in background

Open martin-eberle opened this issue 10 years ago • 9 comments

On Android the audio track keeps playing even if the device is going to standby or the Ionic App is in background. This behaviour is expected and as far as i remember, it was the same for the Ionic 1 version on Android and iOS as well.

The Ionic 2 version keeps playing on Android but on iOS it will pause the track and start it again, when the device is turned on and unlocked again or the app is in foreground again.

martin-eberle avatar Nov 21 '16 16:11 martin-eberle

@marteb Interesting... i would have to test on iOS. I develop on Windows but I can run a VM with OS X to deploy on iOS. I will try to find time to fix this. What I remember is that I needed to enable background audio on xcode for it to work. Have you done that?

arielfaur avatar Dec 14 '16 22:12 arielfaur

That’s a good hint i could have found by myself :) Will try this later and give you feedback…

martin-eberle avatar Dec 15 '16 06:12 martin-eberle

Unfortunately enabling the setting „Background Modes: Audio“ in Xcode doesn’t fix this.

martin-eberle avatar Dec 15 '16 10:12 martin-eberle

@marteb Do you know if it uses native or html5 audio in your case? I have same issue and was thinking about the possibility that it could be related to html5 audio

sjosen avatar Feb 01 '17 16:02 sjosen

@marteb I installed this plugin and background audio now works for me in iOS too https://github.com/EddyVerbruggen/cordova-plugin-backgroundaudio

sjosen avatar Feb 04 '17 13:02 sjosen

I have just upgraded the module to Ionic 2 final. There are some minor changes in the way the module is set up in the app.module.ts. I tested on Android so far. Updated docs: http://arielfaur.github.io/ionic-audio/2.0/index.html

arielfaur avatar Feb 11 '17 20:02 arielfaur

@marteb and @arielfaur the suggestion from @sjosen worked for me as well.

I installed this plugin and background audio now works for me in iOS too https://github.com/EddyVerbruggen/cordova-plugin-backgroundaudio

CesarOliveira avatar Feb 17 '17 14:02 CesarOliveira

Does this work now? Background audio plugin seemed to have done the trick? Can we close this issue?

tbergeron avatar May 30 '17 16:05 tbergeron

I have this same issue in my ionic 1 app keeps playing on Android but on iOS it will pause the track and start it again, when the device is turned on and unlocked again Can you please help me with a solution

jayantrajwani avatar Sep 21 '17 14:09 jayantrajwani