Session.Builder

public static class Builder

Enclosing class: Session

Nested types: Session.Builder.IncludeServers, Session.Builder.TransportPolicy, Session.Builder.IceServer

Methods

Name Description
Builder(context, apiKey, sessionId) Use this builder to create a Session instance.
build() → {Session} Returns a new Session instance based on the Session.Builder settings.
connectionEventsSuppressed(enabled) → {Session.Builder} Prevent connection events (such as Session.ConnectionListener#onConnectionCreated(Session session, Connection connection)) from being dispatched.
sessionOptions(sessionOptions) → {Session.Builder} Sets advanced options for the session.
setApiUrl(apiUrl) → {Session.Builder} Sets the server Url.
setCustomIceServers(serverList, config) → {Session.Builder} Sets the list of custom TURN servers to be used by the client in this session.
setIceRouting(routing) → {Session.Builder} Set the TURN server transport policy to be used by the client in this session.
setIpWhitelist(enabled) → {Session.Builder} Set this to true if the allowed IP list feature is enabled for your project.
setProxyUrl(proxyUrl) → {Session.Builder} Set this to the URL of the IP proxy server.
setSessionMigration(enable) → {Session.Builder} Enables the session migration feature, allowing the client to remain connected during server rotation.
setSinglePeerConnection(enable) → {Session.Builder} Single Peer Connection (SPC) is a feature that encapsulates all subscriber connections to a single peer connection.

Builder(context, apiKey, sessionId)

Use this builder to create a Session instance.

Parameters:
Name Type Description
context Context The Android application context associated with this process.
apiKey String 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 String 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: : - setSessionListener(com.opentok.android.Session.SessionListener)

build() → {Session}

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

Returns:

Session

connectionEventsSuppressed(enabled) → {Session.Builder}

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

The default value is false.

Parameters:
Name Type Description
enabled Boolean
Returns:

Session.Builder

sessionOptions(sessionOptions) → {Session.Builder}

Sets advanced options for the session.

Parameters:
Name Type Description
sessionOptions Session.SessionOptions

See: : - Session.SessionOptions

Returns:

Session.Builder

setApiUrl(apiUrl) → {Session.Builder}

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

Deprecated

Parameters:
Name Type Description
apiUrl URL
Returns:

Session.Builder

setCustomIceServers(serverList, config) → {Session.Builder}

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

Parameters:
Name Type Description
serverList List<Session.Builder.IceServer>
config Session.Builder.IncludeServers
Returns:

Session.Builder

setIceRouting(routing) → {Session.Builder}

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

Parameters:
Name Type Description
routing Session.Builder.TransportPolicy
Returns:

Session.Builder

setIpWhitelist(enabled) → {Session.Builder}

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.

Parameters:
Name Type Description
enabled boolean
Returns:

Session.Builder

setProxyUrl(proxyUrl) → {Session.Builder}

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.

Parameters:
Name Type Description
proxyUrl String
Returns:

Session.Builder

setSessionMigration(enable) → {Session.Builder}

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.

Parameters:
Name Type Description
enable boolean
Returns:

Session.Builder

setSinglePeerConnection(enable) → {Session.Builder}

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.

Parameters:
Name Type Description
enable boolean
Returns:

Session.Builder