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

Audio play even when phone sound is set to MUTE

Open FrancescoMussi opened this issue 7 years ago • 7 comments

I am using the plugin inside my ionic app. The sound plays correctly.

The problem is that when the sound setting in the phone is set to MUTE - It plays anyway.

The Vibration plugin for example don't start if the settings are on MUTE.

Do you think it can be fixed in the plugin?

Thanks!

FrancescoMussi avatar Jul 04 '17 08:07 FrancescoMussi

This is for anyone else who has this issue. Here is how I fixed it.

In NativeAudio.m line 10 replace #import <AVFoundation/AVAudioSession.h> with #import <AVFoundation/AVFoundation.h>

Line 48 replace [session setCategory:AVAudioSessionCategoryPlayback error:nil]; with [session setCategory:AVAudioSessionCategoryAmbient error:nil];

This worked perfect for me. You can also remove line 32 to prevent a depreciation warning.

timbo1437 avatar Sep 09 '17 03:09 timbo1437

When can be expect this issue to be fixed? This is happening in the Android as well

sagrawal31 avatar Sep 03 '18 07:09 sagrawal31

This is for anyone else who has this issue. Here is how I fixed it.

In NativeAudio.m line 10 replace #import <AVFoundation/AVAudioSession.h> with #import <AVFoundation/AVFoundation.h>

Line 48 replace [session setCategory:AVAudioSessionCategoryPlayback error:nil]; with [session setCategory:AVAudioSessionCategoryAmbient error:nil];

This worked perfect for me. You can also remove line 32 to prevent a depreciation warning.

Hello,

I have tried this, but still no sound when in silent mode :(

carmelo42 avatar Oct 07 '18 17:10 carmelo42

We are now maintaining a forked version wizpanda/cordova-plugin-nativeaudio of this plugin which fixes this issue.

sagrawal31 avatar Apr 04 '19 13:04 sagrawal31

@sagrawal31 does you fork also have a fix for Android?

soulfly avatar Nov 20 '19 16:11 soulfly

Yes @soulfly our fork fixes this issue for Android

sagrawal31 avatar Nov 30 '19 10:11 sagrawal31

Yes @soulfly our fork fixes this issue for Android

@sagrawal31 tried your fork but I'm still getting sound when my device is in mute or vibrate (Android)

geshub avatar Nov 30 '19 17:11 geshub