mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
955 B
Swift
30 lines
955 B
Swift
3 years ago
|
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
||
|
|
||
|
import Foundation
|
||
2 years ago
|
import Combine
|
||
4 years ago
|
import WebRTC
|
||
3 years ago
|
import SessionUtilitiesKit
|
||
4 years ago
|
|
||
4 years ago
|
extension WebRTCSession {
|
||
4 years ago
|
|
||
4 years ago
|
public func handleICECandidates(_ candidate: [RTCIceCandidate]) {
|
||
3 years ago
|
SNLog("[Calls] Received ICE candidate message.")
|
||
3 years ago
|
candidate.forEach { peerConnection?.add($0, completionHandler: { _ in }) }
|
||
4 years ago
|
}
|
||
|
|
||
3 years ago
|
public func handleRemoteSDP(_ sdp: RTCSessionDescription, from sessionId: String) {
|
||
3 years ago
|
SNLog("[Calls] Received remote SDP: \(sdp.sdp).")
|
||
3 years ago
|
|
||
3 years ago
|
peerConnection?.setRemoteDescription(sdp, completionHandler: { [weak self] error in
|
||
4 years ago
|
if let error = error {
|
||
4 years ago
|
SNLog("[Calls] Couldn't set SDP due to error: \(error).")
|
||
3 years ago
|
}
|
||
|
else {
|
||
|
guard sdp.type == .offer else { return }
|
||
|
|
||
2 years ago
|
self?.sendAnswer(to: sessionId).sinkUntilComplete()
|
||
4 years ago
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|