ConnectyCube / connectycube-reactnative-samples

Chat and Video Chat code samples for React Native, ConnectyCube
https://connectycube.com
Apache License 2.0
125 stars 111 forks source link

onCallListener called but onRemoteStreamListener is not #83

Closed whenmoon closed 4 years ago

whenmoon commented 4 years ago

I have the following code where the onCallListener callback if fired, but the onRemoteStreamListener is not:

    try {
      const connectyCubeSession = await createSession();
      ConnectyCube.init(...getConfig(connectyCubeSession.token));
      ConnectyCube.videochat.onCallListener = (session, extension) => {
      // this is called when an incoming call occurs
        store.dispatch(incomingCall(session, extension));
      }
      ConnectyCube.videochat.onRemoteStreamListener = (...args) => {
      // this call back is never called when an incoming call occurs
      }
      ConnectyCube.videochat.onSessionConnectionStateChangedListener = (...args) => {
        store.dispatch(connectionStateChange(...args));
      };
      const connectyCubeUserProfile = await logInToConnectycube(userCredentials);
      store.dispatch(userData({ connectyCubeUserProfile }));
      await connectToChat(connectyCubeSession, connectyCubeUserProfile);
    } catch (error) {

I am running this code when a HeadlessJS task is triggered in the background on Android. The session and extension are received by the onCallListener but for some reason a remote stream is never received. I have tried moving the listeners to after the SDK is connected to chat, but it makes no difference. What could be the problem?

I'm using RN v 0.61.4 and "react-native-connectycube": "^3.0.1",

Thanks.

banshiAnton commented 4 years ago

Hi @whenmoon do you accept the call in onCallListener ?

whenmoon commented 4 years ago

Actually that's a good point - this particular code is for a new user journey / call answer flow that is triggered by a notification button press.

So the call has to be accepted for the remote stream listener to be triggered?

DaveLomber commented 4 years ago

@whenmoon correct the real streams exchange happens after the remote party accepted the call

whenmoon commented 4 years ago

Ok got it - thanks that must be the problem. I'll close the issue then cheers.

masihurmaruf commented 4 years ago

hi @whenmoon i am also having the similar problem. Can you please share how you have solved it?