Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to show incoming screen when receiver is in any part of the app? #51

Closed
ShyamKrishna122 opened this issue Dec 15, 2020 · 9 comments
Closed

Comments

@ShyamKrishna122
Copy link

No description provided.

@TatankaConCube
Copy link
Contributor

What do you mean? Please describe in detail which functionality you need.

@ShyamKrishna122
Copy link
Author

I have an app with 5 screens. When caller calls another person from one screen(chat screen) the receiver is receiving the incoming call if the receiver is also in the chat screen. But I want the receiver to get the incoming call when the receiver is in one of the 5 screens.

@TatankaConCube
Copy link
Contributor

What about a variant with the special manager that will listen to calls? You will init it after connecting to the chat and it will open an incoming screen after receiving a new call. Make sense? Or you mean another way?

@ShyamKrishna122
Copy link
Author

Yes,i want to listen for incoming calls in every screen but how to implement it? also, can u elaborate with a sample code snippet?

@TatankaConCube
Copy link
Contributor

can u elaborate with a sample code snippet?

do you mean manager?

@himanshukh
Copy link

Yes,i want to listen for incoming calls in every screen but how to implement it? also, can u elaborate with a sample code snippet?

Initialize P2PSession and P2PClient in a common environment. Create session and then create instant of these.. After that you can get call anywhere in your application.

@ShyamKrishna122
Copy link
Author

How to initialize p2psession and p2pclient in a common environment? Can u give an example?

@himanshukh
Copy link

How to initialize p2psession and p2pclient in a common environment? Can u give an example?

Step1: Create a Environment file and added P2PClient and P2PSession:

class Environment {
static P2PClient callClient;
static P2PSession currentCall;
}

Step2: Create session on your login screen after successful login or Create on first screen of your app if there is not any login screen.

Step3: Goto the screen which is first screen after login or your app.. Use Environment variable here and assign session instance.

void initState() {
super.initState();
_initCustomMediaConfigs();
_initCalls();
}

void _initCalls() {
Environment.callClient = P2PClient.instance;

Environment.callClient.init();
Environment.callClient.onReceiveNewSession = (callSession) {
if (Environment.currentCall != null &&
Environment.currentCall.sessionId != callSession.sessionId) {
callSession.reject();
return;
}
//_showIncomingCallScreen(callSession);
};

Environment.callClient.onSessionClosed = (callSession) {
if (Environment.currentCall != null &&
Environment.currentCall.sessionId == callSession.sessionId) {
Environment.currentCall = null;
}
};
}

void _initCustomMediaConfigs() {
RTCMediaConfig mediaConfig = RTCMediaConfig.instance;
mediaConfig.minHeight = 720;
mediaConfig.minWidth = 1280;
mediaConfig.minFrameRate = 30;
}

@TatankaConCube
Copy link
Contributor

No activity for a long time. Closing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants