avaudiosession

Stop Background audio while starting

こ雲淡風輕ζ 提交于 2019-12-02 07:24:58
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? 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 set your audio session to a non-mixable category and mode then set active. If you don't configure an audio

AVAudioSessionInterruptionNotification not fired when Video/Camera is used

泄露秘密 提交于 2019-12-02 05:32:42
I have some SIP application. Until I've used audio only evrything was working correctly, I was receiving AVAudioSessionInterruptionNotification when it was necessary. Problem appeared when video was used (receiving and sending camera feed). Once I use session with video, notification is never fired again, even if later audio is used only. How can I fix that? I've found similar topic , but answer is to prompt and I don't fully get it. Also I do not have "camera/capture device" and "AVCaptureSession" since audio and video streaming is provided by closed third party library, but my code have to

AVAudioSession endInterruption() returns an NSOSStatusErrorDomain

那年仲夏 提交于 2019-12-02 05:28:07
问题 I'm trying to solve an AVAudioSession problem since many hours ago and didn't get success!! I found lots of guys talking about problems with endInterruption but none of them talking about this error: Unable to reactivate the audio session after the interruption ended: Error Domain=NSOSStatusErrorDomain Code=560161140 "The operation couldn’t be completed. (OSStatus error 560161140.)" I tried converting this code to ASCII to check the Audio Code Results, but there is nothing related to this

AVAudioSession : Playing audio through earpiece speaker

三世轮回 提交于 2019-12-02 04:24:31
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:AVAudioSessionCategoryPlayAndRecord error:&error]; [session setActive: YES error:nil];

Switching avaudiosession categories then retaking control of remote control center controls

三世轮回 提交于 2019-12-02 02:32:43
This is my first post asking a question as i never usually need help but i can't figure out if this is even possible. What i need is to switch between these two categories of avaudiosession and when the switch is made from mixing allowed to no mixing for the app take back control of the remote controls in the control center. [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil] and [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:nil error:nil] Ill try explain what is

AVAudioSession endInterruption() returns an NSOSStatusErrorDomain

泪湿孤枕 提交于 2019-12-02 02:06:05
I'm trying to solve an AVAudioSession problem since many hours ago and didn't get success!! I found lots of guys talking about problems with endInterruption but none of them talking about this error: Unable to reactivate the audio session after the interruption ended: Error Domain=NSOSStatusErrorDomain Code=560161140 "The operation couldn’t be completed. (OSStatus error 560161140.)" I tried converting this code to ASCII to check the Audio Code Results, but there is nothing related to this number. My code to init the session: - (void) setupAudioSession { mySession = [AVAudioSession

AVAudioSession's PlayAndRecord category and AVAudioSessionModeMeasurement are incompatible with defaultToSpeaker option?

独自空忆成欢 提交于 2019-12-01 18:16:09
问题 Attempting to put AVAudioSession into the .playAndRecord category with the AVAudioSessionModeMeasurement mode causes the .defaultToSpeaker option to be ignored, resulting in output being played quietly out the earpiece (also known as the receiver). 回答1: While there doesn't seem to be much written about this the documentation makes this "end result of audio output being sent to the receiver rather than speaker" seem like possible intended behavior and not a bug. let

Spritekit stopping sound

只愿长相守 提交于 2019-12-01 17:54:00
问题 I'm currently developing a game using Apple's SpriteKit library but I'm unable to stop a sound after is has began playing. I have tried using the listed methods from the documentation in order to stop the Skaction from running but nothing seems to stop the sound from playing. These have been my attempts of trying to stop the sound. //Playing sound action: SKAction *music = [SKAction playSoundFileNamed:@"menu.wav" waitForCompletion:YES]; [musicNode runAction:[SKAction repeatActionForever:

AudioSession input from bluetooth output to line out or speaker

风格不统一 提交于 2019-12-01 11:24:22
Once an audio session has been set up the following code allows bluetooth input. UInt32 allowBluetoothInput = 1; AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryEnableBluetoothInput, sizeof (allowBluetoothInput), &allowBluetoothInput); This code looks like it only allows bluetooth input however this code also routes the audio output to the bluetooth device (in the case of a bluetooth headset). I would like to route the audio output out of the line out or speaker when the input is coming from a bluetooth device. I just want to get audio input from a bluetooth device, I do not

this app was developed and works fine under ios 5.0, but crashes under ios 4.3

三世轮回 提交于 2019-12-01 09:23:41
I developed an iPhone app under iOS 5.0, and it works fine. But when it comes to iOS 4.3(Base SDK = latest iOS 5.0, compiler = Apple LLVM 3.0, Deployment Target = iOS 4.3), it crashes after launching. The output around crash point looks like: 2011-12-06 16:25:08.177 FMWei[466:c203] -[AVAudioSession setMode:error:]: unrecognized selector sent to instance 0x706a7f0 2011-12-06 16:25:08.181 FMWei[466:c203] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AVAudioSession setMode:error:]: unrecognized selector sent to instance 0x706a7f0' It looks like that