Class ConnectOptions.Builder
- java.lang.Object
-
- com.twilio.video.ConnectOptions.Builder
-
- Enclosing class:
- ConnectOptions
public static class ConnectOptions.Builder extends java.lang.Object
Build newConnectOptions
.All methods are optional.
-
-
Constructor Summary
Constructors Constructor Description Builder(java.lang.String accessToken)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConnectOptions.Builder
audioTracks(java.util.List<LocalAudioTrack> audioTracks)
Audio tracks that will be published upon connection.ConnectOptions.Builder
bandwidthProfile(BandwidthProfileOptions bandwidthProfile)
Configure how the available downlink bandwidth is shared among theRemoteVideoTrack
s you have subscribed to in a Group or Small-Group Room.ConnectOptions
build()
BuildsConnectOptions
object.ConnectOptions.Builder
dataTracks(java.util.List<LocalDataTrack> dataTracks)
Data tracks that will be published upon connection.ConnectOptions.Builder
enableAutomaticSubscription(boolean enableAutomaticSubscription)
Toggles automatic track subscription.ConnectOptions.Builder
enableDominantSpeaker(boolean enableDominantSpeaker)
Enable reporting of aRoom
's dominant speaker.ConnectOptions.Builder
enableIceGatheringOnAnyAddressPorts(boolean enable)
Enable gathering of ICE candidates on "any address" ports.ConnectOptions.Builder
enableInsights(boolean enable)
Enable sending stats data to Insights.ConnectOptions.Builder
enableNetworkQuality(boolean enableNetworkQuality)
Enable or disable the Network Quality API.ConnectOptions.Builder
encodingParameters(EncodingParameters encodingParameters)
SetEncodingParameters
for audio and video tracks shared to aRoom
.ConnectOptions.Builder
iceOptions(IceOptions iceOptions)
Custom ICE configuration used to connect to a Room.ConnectOptions.Builder
networkQualityConfiguration(NetworkQualityConfiguration networkQualityConfiguration)
Sets the verbosity level for network quality information returned by the Network Quality API.ConnectOptions.Builder
preferAudioCodecs(java.util.List<AudioCodec> preferredAudioCodecs)
Set preferred audio codecs.ConnectOptions.Builder
preferVideoCodecs(java.util.List<VideoCodec> preferredVideoCodecs)
Set preferred video codecs.ConnectOptions.Builder
region(java.lang.String region)
The region of the signaling Server the Client will use.ConnectOptions.Builder
roomName(java.lang.String roomName)
The name of the room.ConnectOptions.Builder
videoEncodingMode(VideoEncodingMode videoEncodingMode)
SetVideoEncodingMode
.ConnectOptions.Builder
videoTracks(java.util.List<LocalVideoTrack> videoTracks)
Video tracks that will be published upon connection.
-
-
-
Method Detail
-
roomName
@NonNull public ConnectOptions.Builder roomName(@NonNull java.lang.String roomName)
The name of the room.
-
audioTracks
@NonNull public ConnectOptions.Builder audioTracks(@NonNull java.util.List<LocalAudioTrack> audioTracks)
Audio tracks that will be published upon connection.
-
videoTracks
@NonNull public ConnectOptions.Builder videoTracks(@NonNull java.util.List<LocalVideoTrack> videoTracks)
Video tracks that will be published upon connection.
-
dataTracks
@NonNull public ConnectOptions.Builder dataTracks(@NonNull java.util.List<LocalDataTrack> dataTracks)
Data tracks that will be published upon connection.
-
iceOptions
@NonNull public ConnectOptions.Builder iceOptions(@NonNull IceOptions iceOptions)
Custom ICE configuration used to connect to a Room.
-
enableIceGatheringOnAnyAddressPorts
@NonNull public ConnectOptions.Builder enableIceGatheringOnAnyAddressPorts(boolean enable)
Enable gathering of ICE candidates on "any address" ports. When this flag is set, ports not bound to any specific network interface will be used, in addition to normal ports bound to the enumerated interfaces. This flag may need to be set to support certain network configurations (e.g. some VPN implementations) where ports are not bound to specific interfaces. Setting this flag means that additional candidates might need to be gathered and evaluated, which could lead to slower ICE connection times for regular networks.
-
enableInsights
@NonNull public ConnectOptions.Builder enableInsights(boolean enable)
Enable sending stats data to Insights. Sending stats data to Insights is enabled by default.
-
enableAutomaticSubscription
@NonNull public ConnectOptions.Builder enableAutomaticSubscription(boolean enableAutomaticSubscription)
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.
-
enableDominantSpeaker
@NonNull public ConnectOptions.Builder enableDominantSpeaker(boolean enableDominantSpeaker)
-
enableNetworkQuality
@NonNull public ConnectOptions.Builder enableNetworkQuality(boolean enableNetworkQuality)
Enable or disable the Network Quality API.Set this to
true
to enable the Network Quality API when using Group Rooms. This option has no effect in Peer-to-Peer Rooms. The default value isfalse
.
-
networkQualityConfiguration
@NonNull public ConnectOptions.Builder networkQualityConfiguration(@NonNull NetworkQualityConfiguration networkQualityConfiguration)
Sets the verbosity level for network quality information returned by the Network Quality API.If a
NetworkQualityConfiguration
is not provided, the default configuration is used:NetworkQualityVerbosity.NETWORK_QUALITY_VERBOSITY_MINIMAL
for the Local Participant andNetworkQualityVerbosity.NETWORK_QUALITY_VERBOSITY_NONE
for the Remote Participants.
-
preferAudioCodecs
@NonNull public ConnectOptions.Builder preferAudioCodecs(@NonNull java.util.List<AudioCodec> preferredAudioCodecs)
Set preferred audio codecs. The list specifies which audio codecs would be preferred when negotiating audio between participants. The preferences are applied in the order found in the list starting with the most preferred audio codec to the least preferred audio codec. Audio codec preferences are not guaranteed to be satisfied because not all participants are guaranteed to support all audio codecs.OpusCodec
is the default audio codec if no preferences are set.The following snippet demonstrates how to prefer a single audio codec.
ConnectOptions connectOptions = new ConnectOptions.Builder(token) .preferAudioCodecs(Collections.<AudioCodec>singletonList(new IsacCodec())) .build();
The following snippet demonstrates how to specify the exact order of codec preferences.
ConnectOptions connectOptions = new ConnectOptions.Builder(token) .preferAudioCodecs(Arrays.asList(new IsacCodec(), new G722Codec(), new OpusCodec())) .build();
-
preferVideoCodecs
@NonNull public ConnectOptions.Builder preferVideoCodecs(@NonNull java.util.List<VideoCodec> preferredVideoCodecs)
Set preferred video codecs. The list specifies which video codecs would be preferred when negotiating video between participants. The preferences are applied in the order found in the list starting with the most preferred video codec to the least preferred video codec. Video codec preferences are not guaranteed to be satisfied because not all participants are guaranteed to support all video codecs.Vp8Codec
is the default video codec if no preferences are set. Attempting to set preferred video codecs when video encoding mode is set to AUTO will throw an exception.The following snippet demonstrates how to prefer a single video codec.
ConnectOptions connectOptions = new ConnectOptions.Builder(token) .preferVideoCodecs(Collections.<VideoCodec>singletonList(new H264Codec())) .build();
The following snippet demonstrates how to specify the exact order of codec preferences.
ConnectOptions connectOptions = new ConnectOptions.Builder(token) .preferVideoCodecs(Arrays.asList(new H264Codec(), new Vp8Codec(), new Vp9Codec())) .build();
-
region
@NonNull public ConnectOptions.Builder region(@NonNull java.lang.String region)
The region of the signaling Server the Client will use. By default, the Client will connect to the nearest signaling Server determined by latency based routing. Setting a value other than "gll" bypasses routing and guarantees that signaling traffic will be terminated in the region that you prefer. If you are connecting to a Group Room created with the "gll" Media Region (either Ad-Hoc or via the REST API), then the Room's Media Region will be selected based upon your Client's region. The default value is `gll`.
-
encodingParameters
@NonNull public ConnectOptions.Builder encodingParameters(@NonNull EncodingParameters encodingParameters)
SetEncodingParameters
for audio and video tracks shared to aRoom
. Attempting to setEncodingParameters.maxVideoBitrate
when video encoding mode is set to AUTO, will throw an exception.
-
bandwidthProfile
@NonNull public ConnectOptions.Builder bandwidthProfile(@Nullable BandwidthProfileOptions bandwidthProfile)
Configure how the available downlink bandwidth is shared among theRemoteVideoTrack
s you have subscribed to in a Group or Small-Group Room. This property has no effect in Peer-to-Peer Rooms.- Parameters:
bandwidthProfile
- The profile to use.- Returns:
-
videoEncodingMode
@NonNull public ConnectOptions.Builder videoEncodingMode(@Nullable VideoEncodingMode videoEncodingMode)
SetVideoEncodingMode
. Setting it to AUTO will let the SDK select the codecs and manage encodings automatically. It is null by default, which allows manually setting preferred video codecs and/or max video bitrate. Attempting to set videoEncodingMode when either maxVideoBitrate (part of EncodingParameters) or preferVideoCodecs is set will throw an exception.
-
build
@NonNull public ConnectOptions build()
BuildsConnectOptions
object.
-
-