Closed tanmay-sambuq closed 7 months ago
@tatanka987 would appreciate your help.
User A calls User B - the video calling works User B logs out and User C logs in from the same web browser. User C does not receive the call.
On logout event, below is the code:
FutureOr<void> onLogoutUser(LogoutUser event, Emitter<AuthState> emit) async {
try {
// CallManager.instance.destroy();
// print("call manager .destroy called");
CubeChatConnection.instance.logout();
print("cube chat connection .logout called");
//await PushNotificationsManager.instance.unsubscribe();
//print("pust notif .unsubscribe called");
//await signOut();
//print("Connectycube signout called");
} catch (e) {
print("Connectycube Error: $e");
}
}
on calling .destroy()
if the user A logs in again and calls User B, even User B does not receive the call.
In all cases the log says chat connection is Ready.
I think this is a P2PSession issue which I am unable to debug. I am also adding the initConnectycube and _loginToCC functions
initConnectycube(
CubeUser savedUser,
String appId,
String authKey,
String authSecret,
) {
init(appId, authKey, authSecret, onSessionRestore: () async {
// Future<CubeSession> session;
try {
return createSession(savedUser);
} catch (e) {
print(e);
rethrow;
}
});
}
_loginToCC(BuildContext context, CubeUser user) {
try {
if (_isLoginContinues) return;
_isLoginContinues = true;
if (CubeSessionManager.instance.isActiveSessionValid() &&
CubeSessionManager.instance.activeSession!.user != null) {
if (CubeChatConnection.instance.isAuthenticated()) {
_isLoginContinues = false;
CallManager.instance.init(context, navigatorKey, user.id.toString());
} else {
_loginToCubeChat(context, user);
}
} else {
createSession(user).then((cubeSession) {
_loginToCubeChat(context, user);
}).catchError((exception) {
_processLoginError(exception);
});
}
} catch (err) {
print("CONNECTYCUBE LOGIN: $err");
}
}
@b2bPrasad why do you comment on this line
CallManager.instance.destroy();
after commenting on this line your call manager doesn't configure for a new chat connection, it continues listening to the calls on the previous chat connection. after login with a new user, you should reinitialize all managers related to the chat connection
@tanmay-sambuq do you reproduce it without any changes in the code?
@b2bPrasad why do you comment on this line
CallManager.instance.destroy();
after commenting on this line your call manager doesn't configure for a new chat connection, it continues listening to the calls on the previous chat connection. after login with a new user, you should reinitialize all managers related to the chat connection
If I keep the .destroy() method below scenario fails for me - User A calls User B Call is hungUp either by A or B User A logs out and logs in again User A calls User B again - here User B does not receive the call.
below is the login code I have added -
CubeUser cubeUser = CubeUser(
id: int.parse(user.cubeId ?? '0'),
login: user.email,
password: user.appPassword,
fullName: user.firstname,
);
initConnectycube(
cubeUser,
user.appId ?? '',
user.authKey ?? '',
user.authSecret ?? '',
);
_loginToCC(event.context, cubeUser);
If User A refreshes the browser and tries to called User B, it works.
So the issue was that we were using a lower version, upgrading to the latest solved the issue for us.
@TatankaConCube thank you.
Hi,
I have a flutter web application which is using connectycube. Following is the usecase:
I can see the connection being established on the receiver end, but both users can only see the their respective video feeds. A white screen appears for the opponent.
Any suggestions?