mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-30 16:22:39 +00:00
Merge pull request #7013 from vector-im/giomfo/disable_sleep_mode
Voice broadcast - Disable the sleep mode during the recording until we are able to handle it
This commit is contained in:
commit
89cfac4dd1
1 changed files with 7 additions and 1 deletions
|
@ -63,12 +63,16 @@ class VoiceBroadcastRecorderService: VoiceBroadcastRecorderServiceProtocol {
|
||||||
}
|
}
|
||||||
|
|
||||||
try? audioEngine.start()
|
try? audioEngine.start()
|
||||||
|
|
||||||
|
// Disable the sleep mode during the recording until we are able to handle it
|
||||||
|
UIApplication.shared.isIdleTimerDisabled = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func stopRecordingVoiceBroadcast() {
|
func stopRecordingVoiceBroadcast() {
|
||||||
MXLog.debug("[VoiceBroadcastRecorderService] Stop recording voice broadcast")
|
MXLog.debug("[VoiceBroadcastRecorderService] Stop recording voice broadcast")
|
||||||
audioEngine.stop()
|
audioEngine.stop()
|
||||||
audioEngine.inputNode.removeTap(onBus: audioNodeBus)
|
audioEngine.inputNode.removeTap(onBus: audioNodeBus)
|
||||||
|
UIApplication.shared.isIdleTimerDisabled = false
|
||||||
|
|
||||||
voiceBroadcastService?.stopVoiceBroadcast(success: { [weak self] _ in
|
voiceBroadcastService?.stopVoiceBroadcast(success: { [weak self] _ in
|
||||||
MXLog.debug("[VoiceBroadcastRecorderService] Stopped")
|
MXLog.debug("[VoiceBroadcastRecorderService] Stopped")
|
||||||
|
@ -97,6 +101,7 @@ class VoiceBroadcastRecorderService: VoiceBroadcastRecorderServiceProtocol {
|
||||||
|
|
||||||
func pauseRecordingVoiceBroadcast() {
|
func pauseRecordingVoiceBroadcast() {
|
||||||
audioEngine.pause()
|
audioEngine.pause()
|
||||||
|
UIApplication.shared.isIdleTimerDisabled = false
|
||||||
|
|
||||||
voiceBroadcastService?.pauseVoiceBroadcast(success: { [weak self] _ in
|
voiceBroadcastService?.pauseVoiceBroadcast(success: { [weak self] _ in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
|
@ -118,7 +123,8 @@ class VoiceBroadcastRecorderService: VoiceBroadcastRecorderServiceProtocol {
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
|
|
||||||
// Update state
|
// Update state
|
||||||
self.serviceDelegate?.voiceBroadcastRecorderService(self, didUpdateState: .started)
|
self.serviceDelegate?.voiceBroadcastRecorderService(self, didUpdateState: .resumed)
|
||||||
|
UIApplication.shared.isIdleTimerDisabled = true
|
||||||
}, failure: { error in
|
}, failure: { error in
|
||||||
MXLog.error("[VoiceBroadcastRecorderService] Failed to resume voice broadcast", context: error)
|
MXLog.error("[VoiceBroadcastRecorderService] Failed to resume voice broadcast", context: error)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue