Skip to content

Instantly share code, notes, and snippets.

@ktoraskartwilio
Created August 17, 2018 00:37
Show Gist options
  • Save ktoraskartwilio/6257f4c2d4f42d5513756aa3ca59ee6b to your computer and use it in GitHub Desktop.
Save ktoraskartwilio/6257f4c2d4f42d5513756aa3ca59ee6b to your computer and use it in GitHub Desktop.
Twilio Video Android code snippet showing how to force TURN
public void connectToRoom(String roomName) {
ConnectOptions connectOptions = new ConnectOptions.Builder(accessToken)
.roomName(roomName)
.audioTracks(localAudioTracks)
.videoTracks(localVideoTracks)
.iceTransportPolicy(IceTransportPolicy.RELAY)
.build();
room = Video.connect(context, connectOptions, this);
}
private Room.Listener roomListener() {
return new Room.Listener() {
@Override
public void onConnected(Room room) {
Log.d(TAG,"Connected to " + room.getName());
}
}
}
@kbagchiGWC
Copy link

You need to implement all the callback methods of Room.Listener.

 private Room.Listener roomListener() {
        return new Room.Listener() {
            @Override
            public void onConnected(Room room) {
        
            }

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

            @Override
            public void onDisconnected(Room room, TwilioException e) {
               
            }

            @Override
            public void onParticipantConnected(Room room, RemoteParticipant remoteParticipant) {
            
            }

            @Override
            public void onParticipantDisconnected(Room room, RemoteParticipant remoteParticipant) {
               
            }

            @Override
            public void onRecordingStarted(Room room) {
             
            }

            @Override
            public void onRecordingStopped(Room room) {
               
            }
        };
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment