avaudiosession

How to use AVAudioSessionCategoryMultiRoute on iPhone device?

半城伤御伤魂 提交于 2019-12-30 08:18:18
问题 I would like to use AVAudioSessionCategoryMultiRoute, but unfortunately there is no example on apple dev center nor Google. How to use/implement AVAudioSessionCategoryMultiRoute in order to define 2 distinct routes on an iPhone ios7.0.4 ? My goal is to route audio both through speaker and headphones. (I know that is was not possible in the past, but I would like to try with ios7) Thank you for your help, 回答1: This help me: AVAudioEngine and Multiroute, and this: Audio Session and Multiroute

AVAudioSession Interruptions

走远了吗. 提交于 2019-12-30 04:04:06
问题 So in my app, running on iOS 6, everything seems to work fine with audio. I use the old C API format to catch interruptions using a callback; setting up via: AudioSessionInitialize(NULL, NULL, interruptionListenerCallback, (__bridge void *)self) and it was great. Using iOS 7 SDK though, it seems that my interruption callback is never called when the device receives calls or an alarm goes off. After some looking around, I heard that the old C api were deprecated and that you should move to the

AVAudioSession ducking stops when AVAssetWriter.startWriting is called

偶尔善良 提交于 2019-12-25 00:51:02
问题 When I call startWriting for a video capture session, the ducking for my audio session stops, and the external audio goes back to full volume. How can I prevent this from happening? Audio session setup: try! AVAudioSession.sharedInstance().setCategory(.playback, mode: .spokenAudio, options: [.duckOthers, .interruptSpokenAudioAndMixWithOthers]) try! AVAudioSession.sharedInstance().setActive(true) // ducking starts here, as expected Video session setup: let videoSettings:[String: Any] =

AudioUnitInitialize failed with error code 1701737535 'ent?' after alarm interruption

旧城冷巷雨未停 提交于 2019-12-24 22:04:44
问题 I am working with VOIP app. The app is working fine with CallKit. I am facing an issue if alarm fires within call. Every time when alarm stop firing (Audio Interruption ends), we are trying to setActive: on AVAudioSession. But it always gives an error with code 1701737535 ie. 'ent?'. The same error occurs when I am trying to initialize Audio Unit. Without using CallKit it's working fine. Anybody faced issue with activating Audio Session when Audio Interruption ends. I am getting different

Core Audio: Working with Speaker, Is it possible to route to the internal speaker- AVAudioSessionPortBuiltInReceiver(Not to loud speaker)

我的梦境 提交于 2019-12-23 17:27:55
问题 As per the docs, Ther is no documentation about routing or even getting of the Port details for the "AVAudioSessionPortBuiltInReceiver". (Note: Please read again, its not about this port AVAudioSessionPortBuiltInSpeaker ) . As I found that and only possible overrideOutputAudioPort can be done only for public enum AVAudioSessionPortOverride : UInt { case None case Speaker } The Question is, Is ther any possibilities to play an audio through the : public let AVAudioSessionPortBuiltInReceiver:

How to consistently stop AVAudioSession after AVSpeechUtterance

北城以北 提交于 2019-12-23 09:40:46
问题 What I want to do is allow my app to speak an utterance using AVSpeechSynthesizer while background audio apps are playing audio. While my app is speaking, I'd like the background apps' audio to "dim" and then return to their original volume after my app has finished speaking. In my AudioFeedback class, I initialize I setup the AVAudioSessions like so: self.session = [AVAudioSession sharedInstance]; NSError *error; [self.session setCategory:AVAudioSessionCategoryPlayback withOptions

Volume of audio while recording video

允我心安 提交于 2019-12-22 21:13:10
问题 So after a lot of searching I was able to find the code block that allows background audio to play while at the same time recording video. I have pasted said code block below. fileprivate func setBackgroundAudioPreference() { guard allowBackgroundAudio == true else { return } guard audioEnabled == true else { return } do{ if #available(iOS 10.0, *) { try AVAudioSession.sharedInstance().setCategory(.playAndRecord, mode: .default, options: [.mixWithOthers, .allowBluetooth, .allowAirPlay,

Cannot Control Volume of AVAudioPlayer via Hardware Buttons when AudioSessionActive is NO

五迷三道 提交于 2019-12-22 09:33:49
问题 I'm building a turn-by-turn navigation app that plays periodic, short clips of sound. Sound should play regardless of whether the screen is locked, should mix with other music playing, and should make other music duck when this audio plays. Apple discusses the turn-by-turn use case in detail in the "WWDC 2010 session 412 Audio Development for iPhone OS part 1" video at minute 29:20. The implementation works great, but there is one problem - when the app is running, pressing the hardware

Can not restart an interrupted audio input queue in background mode on iOS

随声附和 提交于 2019-12-22 04:39:16
问题 I'm writing an iOS App using an AudioQueue for recording. I create an input queue configured to get linear PCM, stated this queue and everything works as expected. To manage interruptions, I implemented the delegate methods of AVAudioSession to catch the begin and the end of an interruption. The method endInterruption looks like the following: - (void)endInterruptionWithFlags:(NSUInteger)flags; { if (flags == AVAudioSessionInterruptionFlags_ShouldResume && audioQueue != 0) { NSLog(@"Current

Recording Audio on iOS Without Stopping Music Playback

谁说我不能喝 提交于 2019-12-22 04:07:41
问题 When recording audio with an AVAudioSession audio playback from the music app or others is stopped. This is described in the audio session documentation: AVAudioSessionCategoryRecord For recording audio; this category silences playback audio. Is there any way to change this behavior and do one of the following? 1) Continue playing other apps' audio and allow the phone to record the audio that is being played. 2) Resume other apps' audio once a brief recording is finished. There are