Skip to content

Instantly share code, notes, and snippets.

@DhruvamUnikon
Created April 4, 2024 08:23
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 DhruvamUnikon/6e652633badb5152588985e41cc6cffe to your computer and use it in GitHub Desktop.
Save DhruvamUnikon/6e652633badb5152588985e41cc6cffe to your computer and use it in GitHub Desktop.
void startListenEvent() {
// Callback for updates on the status of other users in the room.
// Users can only receive callbacks when the isUserStatusNotify property of ZegoRoomConfig is set to `true` when logging in to the room (loginRoom).
ZegoExpressEngine.onRoomUserUpdate =
(roomID, updateType, List<ZegoUser> userList) {};
// Callback for updates on the status of the streams in the room.
ZegoExpressEngine.onRoomStreamUpdate =
(roomID, updateType, List<ZegoStream> streamList, extendedData) {
if (updateType == ZegoUpdateType.Add) {
for (final stream in streamList) {
startPlayStream(stream.streamID);
}
} else {
for (final stream in streamList) {
stopPlayStream(stream.streamID);
}
}
};
// Callback for updates on the current user's room connection status.
ZegoExpressEngine.onRoomStateUpdate =
(roomID, state, errorCode, extendedData) {
debugPrint(
'onRoomStateUpdate: roomID: $roomID, state: ${state.name}, errorCode: $errorCode, extendedData: $extendedData');
};
// Callback for updates on the current user's stream publishing changes.
ZegoExpressEngine.onPublisherStateUpdate =
(streamID, state, errorCode, extendedData) {
debugPrint(
'onPublisherStateUpdate: streamID: $streamID, state: ${state.name}, errorCode: $errorCode, extendedData: $extendedData');
};
ZegoExpressEngine.onCapturedDataRecordStateUpdate =
(state, errorCode, configID, channel) {
print('_AdvancedVideoCallHolderState.startListenEvent $state');
debugPrint(
'onCapturedDataRecordStateUpdate: state: ${state.name}, errorCode: $errorCode, configID: $configID');
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment