Skip to content

Commit

Permalink
[example] Add leaveChannel example to example.md
Browse files Browse the repository at this point in the history
  • Loading branch information
littleGnAl committed Sep 11, 2023
1 parent 0517617 commit b5e5cff
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions example/example.md
Expand Up @@ -56,14 +56,16 @@ class _MyAppState extends State<MyApp> {
_remoteUid = remoteUid;
});
},
onUserOffline: (RtcConnection connection, int remoteUid, UserOfflineReasonType reason) {
onUserOffline: (RtcConnection connection, int remoteUid,
UserOfflineReasonType reason) {
debugPrint("remote user $remoteUid left channel");
setState(() {
_remoteUid = null;
});
},
onTokenPrivilegeWillExpire: (RtcConnection connection, String token) {
debugPrint('[onTokenPrivilegeWillExpire] connection: ${connection.toJson()}, token: $token');
debugPrint(
'[onTokenPrivilegeWillExpire] connection: ${connection.toJson()}, token: $token');
},
),
);
Expand All @@ -80,6 +82,18 @@ class _MyAppState extends State<MyApp> {
);
}
@override
void dispose() {
super.dispose();
_dispose();
}
Future<void> _dispose() async {
await _engine.leaveChannel();
await _engine.release();
}
// Create UI with local view and remote view
@override
Widget build(BuildContext context) {
Expand Down

0 comments on commit b5e5cff

Please sign in to comment.