avaudiosession

Unable to receive remoteControlReceivedWithEvent - objective c - ios

牧云@^-^@ 提交于 2020-01-20 06:16:24
问题 I successfully enabled my app to be able to play audio and video in background after the screen is locked. However, for better user experience I want to show play and pause controls of the running media on the locked screen. After following couple of blogs online, added the following code: @interface MyControllerClass () <UIGestureRecognizerDelegate, UIApplicationDelegate> - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [[UIApplication sharedApplication]

Unable to receive remoteControlReceivedWithEvent - objective c - ios

我的未来我决定 提交于 2020-01-20 06:13:37
问题 I successfully enabled my app to be able to play audio and video in background after the screen is locked. However, for better user experience I want to show play and pause controls of the running media on the locked screen. After following couple of blogs online, added the following code: @interface MyControllerClass () <UIGestureRecognizerDelegate, UIApplicationDelegate> - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [[UIApplication sharedApplication]

AudioQueue recording at 8 KHz, not calling Callback every 20 ms

这一生的挚爱 提交于 2020-01-16 08:46:28
问题 iOS 10+ iPhone: 5s & 6 Xcode: 9+ I'm recording audio using aLaw codec at 8 KHz samplerate with sample size 8 bits . I create an AudioQueue like this: // create the queue XThrowIfError(AudioQueueNewInput( &mRecordFormat, MyInputBufferHandler, this /* userData */, NULL /* run loop */, kCFRunLoopCommonModes /* run loop mode */, 0 /* flags */, &mQueue), "AudioQueueNewInput failed"); MyInputBufferHandler is the callback that is called every time a buffer (160 bytes every 20 ms) is filled. So I

duckOthers Audio Session Interrupted by Remote Push Notification

半世苍凉 提交于 2020-01-15 10:28:18
问题 I have a workout app that plays short clips of sound every couple of seconds. I have background music enabled so that music from other apps can be played while working out. The problem arises when I get a remote push notification (in my case, Slack) that has a sound, which somehow cancels out my duckingOther audio session and the music from other apps becomes loud again. Question - How do I reset my duckingOthers audiosession when the user gets this type of interruption? I set the audio

Using AVAudioRecorder on Mac

谁说我不能喝 提交于 2020-01-13 16:23:48
问题 The AVAudioRecorder Class Reference found here: https://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVAudioRecorder_ClassReference/Reference/Reference.html#//apple_ref/doc/uid/TP40008238 says that AVAudioSession can be used to configure the audio session To configure an appropriate audio session for recording, refer to AVAudioSession Class Reference and AVAudioSessionDelegate Protocol Reference. But the AVFoundation Framework lacks the AVAudioSession on OS X. So we

Play audio from AVAudioPCMBuffer with AVAudioEngine

与世无争的帅哥 提交于 2020-01-12 05:24:13
问题 I have two classes, MicrophoneHandler , and AudioPlayer . I have managed to use AVCaptureSession to tap microphone data using the approved answer here, and and converted the CMSampleBuffer to NSData using this function: func sendDataToDelegate(buffer: CMSampleBuffer!) { let block = CMSampleBufferGetDataBuffer(buffer) var length = 0 var data: UnsafeMutablePointer<Int8> = nil var status = CMBlockBufferGetDataPointer(block!, 0, nil, &length, &data) // TODO: check for errors let result = NSData

Play audio from AVAudioPCMBuffer with AVAudioEngine

こ雲淡風輕ζ 提交于 2020-01-12 05:24:07
问题 I have two classes, MicrophoneHandler , and AudioPlayer . I have managed to use AVCaptureSession to tap microphone data using the approved answer here, and and converted the CMSampleBuffer to NSData using this function: func sendDataToDelegate(buffer: CMSampleBuffer!) { let block = CMSampleBufferGetDataBuffer(buffer) var length = 0 var data: UnsafeMutablePointer<Int8> = nil var status = CMBlockBufferGetDataPointer(block!, 0, nil, &length, &data) // TODO: check for errors let result = NSData

Recording from Built-In Mic when Playing through Bluetooth in iOS

Deadly 提交于 2020-01-10 04:17:07
问题 Is it possible to receive audio input from iPhone's built-in microphone, and play that audio through a Bluetooth headset, at the same time? My goal is to always use the built-in microphone as the input device, even if the output device is a headset, because the built-in microphone is more convenient in my use cases. I know how to achieve my goal when the output device is a wired headset, like the one that comes bundled with an iPhone. I simply plug the wired headset in, and call the following

AVAudioRecorder doesn't record while screen is locked

北战南征 提交于 2020-01-09 11:49:10
问题 I've tried to overcome this for a while. I'm trying to record sound, but the AVAudioRecorder doesn't record while screen is locked. It does continue to record once screen is unlocked, but the audio recorded when screen was locked is lost forever. I can't find anything wrong with what I'm doing: -(void) startRecording { // Begin the recording session. _session = [AVAudioSession sharedInstance]; NSError *setCategoryError = nil; NSError *startRecordError; [_session setActive:YES error:

Hide Red Recording Status Bar In iOS App When Not Recording

百般思念 提交于 2020-01-09 07:53:31
问题 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: