Created
July 28, 2020 21:34
-
-
Save Meherdeep/c260d2b0a8bf619d85662a8daced477b 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
void _addAgoraEventHandlers() { | |
AgoraRtcEngine.onError = (dynamic code) { | |
setState(() { | |
final info = 'onError: $code'; | |
_infoStrings.add(info); | |
}); | |
}; | |
AgoraRtcEngine.onJoinChannelSuccess = ( | |
String channel, | |
int uid, | |
int elapsed, | |
) { | |
setState(() { | |
final info = 'onJoinChannel: $channel, uid: $uid'; | |
_infoStrings.add(info); | |
}); | |
}; | |
AgoraRtcEngine.onLeaveChannel = () { | |
setState(() { | |
_infoStrings.add('onLeaveChannel'); | |
_users.clear(); | |
}); | |
}; | |
AgoraRtcEngine.onUserJoined = (int uid, int elapsed) { | |
setState(() { | |
final info = 'userJoined: $uid'; | |
_infoStrings.add(info); | |
_users.add(uid); | |
}); | |
}; | |
AgoraRtcEngine.onUserOffline = (int uid, int reason) { | |
setState(() { | |
final info = 'userOffline: $uid'; | |
_infoStrings.add(info); | |
_users.remove(uid); | |
}); | |
}; | |
AgoraRtcEngine.onFirstRemoteVideoFrame = ( | |
int uid, | |
int width, | |
int height, | |
int elapsed, | |
) { | |
setState(() { | |
final info = 'firstRemoteVideo: $uid ${width}x $height'; | |
_infoStrings.add(info); | |
}); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment