java.lang.Object

com.opentok.android.Session.Builder

Enclosing class: : Session


public static class Session.Builder extends Object

Nested Class Summary

Nested Classes

Modifier and Type

Class

Description

static class

Session.Builder.IceServer

Defines a custom TURN server used in the setCustomIceServers(List, IncludeServers) method.

static enum

Session.Builder.IncludeServers

Defines settings for whether to use only your custom TURN servers or to use those servers in addition to Vonage Video API TURN servers.

static enum

Session.Builder.TransportPolicy

Defines settings for whether to use all ICE transport types (such as host, srflx, and TURN) to establish media connectivity or to only use TURN.

Constructor Summary

Constructors

Constructor

Description

Builder(android.content.Context context, String apiKey, String sessionId)

Use this builder to create a Session instance.

Method Summary

All MethodsInstance MethodsConcrete MethodsDeprecated Methods

Modifier and Type

Method

Description

Session

build()

Returns a new Session instance based on the Session.Builder settings.

Session.Builder

connectionEventsSuppressed(Boolean enabled)

Prevent connection events (such as Session.ConnectionListener.onConnectionCreated(Session session, Connection connection)) from being dispatched.

Session.Builder

sessionOptions(Session.SessionOptions sessionOptions)

Sets advanced options for the session.

Session.Builder

setApiUrl(URL apiUrl)

Deprecated.

Session.Builder

setCustomIceServers(List<Session.Builder.IceServer> serverList, Session.Builder.IncludeServers config)

Sets the list of custom TURN servers to be used by the client in this session.

Session.Builder

setIceRouting(Session.Builder.TransportPolicy routing)

Set the TURN server transport policy to be used by the client in this session.

Session.Builder

setIpWhitelist(boolean enabled)

Set this to true if the allowed IP list feature is enabled for your project.

Session.Builder

setProxyUrl(String proxyUrl)

Set this to the URL of the IP proxy server.

Session.Builder

setSessionMigration(boolean enable)

Enables the session migration feature, allowing the client to remain connected during server rotation.

Session.Builder

setSinglePeerConnection(boolean enable)

Single Peer Connection (SPC) is a feature that encapsulates all subscriber connections to a single peer connection.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

Builder

public Builder(android.content.Context context, String apiKey, String sessionId)

Use this builder to create a Session instance.

Parameters: : context - The Android application context associated with this process. : apiKey - Your OpenTok API key. See your Vonage Video API account page. Important: If you are using the Video API with a Vonage application (instead of an OpenTok project), pass in the application ID (not an OpenTok API key) for this parameter. : sessionId - The OpenTok session ID this instance should connect to. For test purposes, you can generate test session by logging into your Vonage Video API account. Use the OpenTok server-side SDKs to generate session IDs in your shipping app.

See Also: : - Session.setSessionListener(com.opentok.android.Session.SessionListener)

Method Details

connectionEventsSuppressed

public Session.Builder connectionEventsSuppressed(Boolean enabled)

Prevent connection events (such as Session.ConnectionListener.onConnectionCreated(Session session, Connection connection)) from being dispatched.

The default value is false.

sessionOptions

public Session.Builder sessionOptions(Session.SessionOptions sessionOptions)

Sets advanced options for the session.

See Also: : - Session.SessionOptions

setCustomIceServers

public Session.Builder setCustomIceServers(List<Session.Builder.IceServer> serverList, Session.Builder.IncludeServers config)

Sets the list of custom TURN servers to be used by the client in this session. See the configurable TURN servers developer guide.

setIceRouting

public Session.Builder setIceRouting(Session.Builder.TransportPolicy routing)

Set the TURN server transport policy to be used by the client in this session. See the configurable TURN servers developer guide.

setApiUrl

@Deprecated public Session.Builder setApiUrl(URL apiUrl)

Deprecated.

Sets the server Url. This parameter is meant for testing purposes.

setIpWhitelist

public Session.Builder setIpWhitelist(boolean enabled)

Set this to true if the allowed IP list feature is enabled for your project. (This is available as an add-on feature.) The default value is false.

setProxyUrl

public Session.Builder setProxyUrl(String proxyUrl)

Set this to the URL of the IP proxy server. This is available as an add-on feature. See the OpenTok pricing page and the IP proxy developer guide.

setSinglePeerConnection

public Session.Builder setSinglePeerConnection(boolean enable)

Single Peer Connection (SPC) is a feature that encapsulates all subscriber connections to a single peer connection. The benefits of enabling SPC include reduced OS resource consumption, improved rate control, and, in case of mobile native devices, support for larger sessions.

SPC is disabled by default. When disabled, the session will use Multiple Peer Connection (MPC), where a separate peer connection is established between each endpoint.

setSessionMigration

public Session.Builder setSessionMigration(boolean enable)

Enables the session migration feature, allowing the client to remain connected during server rotation. The default value is false (session migration is not enabled). For more information, see Server Rotation and Session Migration.

build

public Session build()

Returns a new Session instance based on the Session.Builder settings.