closeSession method
Implementation
Future<void> closeSession(bool isCallEnd) async {
print("this is close session");
if (Platform.isAndroid) {
_stopForegroundService().then((value) {
print("successfully stoped foregroundService");
}).catchError((e) {
print("error on stopForegroundService $e");
});
}
if (isCallEnd) {
isCallInProgress = false;
}
//
_localStreamformultisession?.getTracks().forEach((element) async {
await element.stop();
});
await _localStreamformultisession?.dispose();
_localStreamformultisession = null;
_localStream?.getTracks().forEach((element) async {
await element.stop();
});
await _localStream?.dispose();
_localStream = null;
print(
"this is peer connection before close $_peerConnection $iscallonetomany");
// if (kIsWeb) {
// } else {
print("this is peer connection before close $_peerConnection");
_peerConnection?.close();
_peerConnection?.dispose();
_peerConnectionformultisession?.dispose();
print("this is peer connection before closeeeeeeeee $_peerConnection");
rtcPeerConnectionList.forEach((key, value) {
print("djgshdgdsh ");
rtcPeerConnectionList[key]?.dispose();
});
rtcPeerConnectionList.clear();
_audioStream?.getTracks().forEach((element) async {
await element.stop();
});
await _audioStream?.dispose();
_audioStream = null;
}