-1

friends I had implemented Twillio Video call in my Android application its working fine in the availability of the network.But I am facing an issue in case of network lost.

Test Cases:-

  1. Device A call to Device B.
  2. Both connected to Room successfully.and video call working fine.
  3. Sudden Device B lost the network connection at this time the call is continuous this is a bug.

Expected :- Both have to disconnect from the room. Actual:- they are still in connection

Please help if anybody implement this.

Farhana Naaz Ansari
  • 7,524
  • 26
  • 65
  • 105

2 Answers2

0

Use connection check method in your class detect app have connection or not if doesnt have connnection you can call the method of call disconnect. If twillio is not disconnecting the call you can disconnect the call by yourself.

pooja majoka
  • 136
  • 4
0

While initializing Room, we are providing listeners to it.

    ConnectOptions.Builder connectOptionsBuilder = new ConnectOptions.Builder(mAccessToken);
    Room mRoom = Video.connect(this, connectOptionsBuilder.build(), new Room.Listener() {
                @Override
                public void onConnected(Room room) {

                }

                @Override
                public void onConnectFailure(Room room, TwilioException twilioException) {

                }

                @Override
                public void onDisconnected(Room room, TwilioException twilioException) {
                           String leftParticipantName = room.getName();// name of participant who has left
                           // Here you can end/disconnect your conversation.

                }

                @Override
                public void onParticipantConnected(Room room, Participant participant) {

                }

                @Override
                public void onParticipantDisconnected(Room room, Participant participant) {

                }

                @Override
                public void onRecordingStarted(Room room) {

                }

                @Override
                public void onRecordingStopped(Room room) {

                }
            });

From this method you can disconnect your video-conversation.

For disconnect:

if (mRoom != null) {
    mRoom.disconnect();
}
Rumit Patel
  • 8,830
  • 18
  • 51
  • 70
  • Yes !! You are right Rumit we got these listeners.These listeners are working if we have network connection but what will we do when one of them lost the network.how to disconnect the users from the Room. – Radha Soni Feb 12 '18 at 08:14
  • @RadhaSoni , A.F.A.I.K, we will not need to disconnect user after opponent left Room. and Logically we should not need to disconnect user after left Room. – Rumit Patel Feb 12 '18 at 08:44
  • you mean we cant do anything after the Room is joined by both of them in case of network disconnect. – Radha Soni Feb 12 '18 at 09:14
  • yes, but opponent can reconnect same room although. – Rumit Patel Feb 12 '18 at 09:45
  • But its a major bug when call is paid to users. – Radha Soni Feb 12 '18 at 10:23
  • I already told "opponent can reconnect same room although.". and we also can restrict opponent to reconnect. it depends on our requirement. hope you understand @RadhaSoni – Rumit Patel Feb 12 '18 at 10:44