Created
March 25, 2020 16:54
-
-
Save abbas-oveissi/ffb79318083a7b57dbaedc32e27d97d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void connectToRoom(String roomName) { | |
configureAudio(true); | |
ConnectOptions.Builder connectOptionsBuilder = new ConnectOptions.Builder(accessToken) | |
.roomName(roomName); | |
/* | |
* Add local audio track to connect options to share with participants. | |
*/ | |
if (localAudioTrack != null) { | |
connectOptionsBuilder | |
.audioTracks(Collections.singletonList(localAudioTrack)); | |
} | |
/* | |
* Add local video track to connect options to share with participants. | |
*/ | |
if (localVideoTrack != null) { | |
connectOptionsBuilder.videoTracks(Collections.singletonList(localVideoTrack)); | |
} | |
/* | |
* Set the preferred audio and video codec for media. | |
*/ | |
connectOptionsBuilder.preferAudioCodecs(Collections.singletonList(audioCodec)); | |
connectOptionsBuilder.preferVideoCodecs(Collections.singletonList(videoCodec)); | |
/* | |
* Set the sender side encoding parameters. | |
*/ | |
encodingParameters = getEncodingParameters(); | |
connectOptionsBuilder.encodingParameters(encodingParameters); | |
/* | |
* Toggles automatic track subscription. If set to false, the LocalParticipant will receive | |
* notifications of track publish events, but will not automatically subscribe to them. If | |
* set to true, the LocalParticipant will automatically subscribe to tracks as they are | |
* published. If unset, the default is true. Note: This feature is only available for Group | |
* Rooms. Toggling the flag in a P2P room does not modify subscription behavior. | |
*/ | |
connectOptionsBuilder.enableAutomaticSubscription(true); | |
room = Video.connect(getContext(), connectOptionsBuilder.build(), roomListener()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment