Skip to content

Instantly share code, notes, and snippets.

@zontan
Created July 6, 2020 21:52
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/6d49ce002277eba9c6a7e1560306c1bb to your computer and use it in GitHub Desktop.
Save zontan/6d49ce002277eba9c6a7e1560306c1bb to your computer and use it in GitHub Desktop.
var remoteUserIDs: [UInt] = []
...
extension AgoraVideoViewController: AgoraRtcEngineDelegate {
func rtcEngine(_ engine: AgoraRtcEngineKit, didJoinChannel channel: String, withUid uid: UInt, elapsed: Int) {
callID = uid
}
func rtcEngine(_ engine: AgoraRtcEngineKit, didJoinedOfUid uid: UInt, elapsed: Int) {
print("Joined call of uid: \(uid)")
remoteUserIDs.append(uid)
collectionView.reloadData()
}
func rtcEngine(_ engine: AgoraRtcEngineKit, didOfflineOfUid uid: UInt, reason: AgoraUserOfflineReason) {
if let index = remoteUserIDs.firstIndex(where: { $0 == uid }) {
remoteUserIDs.remove(at: index)
collectionView.reloadData()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment