Created
May 11, 2019 01:41
-
-
Save quangtqag/886a26c2f80902eeb298736de035e617 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBAction func endCall(_ sender: Any) { | |
self.signalClient.deleteSdpAndCandidate(for: self.currentPerson) | |
self.webRTCClient.closePeerConnection() | |
self.webRTCClient.createPeerConnection() | |
self.hasLocalSdp = false | |
self.localCandidateCount = 0 | |
self.hasRemoteSdp = false | |
self.remoteCandidateCount = 0 | |
} | |
func deleteSdpAndCandidate(for person: String) { | |
Firestore.firestore().collection(person).document("sdp").delete() { err in | |
if let err = err { | |
print("Error removing firestore sdp: \(err)") | |
} else { | |
print("Firestore sdp successfully removed!") | |
} | |
} | |
Firestore.firestore().collection(person).document("candidate").delete() { err in | |
if let err = err { | |
print("Error removing firestore candidate: \(err)") | |
} else { | |
print("Firestore candidate successfully removed!") | |
} | |
} | |
} | |
func closePeerConnection() { | |
self.peerConnection!.close() | |
self.peerConnection = nil | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment