|
|
@ -19,6 +19,12 @@ final class CallVC : UIViewController, WebRTCSessionDelegate {
|
|
|
|
}()
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: UI Components
|
|
|
|
// MARK: UI Components
|
|
|
|
|
|
|
|
private lazy var remoteVideoView: RTCMTLVideoView = {
|
|
|
|
|
|
|
|
let result = RTCMTLVideoView()
|
|
|
|
|
|
|
|
result.contentMode = .scaleAspectFill
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
|
|
private lazy var fadeView: UIView = {
|
|
|
|
private lazy var fadeView: UIView = {
|
|
|
|
let result = UIView()
|
|
|
|
let result = UIView()
|
|
|
|
let height: CGFloat = 64
|
|
|
|
let height: CGFloat = 64
|
|
|
@ -100,8 +106,6 @@ final class CallVC : UIViewController, WebRTCSessionDelegate {
|
|
|
|
|
|
|
|
|
|
|
|
func setUpViewHierarchy() {
|
|
|
|
func setUpViewHierarchy() {
|
|
|
|
// Remote video view
|
|
|
|
// Remote video view
|
|
|
|
let remoteVideoView = RTCMTLVideoView()
|
|
|
|
|
|
|
|
remoteVideoView.contentMode = .scaleAspectFill
|
|
|
|
|
|
|
|
webRTCSession.attachRemoteRenderer(remoteVideoView)
|
|
|
|
webRTCSession.attachRemoteRenderer(remoteVideoView)
|
|
|
|
view.addSubview(remoteVideoView)
|
|
|
|
view.addSubview(remoteVideoView)
|
|
|
|
remoteVideoView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
|
remoteVideoView.translatesAutoresizingMaskIntoConstraints = false
|
|
|
@ -148,9 +152,11 @@ final class CallVC : UIViewController, WebRTCSessionDelegate {
|
|
|
|
|
|
|
|
|
|
|
|
// MARK: Interaction
|
|
|
|
// MARK: Interaction
|
|
|
|
func handleEndCallMessage(_ message: CallMessage) {
|
|
|
|
func handleEndCallMessage(_ message: CallMessage) {
|
|
|
|
|
|
|
|
print("[Calls] Ending call.")
|
|
|
|
WebRTCSession.current?.dropConnection()
|
|
|
|
WebRTCSession.current?.dropConnection()
|
|
|
|
WebRTCSession.current = nil
|
|
|
|
WebRTCSession.current = nil
|
|
|
|
UIView.animate(withDuration: 0.25) {
|
|
|
|
UIView.animate(withDuration: 0.25) {
|
|
|
|
|
|
|
|
self.remoteVideoView.alpha = 0
|
|
|
|
self.callEndedLabel.alpha = 1
|
|
|
|
self.callEndedLabel.alpha = 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Timer.scheduledTimer(withTimeInterval: 2, repeats: false) { _ in
|
|
|
|
Timer.scheduledTimer(withTimeInterval: 2, repeats: false) { _ in
|
|
|
|