PhoneGap plays sounds even though phone is on silent

967 views
Skip to first unread message

Adam Poncz

unread,
Oct 17, 2011, 11:52:10 AM10/17/11
to phon...@googlegroups.com
Has anyone else experienced the problem that an application will play a sound even though the phone is set to silent/vibrate mode?

--
Adam Poncz
678.723.4126

Simon MacDonald

unread,
Oct 17, 2011, 11:56:02 AM10/17/11
to phon...@googlegroups.com
Platform? Version? etc.

Simon Mac Donald
http://hi.im/simonmacdonald

> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
>

Adam Poncz

unread,
Oct 17, 2011, 12:00:16 PM10/17/11
to phon...@googlegroups.com
iOS 4.3.5 on both 3Gs and 4
--
Adam Poncz
678.723.4126

Adam Poncz

unread,
Oct 17, 2011, 12:05:55 PM10/17/11
to phon...@googlegroups.com
PhoneGap 1.1.0
--
Adam Poncz
678.723.4126

Jesse Macfadyen

unread,
Oct 17, 2011, 12:07:36 PM10/17/11
to phon...@googlegroups.com
On iPhone there are numerous policies that govern whether a sound is heard and/or if it interrupts already playing sounds. PhoneGap currently creates an audio session that disregards the the mute toggle, much like the YouTube app does. There is currently no workaround in phonegap and no way for you to query the state of the mute toggle. 


Cheers,
  Jesse

Sent from my iPhone5

Becka11y

unread,
Oct 17, 2011, 4:13:29 PM10/17/11
to phonegap
Yes, this was a change from 1.0 as many people complained about
playing NOT working when the phone was on mute.
-becky

On Oct 17, 12:07 pm, Jesse Macfadyen <jesse.macfad...@nitobi.com>
wrote:
> On iPhone there are numerous policies that govern whether a sound is heard
> and/or if it interrupts already playing sounds. PhoneGap currently creates
> an audio session that disregards the the mute toggle, much like the YouTube
> app does. There is currently no workaround in phonegap and no way for you to
> query the state of the mute toggle.
>
> Cheers,
>   Jesse
>
> Sent from my iPhone5
>
> On 2011-10-17, at 9:00 AM, Adam Poncz <apo...@gmail.com> wrote:
>
> iOS 4.3.5 on both 3Gs and 4
>
> On Mon, Oct 17, 2011 at 11:56 AM, Simon MacDonald <simon.macdon...@gmail.com
> For more options, visit this group athttp://groups.google.com/group/phonegap?hl=en?hl=en

Adam Poncz

unread,
Oct 17, 2011, 5:25:43 PM10/17/11
to phon...@googlegroups.com
Why would you want the sounds to play on a users device if they have their phone set to mute, people normally have it set to mute for a reason.  This doesn't seem congruent with what Apple stands-for or follow along with Google's "Do No Evil" motto.  At a minimum this should be a plist configuration option.

Is there a work around?



For more info on PhoneGap or to download the code go to www.phonegap.com



--
Adam Poncz
678.723.4126

Jesse MacFadyen

unread,
Oct 17, 2011, 6:53:07 PM10/17/11
to phon...@googlegroups.com
If sound is critical to your application then it should ignore the state of the mute switch.  All conditions are documented in Apple's docs and it is quite elaborate.  

Essentially, the mute switch is context sensitive, so if I have the phone muted, and open the music app, or garage-band, and select play, it will play ....
There are also some idiosyncrasies, like, unplugging the headphones pauses media playback ...

IMHO, the guidelines presented by Apple are a best-practice, and designed around providing the best experience to the user.  

Cheers,
  Jesse
--
Jesse MacFadyen
{
  blog:'blogs.nitobi.com/jesse',
  email:'jesse.m...@nitobi.com',
  company:
  {
    name:'Nitobi Software',
    site:'www.nitobi.com',
    phone:
    {
      office:'+1 (604) 685-9287',
      tollFree:'1-866-632-2777'
     }
  }
}

Alex Finlayson

unread,
Mar 15, 2012, 8:59:49 PM3/15/12
to phon...@googlegroups.com
A logical approach to this would be to add a flag, let the user decide which action they want. This bug is still broken imo. 

> > > For more options, visit this group at
> > >http://groups.google.com/group/phonegap?hl=en?hl=en
>
> > > For more info on PhoneGap or to download the code go towww.phonegap.com
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "phonegap" group.
> > To post to this group, send email to phon...@googlegroups.com
> > To unsubscribe from this group, send email to

> > For more options, visit this group at
> >http://groups.google.com/group/phonegap?hl=en?hl=en
>
> > For more info on PhoneGap or to download the code go towww.phonegap.com
>
> --
> Adam Poncz
> 678.723.4126
>
> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> For more options, visit this group athttp://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go towww.phonegap.com

--
You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en

For more info on PhoneGap or to download the code go to www.phonegap.com



--
Adam Poncz
678.723.4126

--
You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com



--
--
Jesse MacFadyen
{
  blog:'blogs.nitobi.com/jesse',

Alex Finlayson

unread,
Mar 19, 2012, 4:48:32 PM3/19/12
to phon...@googlegroups.com
I have a hack to get around this, and a fix that can go on top of 1.4.1

Where's the best place to put these?
Alex

zSprawl

unread,
Mar 24, 2012, 12:59:56 PM3/24/12
to phon...@googlegroups.com
github

Alex Finlayson

unread,
May 11, 2012, 3:29:46 PM5/11/12
to phon...@googlegroups.com
I just sent a pull request now.

If you want a quick fix for previous versions you can create a category on CDVSound for 

- (BOOL) prepareToPlay: (CDVAudioFile*) audioFile withId: (NSString*) mediaId

And copy in the source for whatever version you are using and set the AVSession category to what you want

I was using this to solve the sound playing while phone is in silent mode. 

 [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategorySoloAmbient error:nil];

This is definitely a compiler trick, and clang will complain that you shouldn't do this, but until my pull request is accepted, it's the best solution.

You can see my iOS Cordova branch on github here: https://github.com/afinlayson/incubator-cordova-ios


Reply all
Reply to author
Forward
0 new messages