avaudiosession

How to make MPMoviePlayerController ignore the mute switch

落爺英雄遲暮 提交于 2019-12-03 05:43:01
I want to play a video using MPMoviePlayerController but I want it to ignore the mute switch, similar to the behavior of Youtube's video player. Any ideas? Carl Veazey Use the AVAudioSession category AVAudioSessionCategoryPlayback and your app will ignore the mute switch like the Youtube app. For example (inspired by Ken Pletzer in the comments): #import <AVFoundation/AVFoundation.h> // note: you also need to add AVfoundation.framework to your project's // list of linked frameworks NSError *error = nil; BOOL success = [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback

Camera Freeze when open app while call is running

谁都会走 提交于 2019-12-03 03:25:29
I have created a camera using AVCaptureSession . I have configured that for both Photo and Video recording modes . Camera and App is running fine. Also I allowed background music play (If user play song using Music App in iPhone) while open camera or recording video. It is also working fine. (Attached image 2) I allowed background Music play with the help of this code AVAudioSession *session1 = [AVAudioSession sharedInstance]; [session1 setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:AVAudioSessionCategoryOptionMixWithOthers|AVAudioSessionCategoryOptionDefaultToSpeaker

Cocos2D 2.1: “Delegate” deprecated in iOS 6. How do I set the delegate for this AVAudioSession?

六眼飞鱼酱① 提交于 2019-12-03 03:15:32
Started a Cocos2D 2.1 template (with no physics engine) in Xcode 4.5, targeted for iOS 6 and iPad. In the CDAudioManager.m file, the following code... AVAudioSession* session = [AVAudioSession sharedInstance]; session.delegate = self; // Which is what is automatically generated by the template. ...generates the following warning... "delegate deprecated: first deprecated in iOS 6" So I go to the apple developer documentation, and it says under "delegate," "Deprecated in iOS 6.0. Use the notifications described in the Notifications section of this class instead." http://developer.apple.com

AVAudioRecorder - Proper MPEG4 AAC Recording Settings

江枫思渺然 提交于 2019-12-03 03:15:00
I've got a live app with an estimated 15% of users reporting that the record feature is not working. This isn't happening on our test devices, but the reports show that the problem is that prepareToRecord is returning NO. I've had trouble finding sample settings for AAC format. Are any of my settings off? App requires iOS5 and uses ARC. AVAudioSession *audioSession = [AVAudioSession sharedInstance]; [audioSession setCategory:AVAudioSessionCategoryRecord error:nil]; NSDictionary *recordSettings = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:kAudioFormatMPEG4AAC],

The Mute Button Won't Mute AVAudioPlayer

≡放荡痞女 提交于 2019-12-03 02:46:48
I need to loop play a .caf file in my iPhone app. The AVAudioPlayer looks promising. But there's one problem. It won't stop or mute even if I pressed the mute button on the iPhone. And I understand that there would be no way to programmatically find out whether that mute button is pressed or not in iOS 5. So, what I need to know might be some properties about AVAudioPlayer or AVAudioSession. Or, perhaps, I may need to consider other libraries to loop playing my .caf file. Any idea? I realized it was because I had this line of code [[AVAudioSession sharedInstance] setCategory:

iOS AudioUnits pass through

≯℡__Kan透↙ 提交于 2019-12-03 01:38:08
I am trying to write an iOS application that will pass the sound received from microphone to speaker without any changes. I've read apple docs and guides. I choosed the first pattern from this guide . But nothing happening - silence. As you can see I've tried to use the AUAudioGraph (commented) - same result (do I need it in this simple example at all?). I saw few examples in the internet where callbacks are used, but I do not want use any. Is it possible? Any suggestions? Thanks for attention. The actual code #import "AudioController.h" #import <AudioToolbox/AudioToolbox.h> #import

AVSpeechSynthesizer error AudioSession

£可爱£侵袭症+ 提交于 2019-12-03 01:38:02
I'm playing around with AVSpeechSynthesizer and always getting these errors: ERROR: >aqsrv> 65: Exception caught in (null) - error -66634 ERROR: AVAudioSessionUtilities.h:88: GetProperty_DefaultToZero: AudioSessionGetProperty ('disa') failed with error: '?ytp' My code is: AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc] init]; [synthesizer setDelegate:self]; speechSpeed = AVSpeechUtteranceMinimumSpeechRate; AVSpeechUtterance *synUtt = [[AVSpeechUtterance alloc] initWithString:[[self text] text]]; [synUtt setRate:speechSpeed]; [synUtt setVoice:[AVSpeechSynthesisVoice

AVAudioSession AVAudioSessionCategoryPlayAndRecord glitch

佐手、 提交于 2019-12-02 23:52:35
I would like to record videos with audio using AVCaptureSession . For this I need the AudioSessionCategory AVAudioSessionCategoryPlayAndRecord , since my app also plays back video with sound. I want audio to be audible from the default speaker and I want it to mix with other audio. So I need the options AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionMixWithOthers . If I do the following while other audio is playing there is a clear audible glitch in the audio from the other app: [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord

AVAudioSession : Playing audio through earpiece speaker

╄→尐↘猪︶ㄣ 提交于 2019-12-02 12:57:03
问题 I am trying to play an audio through earpiece speaker and it is working fine. The same code is not working in following situation. open camera to record a video Instead of start recording, cancel it Then, trying to play an audio through earpiece not working. It is playing through main speaker Here is my code to play audio through earpiece. -(void)initialAVaudioPlayer { if (player==nil) { NSError *error = nil; AVAudioSession *session = [AVAudioSession sharedInstance]; [session setCategory

Stop Background audio while starting

馋奶兔 提交于 2019-12-02 10:00:26
问题 I could make the application, to play the audio when it moves to the background, by adding the setting in info.plist file. But, when some other iOS application plays background audio, and when the current application comes to foreground, how to stop the background audio invoked by other application? 回答1: Have a look at AVAudioSession class and AVAudioSession programming guide by Apple. This will hopefully steer you in the right direction. To stop background audio when your application starts