Session.SessionListener

public abstract static interface SessionListener

Enclosing class: Session

Monitors state changes in a Session object.

Methods

Name Description
onConnected(session) Invoked when the client connects to the OpenTok session.
onDisconnected(session) Invoked when the client is no longer connected to the OpenTok session.
onError(session, error) Invoked when something goes wrong when connecting or connected to the session.
onStreamDropped(session, stream) Invoked when another client stops publishing a stream to this OpenTok session.
onStreamReceived(session, stream) Invoked when a there is a new stream published by another client in this OpenTok session.

onConnected(session)

Invoked when the client connects to the OpenTok session.

Parameters:
Name Type Description
session Session The session your client connected to.

onDisconnected(session)

Invoked when the client is no longer connected to the OpenTok session.

Parameters:
Name Type Description
session Session The session your client disconnected from.

onError(session, error)

Invoked when something goes wrong when connecting or connected to the session. After this method is invoked, the Session should be treated as dead and unavailable. Do not attempt to reconnect or to call other methods of the Session object.

This method is called if the attempt to connect to the session fails. It is also called if the connection to the session drops due to an error after a successful connection, and in this case the method is called just before the Session.SessionListener#onDisconnected(Session session) method is called.

Parameters:
Name Type Description
session Session The session in which the error occurred.
error OpentokError An error describing the cause for error.

onStreamDropped(session, stream)

Invoked when another client stops publishing a stream to this OpenTok session.

Parameters:
Name Type Description
session Session The session from which the stream was removed.
stream Stream A Stream object representing the dropped stream, which can be used to identify a Subscriber.

onStreamReceived(session, stream)

Invoked when a there is a new stream published by another client in this OpenTok session.

Parameters:
Name Type Description
session Session The session in which the stream was added.
stream Stream A Stream object representing the new stream, which can be used to create a Subscriber.