Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Signal/Calls/UserInterface/CallUIAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public class CallUIAdapter: NSObject {
}
Logger.info("remoteAddress: \(caller)")

// make sure we dont have any audio playing as that will bug audio when it interacts with the call service
AppEnvironment.shared.cvAudioPlayerRef.pauseAll()

// make sure we don't terminate audio session during call
_ = SUIEnvironment.shared.audioSessionRef.startAudioActivity(call.commonState.audioActivity)

Expand Down
14 changes: 14 additions & 0 deletions Signal/ConversationView/CVAudioPlayback.swift
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,14 @@ public class CVAudioPlayer: NSObject {
audioPlayback.stop()
self.audioPlayback = nil
}

//pause all function
public func pauseAll() {
guard let audioPlayback = self.audioPlayback else {
return
}
audioPlayback.pause()
}
}

extension CVAudioPlayer: AudioPlayerDelegate {
Expand Down Expand Up @@ -396,6 +404,12 @@ private class CVAudioPlayback: NSObject, AudioPlayerDelegate {
deinit {
stop()
}

fileprivate func pause() {
AssertIsOnMainThread()

audioPlayer.pause()
}

fileprivate func stop() {
AssertIsOnMainThread()
Expand Down
1 change: 1 addition & 0 deletions SignalUI/AV/AudioPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public class AudioPlayer: NSObject {
MainActor.assumeIsolated {
DependenciesBridge.shared.deviceSleepManager?.removeBlock(blockObject: sleepBlockObject)
}
teardownRemoteCommandCenter()
}

public func setupAudioPlayer() {
Expand Down