Skip to content

Instantly share code, notes, and snippets.

@quangtqag
Created May 11, 2019 01:38
Show Gist options
  • Save quangtqag/a6e6416caeec433f3ccae89044372644 to your computer and use it in GitHub Desktop.
Save quangtqag/a6e6416caeec433f3ccae89044372644 to your computer and use it in GitHub Desktop.
func answer(completion: @escaping (_ sdp: RTCSessionDescription) -> Void) {
let constrains = RTCMediaConstraints(mandatoryConstraints: self.mediaConstrains,
optionalConstraints: nil)
self.peerConnection!.answer(for: constrains) { (sdp, error) in
guard let sdp = sdp else {
return
}
self.peerConnection!.setLocalDescription(sdp, completionHandler: { (error) in
completion(sdp)
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment