avaudiosession

How can I play a haptic feedback while AvCapture Session is running?

别来无恙 提交于 2021-02-09 11:13:36
问题 When my Avcapture session is running and ready to record a video , I cannot play and audio files, vibrate or play any haptic feedback? I only found a solution for objective c but not swift. Objective C Solution : Using vibrate and AVCaptureSession at the same time 回答1: As long as you are using microphone in the AVCaptureSession , the haptic feedback will not play. Apple tries to prevent the vibration from disrupting the microphone capture. This is noted in https://developer.apple.com

How can I play a haptic feedback while AvCapture Session is running?

孤街醉人 提交于 2021-02-09 11:12:24
问题 When my Avcapture session is running and ready to record a video , I cannot play and audio files, vibrate or play any haptic feedback? I only found a solution for objective c but not swift. Objective C Solution : Using vibrate and AVCaptureSession at the same time 回答1: As long as you are using microphone in the AVCaptureSession , the haptic feedback will not play. Apple tries to prevent the vibration from disrupting the microphone capture. This is noted in https://developer.apple.com

How can I play a haptic feedback while AvCapture Session is running?

末鹿安然 提交于 2021-02-09 11:09:55
问题 When my Avcapture session is running and ready to record a video , I cannot play and audio files, vibrate or play any haptic feedback? I only found a solution for objective c but not swift. Objective C Solution : Using vibrate and AVCaptureSession at the same time 回答1: As long as you are using microphone in the AVCaptureSession , the haptic feedback will not play. Apple tries to prevent the vibration from disrupting the microphone capture. This is noted in https://developer.apple.com

Can AVAudioSession be activated in Background state without MixWithOthers?

☆樱花仙子☆ 提交于 2021-01-27 17:28:46
问题 So my app is running in the background because of CoreLocation that has requested AlwaysAuthorization. This prevents app to reach suspended state. It stays in background state and is receiving location events. After some location events I would like to activate AVAudioSession and play some sounds. How to activate session properly (in this background app) when I'm using other app in foreground right now and this app is playing audio track for example. Suppose I'm watching some video in Youtube

AVAudioPlayer NOT playing through speaker after recording with AVAudioRecorder

可紊 提交于 2021-01-07 03:26:58
问题 I'm working on an app that does audio recording and playback of recorded audio. I'm using AVAudioSession to change the category to playAndRecord as well as passing it to defaultToSpeaker . My problem is , if I launch the app, play an earlier recording, it plays through the bottom (louder) speaker as I want it to and expected BUT if I launch the app and start recording a new memo then play it back, no matter what I do, it will always use the quieter (phone call) speaker that's next to front

AVAudioPlayer NOT playing through speaker after recording with AVAudioRecorder

拜拜、爱过 提交于 2021-01-07 03:24:18
问题 I'm working on an app that does audio recording and playback of recorded audio. I'm using AVAudioSession to change the category to playAndRecord as well as passing it to defaultToSpeaker . My problem is , if I launch the app, play an earlier recording, it plays through the bottom (louder) speaker as I want it to and expected BUT if I launch the app and start recording a new memo then play it back, no matter what I do, it will always use the quieter (phone call) speaker that's next to front

AVSpeechSynthesizer spoken text is being listened by the AVAudioSession record. How to ignore audio output from AVSpeechSynthesizer when recording

半世苍凉 提交于 2021-01-04 12:32:35
问题 My startRecording function sets up an AVAudioSession for record, which is called on pressing a mic button. Before pressing the mic I am using an AVSpeechSynthesizer to speak some text. If I press the record button before the AVSpeechSynthesizer speech ends that speech is being recorded by AVAudioSession. How do I ignore the speech spoken by my AVSpeechSynthesizer and just record speech speaken by the user through a microphone? 来源: https://stackoverflow.com/questions/61260287

AVPlayer audioSessionGotInterrupted notification when waking up from background

戏子无情 提交于 2020-08-21 18:40:05
问题 I use AVAudioPlayer to play audio. I have background audio enabled and the audio sessions are configured correctly. I implemented the audioSessionGotInterrupted method to be informed if the audio session gets interrupted. This is my current code: @objc private func audioSessionGotInterrupted(note: NSNotification) { guard let userInfo = note.userInfo, let typeValue = userInfo[AVAudioSessionInterruptionTypeKey] as? UInt, let type = AVAudioSessionInterruptionType(rawValue: typeValue) else {

AVPlayer audioSessionGotInterrupted notification when waking up from background

拥有回忆 提交于 2020-08-21 18:39:47
问题 I use AVAudioPlayer to play audio. I have background audio enabled and the audio sessions are configured correctly. I implemented the audioSessionGotInterrupted method to be informed if the audio session gets interrupted. This is my current code: @objc private func audioSessionGotInterrupted(note: NSNotification) { guard let userInfo = note.userInfo, let typeValue = userInfo[AVAudioSessionInterruptionTypeKey] as? UInt, let type = AVAudioSessionInterruptionType(rawValue: typeValue) else {

AVAudioSession - How to switch between speaker and headphones output

北城余情 提交于 2020-06-27 09:06:06
问题 I'm trying to mimic behaviour as in Phone app during calling. You can easily switch output sources from/to speaker or headphones. I know I can force speaker as an output when headphones are connected by calling: try! audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord) try! audioSession.overrideOutputAudioPort(.speaker) However, when I do that, I don't see any way to detect if headphones are still connected to the device. I initially thought outputDataSources on AVAudioSession would