avaudiosession

Unable to switch to speaker output when bluetooth headsets are connected

风流意气都作罢 提交于 2019-11-28 11:49:21
I'm trying to allow for a toggle between bluetooth headsets (airpods in my case) and the phone speaker, using AVAudioSession . I initialize my session as so: AVAudioSessionCategoryOptions options = (AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionDefaultToSpeaker); NSError *error = nil; [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions:options error:&error]; Then I try to alternate between output modes as so: -(void)setIncomingSoundMode:(IncomingSoundMode)incomingSoundMode{ [self removeAudioRouteChangedObserver]; [NNLogger

How to change an iOS device volume programmatically?

ε祈祈猫儿з 提交于 2019-11-28 10:00:48
Is there a way to change the device volume programmatically? maybe using audio session? Steffen D. Sommer I'm pretty sure that it is not possible to control the actual device volume (as this would also be a bit obtrusive) Controlling some media you're playing is another thing. You could however look into MPVolumeView : https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPVolumeView_Class/index.html for displaying a view for setting the volume. The question has also been discussed here: How to change device Volume on iOS - not music volume Look at this: import

Receive remote control events without audio

落爺英雄遲暮 提交于 2019-11-28 08:36:39
Here is some background information, otherwise skip ahead to the question in bold. I am building an app and I would like it to have access to the remote control/lock screen events. The tricky part is that this app does not play audio itself, it controls the audio of another device nearby. The communication between devices is not a problem when the app is in the foreground. As I just found out, an app does not assume control of the remote controls until it has played audio with a playback audio session, and was the last do so. This presents a problem because like I said, the app controls

AVAudioSession's OutputVolume never changes

帅比萌擦擦* 提交于 2019-11-28 07:44:40
问题 There are plenty of questions and answers on SO that say [AVAudioSession sharedInstance].outputVolume is the only way to detect a device's volume. But it doesn't seem to work quite right. outputVolume never changes, though it is correct when it is first set (at application launch). Am I doing it wrong? I don't know what else to do besides reading the value of outputVolume . My instincts would tell me this was a bug, if it wasn't for the fact that other people seem to be doing it just fine. I

iOS check if application has access to microphone

為{幸葍}努か 提交于 2019-11-28 05:52:26
With the introduction of iOS 7, applications have to request microphone access when they want to record audio. How do I check if the application has access to the microphone? In the iOS 8 SDK I can use the AVAudioSessionRecordPermission enum, but how do I check this in iOS 7? Info: I don't want to request permission, I just want to check if the app has access to the microphone. (Like Location access): if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied) { // Do something } codester In iOS7 there is no way to get the current status of microphone authorization .They have

Detecting active AVAudioSessions on iOS device

China☆狼群 提交于 2019-11-28 03:35:36
I'm trying to figure out if this is possible - my app activates an audio session that is initialized as: [[[AVAudioSession alloc] init] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:&error]; I would like to be able to understand when an additional audio session that originated from another app or the OS is playing. I know about the ability to implement the delegate methods beginInterruption: and endInterruption but these won't get invoked because of the AVAudioSessionCategoryOptionMixWithOthers option I'm using. Is there a way to achieve

AVAudioRecorder/AVAudioSession with Apple Airpods

牧云@^-^@ 提交于 2019-11-28 01:08:45
问题 I see the question already asked here: AirPods not working as an input source for Voice Recorder App I've checked in with this thread but no response. But, does anyone know if/why AVAudioRecorder might not be able to use the AirPods as an input device for recording audio in an app? I have audio recording working through the builtin mics as well as with other BT devices (Beats, cheapo BT speaker phone thing, etc.) but when working with the AirPods I'm unable to capture the audio. In addition

Keep bluetooth sound when initializing AVAudioSession

人盡茶涼 提交于 2019-11-28 01:05:53
I'm about to go crazy. I have a recording app. I'm running into a problem that when I open my app, if i'm listening to music on a bluetooth device, it gets automatically routed back to the phone internal speaker. I want everything to stay the same no matter what. Even when I start recording, if the user is listening to something on a bluetooth speaker, keep doing that. The user has headphones? Keep the music there. Just leave everything as is. This is how I'm currently initializing my session: [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord withOptions

Hide Red Recording Status Bar In iOS App When Not Recording

半世苍凉 提交于 2019-11-28 00:45:50
I can't get the red "Recording" status bar to hide in my app when the app is in the background and not recording. I happen to be using The Amazing Audio Engine , but I think this question could be tackled knowledge of that library. It gets setup like this: audioController = [[AEAudioController alloc] initWithAudioDescription:desc inputEnabled:YES]; audioController.audioSessionCategory = kAudioSessionCategory_MediaPlayback; When the user wants to record, I turn on the mic like this: [audioController addInputReceiver:mic]; audioController.audioSessionCategory = kAudioSessionCategory

How to mute/unmute audio when playing video using MPMoviePlayerController?

孤街浪徒 提交于 2019-11-27 20:16:55
I've created my own custom controls for use with the MPMoviePlayerController . So far everything works except the mute button control. I've configured the AVAudioSession using the following code before I create my instance of the MPMoviePlayerController . NSError *modeError = nil; [self.audioSession setMode:AVAudioSessionModeMoviePlayback error:&modeError]; if (modeError != nil) { NSLog(@"Error setting mode for AVAudioSession: %@", modeError); } NSError *categoryError = nil; [self.audioSession setCategory:AVAudioSessionCategoryPlayback error:&categoryError]; if (categoryError != nil) { NSLog(@