-
-
Save zontan/c36a964c9cbdb7f085946ac86e2d320f 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
func rtcEngine(_ engine: AgoraRtcEngineKit, didJoinedOfUid uid: UInt, elapsed: Int) { | |
let videoView = UIView() | |
videoView.tag = Int(uid) | |
videoView.backgroundColor = UIColor.purple | |
let videoCanvas = AgoraRtcVideoCanvas() | |
videoCanvas.uid = uid | |
videoCanvas.view = videoView | |
videoCanvas.renderMode = .hidden | |
agoraKit.setupRemoteVideo(videoCanvas) | |
stackView.addArrangedSubview(videoView) | |
} | |
internal func rtcEngine(_ engine: AgoraRtcEngineKit, didOfflineOfUid uid:UInt, reason:AgoraUserOfflineReason) { | |
guard let view = stackView.arrangedSubviews.first(where: { (view) -> Bool in | |
return view.tag == Int(uid) | |
}) else { | |
return | |
} | |
stackView.removeArrangedSubview(view) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment