Commit e7623b65 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

audio: restart audio stream

Restart audio after receiving callback from CallKit.

Change-Id: Ie417735db719108f2c6da687fc010b516f130b30
parent 930ff8b4
......@@ -25,6 +25,7 @@
- (void)setAudioOutputDevice:(NSInteger)index;
- (void)setAudioInputDevice:(NSInteger)index;
- (void)setAudioRingtoneDevice:(NSInteger)index;
- (void)startAudio;
@end
......@@ -35,5 +35,8 @@
- (void)setAudioRingtoneDevice:(NSInteger)index {
DRing::setAudioRingtoneDevice((int32_t)index);
}
- (void)startAudio {
DRing::startAudio();
}
@end
......@@ -343,11 +343,7 @@ class CallViewModel: Stateable, ViewModel {
.filter({ serviceEvent in
serviceEvent.eventType == .audioActivated
}).subscribe(onNext: { [unowned self] _ in
if !self.audioService.isHeadsetConnected.value {
self.switchSpeaker()
self.isAudioOnly ?
self.audioService.overrideToReceiver() : self.audioService.overrideToSpeaker()
}
self.audioService.startAudio()
}).disposed(by: self.disposeBag)
}
......@@ -383,12 +379,9 @@ class CallViewModel: Stateable, ViewModel {
}
func answerCall() -> Completable {
guard #available(iOS 10.0, *) else {
if !self.audioService.isHeadsetConnected.value {
isAudioOnly ?
self.audioService.overrideToReceiver() : self.audioService.overrideToSpeaker()
}
return self.callService.accept(call: call)
if !self.audioService.isHeadsetConnected.value {
isAudioOnly ?
self.audioService.overrideToReceiver() : self.audioService.overrideToSpeaker()
}
return self.callService.accept(call: call)
}
......
......@@ -64,6 +64,9 @@ class AudioService {
} catch {
log.error("\(error)")
}
if #available(iOS 10.0, *) {
return
}
setToRing()
}
......@@ -159,4 +162,8 @@ class AudioService {
func setAudioRingtoneDevice(port: OutputPortType) {
self.audioAdapter.setAudioRingtoneDevice(port.rawValue)
}
func startAudio() {
self.audioAdapter.startAudio()
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment