avaudiosession

AVAudioSessionManager availableInputs “Unknown selected data source for port iPhone Microphone”

十年热恋 提交于 2019-12-21 06:50:12
问题 I've noticed this error in my console log for a while. Though it does not affect the execution of my application, I find it really annoying. Thus, I started to trace where this error came from. It turns out when I call availableInputs NSArray *inputs = [[AVAudioSession sharedInstance] availableInputs]; It will give me the log message: ERROR: [0x3d61318c] AVAudioSessionPortImpl.mm:50: ValidateRequiredFields: Unknown selected data source for Port iPhone Microphone (type: MicrophoneBuiltIn) I

AVAudioRecorder records only the audio after interruption

狂风中的少年 提交于 2019-12-21 04:44:06
问题 In my application for recording and playing audio using AVAudioRecorder and AVAudioPlayer I came across a scenario in the case of incoming phone call.While the recording is in progress and if the phone call comes,the audio recorded after the phone call is only recorded.I want the recording recorded after the phone call to be the continuation of the audio recorded before the phone call. I track the interruption occuring in audio recorder using the AVAudioRecorderDelegate methods (void

What's the difference among AVAudioSessionPortBluetoothHFP, A2DP and LE?

老子叫甜甜 提交于 2019-12-21 02:03:30
问题 There are three different Bluetooth related audio port types documented in Apple's AVAudioSessionPortDescription reference. But Apple doesn't explain much about these three types. Can somebody help explain more? 回答1: AVAudioSessionPortBluetoothHFP | Input and Output This is used when connected to a bluetooth devices through Hands-Free profile, like cars or earpieces. It can be accessed by setting your audio session category to AVAudioSessionCategoryPlayAndRecord and category option

AVAudioSessionCategoryPlayAndRecord with Airplay

£可爱£侵袭症+ 提交于 2019-12-20 10:22:10
问题 My app uses the microphone and outputs audio, so I am setting my Audio Session to the Play and Record Category, but this seems to disable Airplay. If I set the category to Play, Airplay works fine with my output (but obviously the input doesn't work). I've tried overriding the output route to speaker, in case it needed that to output over Airplay, but no joy. Any ideas? 回答1: What AirPlay device are you trying to use? Does it have a microphone? If not, iOS won't present it as an option when

Can we incorporate the Speech Recognition framework with Today Extension

青春壹個敷衍的年華 提交于 2019-12-20 03:09:42
问题 I am trying to build a widget which has a speech button. When I press it , it should convert the speech uttered to text. However when I try to record the voice , AVAudioEngine fails to start. Is it because AVAudioEngine is not allowed in Today Extension? 回答1: Searching the internet I seem to have found my answer. The short answer is no, you can't record Audio in extension. 来源: https://stackoverflow.com/questions/44365523/can-we-incorporate-the-speech-recognition-framework-with-today-extension

AVPlayer doesn't resume playback on endinterruption on iPhone but does so on iPad

社会主义新天地 提交于 2019-12-19 04:06:14
问题 I'm writing a radio app for both iPhone and iPad and am running into some weird behaviour when handling pausing and playing the audio with interruptions. I'm using the AVAudioSessionDelegate methods beginInterruption and endInterruption to respectively pause and play the AVPlayer. Below is the relevant play code. Now, the following situations seem to happen consistently: On iPad: If I force an interruption (Facetime call), beginInterruption is called as expected and playback stops. If the

AVAudioSession setCategory not working

有些话、适合烂在心里 提交于 2019-12-19 03:18:39
问题 I have a video capturing app and I want to be able to play background music while recording audio+video. I can accomplish this if I set the AVAudioSession category to PlayAndRecord in didFinishLaunchingWithOptions . However, this causes a glitch in the audio whenever the view with the camera enters or exits the foreground, and its apparently impossible to get rid of: https://forums.developer.apple.com/message/74778#74778 I can live with the glitch if it just happens when I start/stop

AVAudioRecorder averagePowerForChannel always returns -120.0

走远了吗. 提交于 2019-12-18 12:27:07
问题 I'm trying to use AVAudioRecorder's averagePowerForChannel method to monitor input levels on the microphone for an iPad/iPhone app. I have a callback which polls the average level in a loop — on the iPhone it works fine and returns sensible levels, but for some reason on the iPad it always returns -120.0. Here's some of my setup code: - (void) setupMic { if (micInput) { [micInput release]; micInput = nil; } NSURL *newURL = [[NSURL alloc] initFileURLWithPath:@"/dev/null"]; NSMutableDictionary

AVAudioSession Swift

拟墨画扇 提交于 2019-12-18 05:54:38
问题 I am trying to write a swift iOS app that will record the users voice. I have wrote the following code in swift however it fails to request mic permissions from the user. It prints granted yet it never records audio and in the settings pane under privacy it does not list the app. How do I request recording permissions in swift? var session: AVAudioSession = AVAudioSession.sharedInstance() session.requestRecordPermission({(granted: Bool)-> Void in if granted { println(" granted") session

iOS AVAudioSession interruption notification not working as expected

天大地大妈咪最大 提交于 2019-12-18 04:31:59
问题 I want to know when my AVAudioRecorder is inaccessible (e.g when music starts playing). As audioRecorderEndInterruption will be deprecated with iOS 9 I am focusing on AVAudioSession 's interruption notification (but neither is working as expected). The issue is that the interruption notification is never called if the app was and remains in the foreground when the interruption occurs. E.g: The user starts and stops playing music without moving the application into the background. To detect