cordova-plugin-nativeaudio icon indicating copy to clipboard operation
cordova-plugin-nativeaudio copied to clipboard

Sound is still on while silent switch on iOS

Open CLIDOapps opened this issue 8 years ago • 29 comments

Hi,

this is a great awesome plugin!

There is a small issue on iOS.

The silent switch (on iPhone) has no functions. The sound is still on. Just the volume buttons are working.

Is there a Javascript callback to detect changes by the silent switch to handle it selfs?

I use the Intel XDK for buildings.

Best regards from Germany DJAB1978

PS: Sry for the bad English :)

CLIDOapps avatar Apr 19 '16 07:04 CLIDOapps

Anything here? Seems that this is the new bug, version 3.0.2 from npm is OK.

Ajaxy avatar Jun 06 '16 14:06 Ajaxy

Seems that https://github.com/floatinghotpot/cordova-plugin-nativeaudio/commit/c72e147427bf49e5978d36f14330e28575313971 is the issue

Ajaxy avatar Jun 06 '16 15:06 Ajaxy

Same problem here. After installing version 3.0.2 the sounds are not playing at all though.

adekbadek avatar Jun 11 '16 11:06 adekbadek

same problem here

greneham avatar Jun 16 '16 12:06 greneham

using 3.0.2 does fix it for me, thanks @Ajaxy

greneham avatar Jun 16 '16 12:06 greneham

...actually, 3.0.2 has a couple of issues such as looped sounds dont stop playing, also not all of my sounds can play anymore since i switched to this version

greneham avatar Jun 16 '16 13:06 greneham

ok so this seems to fix it

  • clone this project to your local disk
  • open src/ios/NativeAudio.m
  • delete line 47 [session setCategory:AVAudioSessionCategoryPlayback error:nil];
  • add the plugin locally cordova plugin add ~/somelocation/cordova-plugin-nativeaudio

greneham avatar Jun 16 '16 16:06 greneham

@adekbadek android or ios?

Ajaxy avatar Jun 23 '16 17:06 Ajaxy

@Ajaxy iOS

adekbadek avatar Jun 23 '16 19:06 adekbadek

@adekbadek strange, works for me. Not on emulator though.

Ajaxy avatar Jun 23 '16 21:06 Ajaxy

Any update on this?

Ajaxy avatar Jul 25 '16 11:07 Ajaxy

Can we get an option to set the Audio Session Category instead of just having it default to AVAudioSessionCategoryPlayback? AVAudioSessionCategoryAmbient and AVAudioSessionCategorySoloAmbient would be useful as well.

adrian-quince avatar Aug 07 '16 06:08 adrian-quince

Someone solved this problem?

pavei avatar Dec 09 '16 21:12 pavei

I use different versions for iOS and Android and it's annoying :( сб, 10 дек. 2016 г. в 0:42, pavei [email protected]:

Someone solved this problem?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/floatinghotpot/cordova-plugin-nativeaudio/issues/82#issuecomment-266131324, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVzIQV9f2PJ4cDwk06Lqt2B3tqGTuRDks5rGcs7gaJpZM4IKa3O .

Ajaxy avatar Dec 12 '16 11:12 Ajaxy

@Ajaxy which version are you using on iOS?

pavei avatar Dec 12 '16 11:12 pavei

3.0.3

Ajaxy avatar Dec 12 '16 11:12 Ajaxy

Still not working on iOS 10 :(

pavei avatar Dec 12 '16 12:12 pavei

Hi, i also need to find a way to stop sounds playing when silent switch on iOS ( plugin v3.0.7 ), Anyone found one ?

geshub avatar Dec 12 '16 15:12 geshub

@geshub, I did the same steps that @greneham listed and now it's working for me on iOS 10.

petewall avatar Dec 16 '16 17:12 petewall

Would it be possible to commit @greneham code to the plugin ?

geshub avatar Jan 22 '17 23:01 geshub

@floatinghotpot Bump

msmfsd avatar Mar 15 '17 22:03 msmfsd

According to Apple API documentation, AVAudioSessionCategoryPlayback won't honor the silent switch. Replace it with AVAudioSessionCategoryAmbient, and the mute switch will do what you expect.

I've branched the plugin and it works for me. See https://github.com/MartinDomig/cordova-plugin-nativeaudio/commit/ba2e1240f41a825ba3e149d8da4f4aaa77499d8d

MartinDomig avatar Mar 25 '17 19:03 MartinDomig

A HUGE thanks to @MartinDomig for this fork. I have tested it on iPhone 6 w iOS 10 and it fixes both the following issues:

  • Sounds still playing when iPhone is on mute
  • Existing audio stopped on app init

Awesome work

msmfsd avatar Mar 30 '17 04:03 msmfsd

Could we merge the changes to the plugin ?

geshub avatar Apr 02 '17 09:04 geshub

I've just created a pull request - there isn't much more I can do. The maintainer of this repository would have to accept it.

https://github.com/floatinghotpot/cordova-plugin-nativeaudio/pull/123

MartinDomig avatar Apr 02 '17 11:04 MartinDomig

I think you should use the option MixWithOthers otherwise the muisc is ducked but not restored to it's original volume when starting the app

jvwelzen avatar Apr 06 '17 14:04 jvwelzen

I am trying to get an extra function in so that you can change the catagory what you want the player and other players are going to do but still not no succes

btw This is the first Phonegap plugin that I am working on

jvwelzen avatar Apr 06 '17 14:04 jvwelzen

Any update on this?

Ajaxy avatar Jul 25 '17 16:07 Ajaxy

Any update on this?

Ovilia avatar Dec 23 '18 06:12 Ovilia