Reputation: 21
At the moment, when I call and try to change the volume with UI elements, I only see the UI change, the volume slider change, but not the device volume. The volume is static. For volume changing I'm using MPVolumeView
static func adjustCurrentVolume(_ volume: Float) {
let volumeView = MPVolumeView()
guard let slider = volumeView.subviews.first(where: { $0 is UISlider }) as? UISlider else { return }
if volume > maximumVolume {
currentVolume = maximumVolume
} else if volume < minimumVolume {
currentVolume = minimumVolume
} else {
currentVolume = volume
}
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
slider.value = currentVolume
}
}
For Call: SinchRTC and CallKit. The AudioSession during a call is in the PlayAndRecord category and VoiceChat mode.
Upvotes: 2
Views: 325
Reputation: 79
Looking at the developer reference for MPVolumeview, have you tried it with the button to set the audio output path. If you add the button are you able to set an audio output route and control the volume as expected?
https://developer.apple.com/documentation/mediaplayer/mpvolumeview
Upvotes: -1