Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOS 5 No audio when playing a video with Silent mode on with a buzztouch app

I have done several apps with buzztouch for Iphone and Ipads, here is a free one as an example :

http://itunes.apple.com/us/app/lr-basics-free-edition/id497563707?mt=8

I do not know code very much, I have very little basics that is why I designed my app using Buzztouch, which by the way is amazing !

The only one problem that I have is that the default behavior when you play a video (which was most of my apps are doing, playing tutorials) and if the silent mode is on either on Ipad or Iphone, there is no audio, even thought the volume slider is active, given the impressions to users that there is a bug, and I got some bad reviews due to that, I have also people writing me about it. I Then tell them all they have to do is to turn off the silent mode and they the audio is back, works everytime, but in the meantime I get complaits !

So here is my questions, is there a simple way I can located in the Buzztouch generated code a property that can easely be changed so that when a video is played, audio stays, despiste the silent mode being active.

I actually checked 4 or 5 other Iphones similar applications including the default youtube apple app, the default is that the audio plays even if the silent mode is turn on, giving my customer the impression that my app is bugged.

I'm not a programmer so please but as simple as possible in your answer.

Tku so much for the help.

Serge

like image 881
photoserge Avatar asked Dec 01 '22 00:12

photoserge


2 Answers

What you are describing is the default behavior in iOS - when the ring/silent switch is in silent mode all audio from your app will be suppressed.

I don't know about implementing this from BuzzTouch, but here is a native solution I used to get around this for one of my apps that plays video:

MPMoviePlayerViewController *mpvc = [[MPMoviePlayerViewController alloc] initWithContentURL:myVidURL];

... set up player ...

// prevent mute switch from switching off audio from movie player
NSError *_error = nil;
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: &_error];

[self presentMoviePlayerViewControllerAnimated:mpvc];

You will also need to include the AVFoundation framework for this to work.

Here's the link where I first found this tip:

http://www.24100.net/2011/05/ignore-ringtone-mute-switch-during-mpmovieplayer-video-playback-ios/

like image 136
jonkroll Avatar answered Dec 03 '22 13:12

jonkroll


Right from documentation - iOS has 6 audio session categories out of that 3 affects the behavior of Slient switch:

AVAudioSessionCategoryAmbient or the equivalent kAudioSessionCategory_AmbientSound— Using this category, your audio is silenced by the Ring/Silent switch and when the screen locks. Used when we want our app audio with built-in app audio

AVAudioSessionCategorySoloAmbient or the equivalent kAudioSessionCategory_SoloAmbientSound—Use this category for an application whose audio you want silenced when the user switches the Ring/Silent switch to the “silent” position and when the screen locks. This is the default category

AVAudioSessionCategoryPlayback or the equivalent kAudioSessionCategory_MediaPlayback—Use this category for an application whose audio playback is of primary importance. Your audio plays even with the screen locked and with the Ring/Silent switch set to silent.

like image 24
indiantroy Avatar answered Dec 03 '22 13:12

indiantroy