Post not yet marked as solved
I have integrated CallKit successfully and I'm trying to handle the video button. In some devices, I get the enabled video button and can request to open a video connection. But for some devices, I get a disabled video icon. What could be the reason for that?
private lazy var provider: CXProvider = {
let configuration = CXProviderConfiguration()
configuration.supportsVideo = true
configuration.maximumCallGroups = 2
configuration.maximumCallsPerCallGroup = 4
configuration.includesCallsInRecents = false
configuration.supportedHandleTypes = [.generic]
return CXProvider(configuration: configuration)
}()
func reportIncomingCall() {
let uuid = UUID()
let update = CXCallUpdate()
update.supportsGrouping = true
update.supportsHolding = true
update.remoteHandle = CXHandle(type: .generic, value: "Name")
update.hasVideo = true // or false
provider.reportNewIncomingCall(with: uuid, update: update) { [weak self] error in
// handle
}
}
Note: Whatsapp has the enabled video button in the same device.
Post not yet marked as solved
I've integrated MPVolumeView into my view, and it correctly responds to hardware volume changes as expected. However, once I initiate audio streaming using AVAudioEngine to capture microphone audio and AudioUnit for decoding, the MPVolumeView ceases to reflect changes made using the hardware volume buttons. Additionally, even when I adjust the volume using the slider on MPVolumeView, it doesn't change the system volume. Has anyone else encountered this issue? What might be causing MPVolumeView to stop responding to hardware volume changes once streaming starts?
For the AVAudioSession.Mode, I use the default setting because using .voiceChat prevents MPVolumeView update from device volume changes permanently.
let session = AVAudioSession.sharedInstance()
do {
try session.setCategory(.playAndRecord, options: [.allowBluetooth])
try session.setActive(true)
} catch {
print(error.localizedDescription)
}
Post not yet marked as solved
I'm trying to change the audio input (microphone) between all the available devices from AVAudioSession.sharedInstance().availableInputs. I'm using AVAudioSession.routeChangeNotification to get automatic route changes when devices get connected/disconnected and change the preferred input with setPreferredInput, then I restart my audioEngine and it works fine.
But when I try to change the preferred input programmatically It doesn't change the audio capture inputNode. But keeps the last connected device and capturing.
Even the AVAudioSession.sharedInstance().currentRoute.inputs changes but the audioEngine?.inputNode doesn't change to setPreferredInput call.
WhatsApp seems to have done that without any issues.
Any suggestions or leads are highly appreciated. Thanks.