Skip to content

Instantly share code, notes, and snippets.

@zontan
Created November 10, 2020 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zontan/c36a964c9cbdb7f085946ac86e2d320f to your computer and use it in GitHub Desktop.
Save zontan/c36a964c9cbdb7f085946ac86e2d320f to your computer and use it in GitHub Desktop.
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