Questions tagged [avaudiosession]

This class provides an Objective-C alternative to many features from the C-based Audio Session Services.

AVAudioSession classs reference

1047 questions
21
votes
5 answers

How to make MPMoviePlayerController ignore the mute switch

I want to play a video using MPMoviePlayerController but I want it to ignore the mute switch, similar to the behavior of Youtube's video player. Any ideas?
zohar
  • 2,298
  • 13
  • 45
  • 75
20
votes
3 answers

iOS AVAudioSession interruption notification not working as expected

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…
19
votes
4 answers

AVSpeechSynthesizer error AudioSession

I'm playing around with AVSpeechSynthesizer and always getting these errors: ERROR: >aqsrv> 65: Exception caught in (null) - error -66634 ERROR: AVAudioSessionUtilities.h:88: GetProperty_DefaultToZero: AudioSessionGetProperty ('disa') failed…
h345k34cr
  • 3,310
  • 5
  • 21
  • 28
18
votes
2 answers

IOS: AVAudioSession not working

I am trying to use AVAudioSession, but it is throwing this runtime error: [avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields:Unknown selected data source for Port Speaker (type Speaker). If it helps I am trying to just record audio, and…
Codekrafter
  • 181
  • 1
  • 3
  • 6
18
votes
2 answers

Alternative to deprecated AudioSessionGetProperty, for iOS 7

I am using AudioSessionGetProperty to check 'audioIsAlreadyPlaying'. Xcode says: 'AudioSessionGetProperty' is deprecated: first deprecated in iOS 7.0 Please could someone tell me what I should use instead, to get the audioIsAlreadyPlaying…
Custom Bonbons
  • 1,609
  • 2
  • 12
  • 17
17
votes
1 answer

Get Connected AirPlay Device Name

I want to get the name of the AirPlay or Bluetooth device my iPhone is connected to. I have somewhat achieved this with the following code... let currentRoute = AVAudioSession.sharedInstance().currentRoute for output in currentRoute.outputs { …
Jacob Cavin
  • 2,169
  • 3
  • 19
  • 47
17
votes
4 answers

AVAudioSession setCategory availability in Swift 4.2

After migrating to Swift 4.2, I am getting multiple errors, one of which is weird. It seems like a bug in Xcode 10, but is there a workaround available? do { try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playAndRecord,…
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
17
votes
1 answer

How to set iOS app to use usb audio for input and output to internal speakers

I have 2 different makes of guitar adapters that connect to my iphone using the lightning connector When adapter 1 is plugged in, the device becomes a usb audio mic and it plays the sound through my iPhone's speakers as the adapter does not contain…
totalitarian
  • 3,606
  • 6
  • 32
  • 55
17
votes
6 answers

Detect when AVAudioSession is being "Ducked"

I'm working on a Podcast app. This plays audio using the AVAudioSessionCategoryPlayback session type. This does almost everything that I want it to do. It pauses other playing music, it gets interrupted when a call comes in and generally works…
David Smith
  • 426
  • 3
  • 7
17
votes
2 answers

Using VoiceProcessingIO audio unit subtype instead of RemoteIO causes unwanted drop in output volume

I am using RemoteIO in my voice chat application. To enable echo canceling, I changed "kAudioUnitSubType_RemoteIO" to "kAudioUnitSubType_VoiceProcessingIO" after setting "kAudioSessionCategory_PlayAndRecord" as the session type. Now echo canceling…
Sujithra
  • 527
  • 1
  • 6
  • 14
16
votes
2 answers

Crash in AVAudioEngine.start() even though it's wrapped in do/catch

I have the following code to (re)start AVAudioEngine wired up to AVAudioEngineConfigurationChangeNotification: do { try self.engine.start() } catch { DDLogError("could not start sound engine") self.soundEnabled = false …
Mike
  • 223
  • 3
  • 10
15
votes
1 answer

Updated to Xcode 10.1 on Mojave and now my app always asks to use the microphone

I am running a AVAudioSession which I suspect is activating the microphone request, but I only use it for sounds and music. When running Xcode 10.1 Simulator on macOS Mojave, why does it activate a request to access the microphone? I haven't written…
MrCoinOp
  • 151
  • 6
15
votes
1 answer

Unable to restart recording after answering incoming phone call

I have added an observer for the interrupt notification when recording audio. This works fine when performing an outgoing-call, getting an incoming call and not answering, Siri, etc.. Now my app is running in the background with the red bar at the…
Thizzer
  • 16,153
  • 28
  • 98
  • 139
15
votes
3 answers

AVAudioRecorder not recording in background after audio session interruption ended

I am recording audio in my app, both in foreground and in background. I also handle AVAudioSessionInterruptionNotification to stop recording when interruption begins and start again when it ends. Although in foreground it works as expected, when app…
ozzotto
  • 1,146
  • 3
  • 13
  • 30
15
votes
2 answers

AVCaptureSession and background audio iOS 7

Whenever I start an AVCaptureSession running with the microphone as an input it cancels whatever background music is currently running (iPod music for instance). If I comment out the line adding the audio input, the background audio continues. Does…
1
2
3
69 70