avaudiosession

How do I make AVCaptureSession and AVPlayer respect AVAudioSessionCategoryAmbient?

陌路散爱 提交于 2019-12-07 17:13:45
问题 I'm making an app that records ( AVCaptureSession ) and plays ( AVPlayerLayer ) video. I'd like to be able to do this without pausing background audio from other apps and I'd like the playback to respect the mute switch. In the AppDelegate I have set AVAudioSessionCategoryAmbient , according to the docs this should: The category for an app in which sound playback is nonprimary—that is, your app can be used successfully with the sound turned off. This category is also appropriate for “play

AVAudioSession never stopped

陌路散爱 提交于 2019-12-07 11:43:54
问题 I'm trying to set my AVAudioSession to inactive to get back to normal state. My utterance function: class SSpeech : NSObject, AVSpeechSynthesizerDelegate { var group = DispatchGroup(); var queue = DispatchQueue(label: "co.xxxx.speech", attributes: []) class var sharedInstance: SSpeech { struct Static { static var instance: SSpeech? } if !(Static.instance != nil) { Static.instance = SSpeech() } return Static.instance! } required override init() { super.init(); self.speechsynt.delegate = self;

AVAudioSession : microphone headphone as input and iphone speaker as output

两盒软妹~` 提交于 2019-12-07 09:59:15
问题 With iOS10 there are more possibilities to manage AUdioSession, but i couldn't manage to keep the headphone microphone as input while audio is going out through the iphone speaker. The 'overrideOutputAudioPort' method below also override the input audio port as the iphone microphone let session = AVAudioSession.sharedInstance() do { try session.setCategory(AVAudioSessionCategoryPlayAndRecord) try! session.overrideOutputAudioPort(.speaker) } catch { } Is there any solution to keep the

app crashes after checking network reachability in iphone?

折月煮酒 提交于 2019-12-07 07:30:59
问题 i have a mpmovieplayercontroller to play online music and avaudiosession to play the same music at background, when the first time app launches without network access, normally i shows "no internet connection" , when i tried after connecting to internet and playing it shows the error *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'An AVPlayerItem cannot be associated with more than one instance of AVPlayer' my code is here static MPMoviePlayerController

AVAudioSessionInterruptionNotification not triggered when capture device active

为君一笑 提交于 2019-12-07 07:07:21
问题 I'm having a problem with " AVAudioSessionInterruptionNotification " on iOS 7.0.4. I sign up for it on the NSNotificationCenter, and I activate AVAudioSession. Everything works fine, but if a camera is activated, that particular notification is not triggered anymore, neither for the beginning of an interruption, nor for the end of it. I test audio interruptions by receiving cell calls on an iPhone4, and also by making an alarm ring while the app is running. I also tried using the notification

Playing music at back ground: AVAudioSessionInterruptionNotification not fired

五迷三道 提交于 2019-12-06 21:11:01
问题 My app is playing in background well. Pause and play also works well even my app is background using the methods registered for AVAudioSessionInterruptionNotification . The problem arrives steps for the scenario: Launch my app -> goes background music from my app playing well launch apple's music app and play. AVAudioSessionInterruptionNotification fired . When i pause the music app or kill the music app. AVAudioSessionInterruptionNotification doesn't get fired Code: I am doing this in

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

為{幸葍}努か 提交于 2019-12-06 17:25:47
问题 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 a headphone socket When adapter 2 is plugged in, the device becomes a usb audio mic but plays the sound through the headphone socket on the adapter. I'm trying to write an app that work with adapter 2, but rather than output the sound to the

AVAudioSession mixing with AVSpeechUtterance

青春壹個敷衍的年華 提交于 2019-12-06 12:41:33
问题 I have an issue where I would like to have the iPod playing music in the background and in my application I would like to have AVSpeechUtterance lower the volume of the iPod, play a string of text and then I would like to have the iPod resume playing. I have tried several things but never had AVAudioSession and AVSpeechUtterance work well together. I can get the iPod to stop, pause for a bit and then start playing again. I can see my string being passed to AVSpeechUtterance , but it does not

How to resolve AVCaptureSession v AVAudioSession conflict in iOS?

拜拜、爱过 提交于 2019-12-06 10:18:11
问题 I'm trying to run an AVCaptureSession in a view controller, but within the same, I'm also calling a function from a library that uses AVAudioSession. I can't seem to get much info out of the debugger, other than it crashes exactly when I call this particular library's function. The library is libpd: https://github.com/libpd and it calls AVAudioSession as sharedInstance. I call libpd as: [self.audioController configurePlaybackWithSampleRate:44100 numberChannels:2 inputEnabled:YES mixingEnabled

AVAudioSession reactivation issue

戏子无情 提交于 2019-12-06 06:51:03
I am getting the following error: [0x19bf89310] AVAudioSession.mm:646: -[AVAudioSession setActive:withOptions:error:]: Deactivating an audio session that has running I/O. All I/O should be stopped or paused prior to deactivating the audio session. I have read through this post: iOS8 AVAudioSession setActive error however the solution there did not solve my problem. which is: small application (game) audio background music handled in AudioHelper.swift additional 'blip' sounds played with SKActino.playSoundFile reproduction start game (background music starts to play) close game (music stops)