PlaySystemSound with mute switch on

Posted by Sam V on Stack Overflow See other posts from Stack Overflow or by Sam V
Published on 2010-06-17T02:18:16Z Indexed on 2010/06/17 2:22 UTC
Read the original article Hit count: 350

Filed under:
|
|
|

I know, I have to set the AudioSession to the 'playback' category, which allows audio even when the mute switch is on. This is what I do, but sound still gets muted when switch is on.

UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory,sizeof(sessionCategory), &sessionCategory);

SystemSoundID soundID;
NSString *path = [[NSBundle mainBundle] pathForResource:soundString ofType:@"wav"];    

AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:path],&soundID);
AudioServicesPlaySystemSound (soundID);

© Stack Overflow or respective owner

Related posts about iphone

Related posts about audio