java.lang.Object

com.opentok.android.SubscriberKit

All Implemented Interfaces: : Observer

Direct Known Subclasses: : Subscriber


public class SubscriberKit extends Object implements Observer

A SubscriberKit (subscriber) object renders media data bound to a Stream The SubscriberKit class lets you set a custom video renderer for the video stream. Create a subclass of SubscriberKit if you are interested in providing your own video processing and rendering implementation. Otherwise, use the Subscriber class, which includes a pre-built video processor and renderer.

The stream property references the stream that you have subscribed to. The SubscriberKit class includes methods that let you disable and enable local audio and video playback for the subscribed stream.

Nested Class Summary

Nested Classes

Modifier and Type

Class

Description

static interface

SubscriberKit.AudioLevelListener

Monitors changes in the audio level of the subscriber.

static interface

SubscriberKit.AudioStatsListener

Defines the listener object for getting subscriber audio statistics.

static class

SubscriberKit.Builder

Used to build a SubscriberKit object.

static interface

SubscriberKit.CaptionsListener

A listener for updated caption text.

static interface

SubscriberKit.MediaLinkStatsListener

Defines the listener object for getting subscriber media link statistics, including transport-level metrics and network condition changes.

static class

SubscriberKit.SenderStats

Represents video statistics reported by the sender side, such as bitrate estimates.

static interface

SubscriberKit.StreamListener

Monitors when the subscriber's stream is interrupted and resumes.

static class

SubscriberKit.SubscriberAudioStats

Defines audio statistics for a subscriber.

static interface

SubscriberKit.SubscriberListener

Monitors state changes of a SubscriberKit instance.

static class

SubscriberKit.SubscriberMediaLinkStats

Provides subscriber media link statistics including local and remote transport metrics and network degradation information.

static interface

SubscriberKit.SubscriberRtcStatsReportListener

Defines the listener object for getting subscriber RTC stats reports.

static class

SubscriberKit.SubscriberVideoStats

Defines video statistics for a subscriber.

static interface

SubscriberKit.VideoListener

Monitors when the subscriber starts and stops receiving video data.

static interface

SubscriberKit.VideoStatsListener

Defines the listener object for getting subscriber video statistics.

Field Summary

Fields

Modifier and Type

Field

Description

protected SubscriberKit.AudioLevelListener

audioLevelListener

protected SubscriberKit.AudioStatsListener

audioStatsListener

protected SubscriberKit.CaptionsListener

captionsListener

protected SubscriberKit.MediaLinkStatsListener

mediaLinkStatsListener

static final String

NETWORK_REASON_NETWORK_CONDITION_CHANGE

Indicates that the local or remote participant’s network condition has changed.

static final float

NO_PREFERRED_FRAMERATE

Defines a reset value to passed into the setPreferredFrameRate(float preferredFrameRate) method.

static final VideoUtils.Size

NO_PREFERRED_RESOLUTION

Defines a reset value to passed into the setPreferredResolution(VideoUtils.Size preferredResolution) method.

protected BaseVideoRenderer

renderer

protected SubscriberKit.SubscriberRtcStatsReportListener

rtcStatsReportListener

protected Session

session

protected Stream

stream

protected SubscriberKit.StreamListener

streamListener

protected SubscriberKit.SubscriberListener

subscriberListener

static final String

VIDEO_REASON_CODEC_CHANGE

The video codec for the stream has changed.

static final String

VIDEO_REASON_CODEC_NOT_SUPPORTED

The video event was caused when video in the the subscriber stream was disabled because the stream uses a video codec (such as H.264) not supported on the device.

static final String

VIDEO_REASON_INTERRUPTION

The video stream was interrupted.

static final String

VIDEO_REASON_NONE

static final String

VIDEO_REASON_PUBLISH_VIDEO

The video event was caused by the stream's publisher starting or stopping the video stream.

static final String

VIDEO_REASON_QUALITY

The video event was caused by a change to the video stream quality.

static final String

VIDEO_REASON_RESOLUTION_CHANGE

The resolution for the stream has changed.

static final String

VIDEO_REASON_SUBSCRIBE_TO_VIDEO

The video event was caused by a call to the setSubscribeToVideo(boolean subscribeToVideo) method.

protected SubscriberKit.VideoListener

videoListener

protected SubscriberKit.VideoStatsListener

videoStatsListener

Constructor Summary

Constructors

Modifier

Constructor

Description

protected

SubscriberKit(SubscriberKit.Builder builder)

Method Summary

All MethodsInstance MethodsConcrete MethodsDeprecated Methods

Modifier and Type

Method

Description

protected void

attachToSession(Session session)

void

destroy()

Deprecated.

protected void

detachFromSession(Session session)

protected void

finalize()

Called by the garbage collector on an SubscriberKit object when garbage collection determines that there are no more references to the object.

double

getAudioVolume()

Returns the audio volume, between 0 and 100, of the subscriber.

String

getCaptionsTranslationLanguage()

Gets the configured caption translation language for this subscriber.

float

getPreferredFrameRate()

Returns the preferred frame rate for the subscriber's stream.

VideoUtils.Size

getPreferredResolution()

Returns the preferred resolution for the subscriber's stream.

BaseVideoRenderer

getRenderer()

Returns the video renderer for this subscriber.

void

getRtcStatsReport()

Gets the RTC stats report for the subscriber.

Session

getSession()

Returns the Session that the subscriber is bound to (by calling the connect() method of the Session object).

Stream

getStream()

Returns the Stream that this instance is bound to.

boolean

getSubscribeToAudio()

Whether the Subscriber is subscribing to audio or not.

boolean

getSubscribeToCaptions()

Whether the Subscriber is subscribing to captions or not.

boolean

getSubscribeToVideo()

Whether the Subscriber is subscribing to audio or not.

android.view.View

getView()

Returns the android.view.View object that contains the Subscriber video.

protected void

onAudioDisabled()

Called when the subscriber's stream audio has been disabled

protected void

onAudioEnabled()

Called when the subscriber's stream has the audio enabled.

protected void

onAudioLevelUpdated(float audioLevel)

protected void

onCaptionText(String text, boolean isFinal)

protected void

onConnected()

Invoked when the instance has successfully connected to the stream and begins playing media.

protected void

onDisconnected()

Deprecated.

protected void

onError(OpentokError error)

Invoked when a subscriber has failed to connect to the OpenTok server.

void

onPause()

Do not call directly; call Session.onPause() instead.

void

onResume()

Do not call directly; call Session.onResume() instead.

protected void

onRtcStatsReport(String jsonArrayOfReports)

Called when the subscriber's RTC stats report is available in response to a call to getRtcStatsReport().

protected void

onStreamDisconnected()

Called when the subscriber's stream has been interrupted.

protected void

onStreamReconnected()

Called when the subscriber's stream has resumed, after the onStreamDisconnected() method is called.

protected void

onVideoDataReceived()

Invoked when an subscriber initially receives video data.

protected void

onVideoDisabled(String reason)

Called when the subscriber stops receiving video.

protected void

onVideoDisableWarning()

Called when the OpenTok Media Router determines that the stream quality has degraded and the video will be disabled if the quality degrades further.

protected void

onVideoDisableWarningLifted()

Called when the OpenTok Media Router determines that the stream quality has improved to the point at which the video being disabled is not an immediate risk.

protected void

onVideoEnabled(String reason)

Called when the subscriber's video stream starts (when there previously was no video) or resumes (after video was disabled).

void

setAudioLevelListener(SubscriberKit.AudioLevelListener listener)

Binds an SubscriberKit.AudioLevelListener to this SubscriberKit instance to monitor audio level updates.

void

setAudioStatsListener(SubscriberKit.AudioStatsListener listener)

Sets up a listener for subscriber audio statistics.

void

setAudioVolume(double volume)

Sets the audio volume, between 0 and 100, of the subscriber.

void

setCaptionsListener(SubscriberKit.CaptionsListener listener)

Binds a SubscriberKit.CaptionsListener to this SubscriberKit instance to receive captions.

void

setCaptionsTranslationLanguage(String language)

Sets the preferred caption translation language for this subscriber.

void

setMediaLinkStatsListener(SubscriberKit.MediaLinkStatsListener listener)

Sets up a listener for subscriber media link statistics.

void

setPreferredFrameRate(float preferredFrameRate)

Sets the preferred frame rate for the subscriber's stream.

void

setPreferredResolution(VideoUtils.Size preferredResolution)

Sets the preferred resolution for the subscriber's stream.

void

setRenderer(BaseVideoRenderer renderer)

Deprecated.

void

setRtcStatsReportListener(SubscriberKit.SubscriberRtcStatsReportListener listener)

Sets the RTC stats report listener for the subscriber.

void

setStreamListener(SubscriberKit.StreamListener listener)

Sets up a listener for events related to the subscriber's stream being interrupted and resuming.

void

setStyle(String key, String value)

Set a style used by this subscriber.

void

setSubscriberListener(SubscriberKit.SubscriberListener listener)

Sets a SubscriberKit.SubscriberListener object to monitor state changes.

void

setSubscribeToAudio(boolean subscribeToAudio)

Whether to subscribe to the stream's audio (true) or not (false).

void

setSubscribeToCaptions(boolean subscribeToCaptions)

Whether to subscribe to the stream's captions (true) or not (false)..

void

setSubscribeToVideo(boolean subscribeToVideo)

Whether to subscribe to the stream's video (true) or not (false).

void

setVideoListener(SubscriberKit.VideoListener listener)

Sets a SubscriberKit.VideoListener object to monitor when the subscriber starts and stops receiving video.

void

setVideoStatsListener(SubscriberKit.VideoStatsListener listener)

Sets up a listener for subscriber video statistics.

void

update(Observable o, Object arg)

Deprecated.

Methods inherited from class java.lang.Object

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

Field Details

VIDEO_REASON_NONE

public static final String VIDEO_REASON_NONE

See Also: : - [Constant Field Values]

VIDEO_REASON_PUBLISH_VIDEO

public static final String VIDEO_REASON_PUBLISH_VIDEO

The video event was caused by the stream's publisher starting or stopping the video stream. This string is a value for the reason property of the

See Also: : - method. - method. - [Constant Field Values]

VIDEO_REASON_SUBSCRIBE_TO_VIDEO

public static final String VIDEO_REASON_SUBSCRIBE_TO_VIDEO

The video event was caused by a call to the setSubscribeToVideo(boolean subscribeToVideo) method.

See Also: : - SubscriberKit.VideoListener.onVideoDisabled(SubscriberKit, String) - SubscriberKit.VideoListener.onVideoEnabled(SubscriberKit, String) - [Constant Field Values]

VIDEO_REASON_QUALITY

public static final String VIDEO_REASON_QUALITY

The video event was caused by a change to the video stream quality. Stream quality may change due to network conditions or CPU usage on either the subscriber or publisher.

When enabled, audio fallback provides an event when the subscriber drops the video stream due to degraded video quality, resulting in the SubscriberKit.VideoListener.onVideoDisabled(SubscriberKit, String) method being called. When conditions improve, the video stream resumes, and the SubscriberKit.VideoListener.onVideoEnabled(SubscriberKit, String) method is called.

When the video stream is dropped, the subscriber continues to receive the audio stream, if there is one.

In routed sessions, the source of this event can be the Vonage Video Media Router (Subscriber Audio Fallback) or the publishing client (Publisher Audio Fallback). When the source is the publishing client, the event is followed by a Session.StreamPropertiesListener.onStreamHasVideoChanged(Session, Stream, boolean) callback dispatched by the session object, indicating that the subscribed video channel is no longer active. In general, this additional event indicates network degradation on the publisher’s side; however, subscriber-reported metrics can influence the publisher’s fallback decisions, which may complicate determining the exact source of the degradation.

In relayed sessions, the "quality" event is triggered exclusively due to the publisher’s internal audio-fallback logic (Publisher Audio Fallback). This event is not followed by any callback indicating that the video is inactive, as the stream may still be received by other subscribers with better network conditions. Note that in relayed sessions, although audio fallback events originate from the publisher, network degradation may occur on either the publisher or subscriber side.

See Also: : - method. - method. - [Constant Field Values]

VIDEO_REASON_CODEC_NOT_SUPPORTED

public static final String VIDEO_REASON_CODEC_NOT_SUPPORTED

The video event was caused when video in the the subscriber stream was disabled because the stream uses a video codec (such as H.264) not supported on the device.

See Also: : - [Constant Field Values]

VIDEO_REASON_INTERRUPTION

public static final String VIDEO_REASON_INTERRUPTION

The video stream was interrupted.

See Also: : - [Constant Field Values]

VIDEO_REASON_RESOLUTION_CHANGE

public static final String VIDEO_REASON_RESOLUTION_CHANGE

The resolution for the stream has changed.

See Also: : - [Constant Field Values]

VIDEO_REASON_CODEC_CHANGE

public static final String VIDEO_REASON_CODEC_CHANGE

The video codec for the stream has changed.

See Also: : - [Constant Field Values]

NETWORK_REASON_NETWORK_CONDITION_CHANGE

public static final String NETWORK_REASON_NETWORK_CONDITION_CHANGE

Indicates that the local or remote participant’s network condition has changed. This event is triggered when a significant change is detected in the publisher’s or subscriber's network condition.

See Also: : - [Constant Field Values]

NO_PREFERRED_RESOLUTION

public static final VideoUtils.Size NO_PREFERRED_RESOLUTION

Defines a reset value to passed into the setPreferredResolution(VideoUtils.Size preferredResolution) method. Pass in this value to reset the subscriber to have no preferred resolution. The subscriber will use the maximum resolution available, based on conditions.

This only applies to streams streams published using the scalable video feature.

NO_PREFERRED_FRAMERATE

public static final float NO_PREFERRED_FRAMERATE

Defines a reset value to passed into the setPreferredFrameRate(float preferredFrameRate) method. Pass in this value to reset the subscriber to have no preferred frame rate. The subscriber will use the maximum frame rate available, based on conditions.

This only applies to streams streams published using the scalable video feature.

See Also: : - [Constant Field Values]

videoStatsListener

protected SubscriberKit.VideoStatsListener videoStatsListener

audioStatsListener

protected SubscriberKit.AudioStatsListener audioStatsListener

mediaLinkStatsListener

protected SubscriberKit.MediaLinkStatsListener mediaLinkStatsListener

subscriberListener

protected SubscriberKit.SubscriberListener subscriberListener

rtcStatsReportListener

protected SubscriberKit.SubscriberRtcStatsReportListener rtcStatsReportListener

videoListener

protected SubscriberKit.VideoListener videoListener

audioLevelListener

protected SubscriberKit.AudioLevelListener audioLevelListener

captionsListener

protected SubscriberKit.CaptionsListener captionsListener

streamListener

protected SubscriberKit.StreamListener streamListener

session

protected Session session

renderer

protected BaseVideoRenderer renderer

stream

protected Stream stream

Constructor Details

SubscriberKit

protected SubscriberKit(SubscriberKit.Builder builder)

Method Details

destroy

@Deprecated public void destroy()

Deprecated.

Manually destroying the object is not safe. From version 2.17.0 on, this method doesn't do anything. Resources will be automatically released by the garbage collector.

setSubscriberListener

public void setSubscriberListener(SubscriberKit.SubscriberListener listener)

Sets a SubscriberKit.SubscriberListener object to monitor state changes.

Parameters: : listener - The SubscriberKit.SubscriberListener that monitors this SubscriberKit instance.

setVideoListener

public void setVideoListener(SubscriberKit.VideoListener listener)

Sets a SubscriberKit.VideoListener object to monitor when the subscriber starts and stops receiving video.

Parameters: : listener - The SubscriberKit.VideoListener instance.

setAudioLevelListener

public void setAudioLevelListener(SubscriberKit.AudioLevelListener listener)

Binds an SubscriberKit.AudioLevelListener to this SubscriberKit instance to monitor audio level updates.

Parameters: : listener - The SubscriberKit.AudioLevelListener that will monitor this instance. Set this to null to disconnect a listener and stop monitoring audio levels.

setCaptionsListener

public void setCaptionsListener(SubscriberKit.CaptionsListener listener)

Binds a SubscriberKit.CaptionsListener to this SubscriberKit instance to receive captions.

Parameters: : listener - The SubscriberKit.CaptionsListener that will monitor this instance. Set this to null to disconnect a listener and stop receiving captions.

setAudioVolume

public void setAudioVolume(double volume)

Sets the audio volume, between 0 and 100, of the subscriber. If the value is not in this range, it will be clamped to it.

Parameters: : volume - The volume of the subscriber.

getAudioVolume

public double getAudioVolume()

Returns the audio volume, between 0 and 100, of the subscriber.

The default value is 100.

setStreamListener

public void setStreamListener(SubscriberKit.StreamListener listener)

Sets up a listener for events related to the subscriber's stream being interrupted and resuming.

getSession

public Session getSession()

Returns the Session that the subscriber is bound to (by calling the connect() method of the Session object).

Returns: : The Session that the subscriber is bound to.

getStream

public Stream getStream()

Returns the Stream that this instance is bound to. Any media channels on the stream should be available for display/playback with this instance.

Returns: : The Stream that this instance is bound to.

getSubscribeToAudio

public boolean getSubscribeToAudio()

Whether the Subscriber is subscribing to audio or not.

Returns: : true if the Subscriber is subscribing to audio; false if it is not.

getSubscribeToVideo

public boolean getSubscribeToVideo()

Whether the Subscriber is subscribing to audio or not.

Returns: : true if the Subscriber is subscribing to audio; false if it is not.

getSubscribeToCaptions

public boolean getSubscribeToCaptions()

Whether the Subscriber is subscribing to captions or not.

Returns: : true if the Subscriber is subscribing to captions; false if it is not. The default value is the captions value of its publisher PublisherKit.setPublishCaptions(boolean).

setSubscribeToAudio

public void setSubscribeToAudio(boolean subscribeToAudio)

Whether to subscribe to the stream's audio (true) or not (false). Setting this property has no effect if the hasAudio method of the Stream object returns false.

Parameters: : subscribeToAudio - Whether to subscribe to the stream's audio (true) or not (false).

setSubscribeToVideo

public void setSubscribeToVideo(boolean subscribeToVideo)

Whether to subscribe to the stream's video (true) or not (false). Setting this property has no effect if the hasVideo method of the Stream object returns false.

Parameters: : subscribeToVideo - Whether to subscribe to the stream's video (true) or not (false).

setSubscribeToCaptions

public void setSubscribeToCaptions(boolean subscribeToCaptions)

Whether to subscribe to the stream's captions (true) or not (false)..

Parameters: : subscribeToCaptions - Whether to subscribe to the stream's captions (true) or not (false).

setCaptionsTranslationLanguage

public void setCaptionsTranslationLanguage(String language)

Sets the preferred caption translation language for this subscriber.

This setting only takes effect when captions are enabled. Set this to a supported BCP-47 language code to receive translated captions, or null to disable translation. The default value is null (no translation configured).

Supported language codes are defined in the server API spec.

This is a private beta feature.

Parameters: : language - A supported BCP-47 language code, or null to disable translation.

getCaptionsTranslationLanguage

public String getCaptionsTranslationLanguage()

Gets the configured caption translation language for this subscriber.

This is a private beta feature.

Returns: : The configured BCP-47 language code, or null if translation is not set.

setStyle

public void setStyle(String key, String value)

Set a style used by this subscriber.

By default, there is only one pre-defined style key: BaseVideoRenderer.STYLE_VIDEO_SCALE. You can set a value for this key to determine the scaling of the video. The following values are supported:

Calling this method is equivalent to calling getRenderer().setStyle(). However, if you extend this class, you can override this method to support other styles and behaviors.

Parameters: : key - The style to set. : value - The value you are setting the style to.

setRenderer

@Deprecated public void setRenderer(BaseVideoRenderer renderer)

Deprecated.

Set the video renderer for this subscriber.

This method is deprecated. Instead, call the SubscriberKit.Builder.renderer(BaseVideoRenderer renderer) method when using the Builder to create the SubscriberKit instance.

getRenderer

public BaseVideoRenderer getRenderer()

Returns the video renderer for this subscriber.

getView

public android.view.View getView()

Returns the android.view.View object that contains the Subscriber video.

setVideoStatsListener

public void setVideoStatsListener(SubscriberKit.VideoStatsListener listener)

Sets up a listener for subscriber video statistics. The listener object implements the SubscriberKit.VideoStatsListener.onVideoStats(SubscriberKit subscriber, SubscriberKit.SubscriberVideoStats stats) method. This method is called periodically to report the following:

  • Total video packets lost
  • Total video packets received
  • Total video bytes received

See Also: : - setAudioStatsListener(AudioStatsListener listener)

setAudioStatsListener

public void setAudioStatsListener(SubscriberKit.AudioStatsListener listener)

Sets up a listener for subscriber audio statistics. The listener object implements the SubscriberKit.AudioStatsListener.onAudioStats(SubscriberKit subscriber, SubscriberKit.SubscriberAudioStats stats) method. This method is called periodically to report the following:

  • Total audio packets lost
  • Total audio packets received
  • Total audio bytes received

See Also: : - setVideoStatsListener(VideoStatsListener listener)

setMediaLinkStatsListener

public void setMediaLinkStatsListener(SubscriberKit.MediaLinkStatsListener listener)

Sets up a listener for subscriber media link statistics. The listener object implements the SubscriberKit.MediaLinkStatsListener interface, which includes:

Parameters: : listener - The SubscriberKit.MediaLinkStatsListener instance, or null to remove the listener.

setPreferredResolution

public void setPreferredResolution(VideoUtils.Size preferredResolution)

Sets the preferred resolution for the subscriber's stream.

Limiting the video resolution and frame rate (see setPreferredFrameRate(float preferredFrameRate)) reduces the network and CPU usage on the subscribing client. You may want to use lower resolution based on the dimensions of subscriber's video in the app. You may want to use a lower frame rate or resolution for subscribers to a stream that is less important (and smaller) than other streams.

This method only applies when subscribing to a stream that uses the scalable video feature. Scalable video is available:

  • Only in sessions that use the OpenTok Media Router (sessions with the media mode set to routed).
  • Only for streams published by clients that support scalable video (see the documentation for the scalable video feature).

In streams that do not use scalable video, calling this method has no effect.

Note: The resolution for scalable video streams automatically adjusts for each subscriber, based on network conditions and CPU usage, even if you do not call this method. Call this method if you want to set a maximum resolution for this subscriber.

In streams that do not use scalable video, calling this method has no effect.

Not every resolution is available to a subscriber. When you set the preferred resolution, the OpenTok Android SDK picks the best resolution available that matches your constraints. The resolutions available depend on the maximum width and height the Publisher sets for the stream, which are returned by the Stream.getVideoWidth() and Stream.getVideoHeight() methods for the Stream object. Each of the resolutions available for a stream will use the same aspect ratio.

Pass in SubscriberKit.NO_PREFERRED_RESOLUTION to reset the subscriber to have no preferred resolution. The subscriber will use the maximum resolution available, based on conditions.

setPreferredFrameRate

public void setPreferredFrameRate(float preferredFrameRate)

Sets the preferred frame rate for the subscriber's stream.

Limiting the frame rate and video resolution (see setPreferredResolution(VideoUtils.Size preferredResolution)) reduces the network and CPU usage on the subscribing client. You may want to use lower resolution based on the dimensions of subscriber's video in the app. You may want to use a lower frame rate or resolution for subscribers to a stream that is less important (and smaller) than other streams.

This method only applies when subscribing to a stream that uses the scalable video feature. Scalable video is available:

  • Only in sessions that use the OpenTok Media Router (sessions with the media mode set to routed).
  • Only for streams published by clients that support scalable video (see the documentation for the scalable video feature).

In streams that do not use scalable video, calling this method has no effect.

Note: The frame rate for scalable video streams automatically adjusts for each subscriber, based on network conditions and CPU usage, even if you do not call this method. Call this method if you want to set a maximum frame rate for this subscriber.

The frame rates available are based on the value of the maximum frame rate available for the stream. When you set the preferred frame rate for the subscriber, the OpenTok Android SDK picks the best frame rate available that is closest to the preferred frame rate, based on the client's bandwidth and CPU constraints.

The actual frame rates available depend, dynamically, on network and CPU resources available to the publisher.

Pass in SubscriberKit.NO_PREFERRED_FRAMERATE to reset the subscriber to have no preferred frame rate. The subscriber will use the maximum frame rate available, based on conditions.

getPreferredResolution

public VideoUtils.Size getPreferredResolution()

Returns the preferred resolution for the subscriber's stream. This method only applies to streams published using the scalable video feature. See setPreferredResolution(VideoUtils.Size preferredResolution).

setRtcStatsReportListener

public void setRtcStatsReportListener(SubscriberKit.SubscriberRtcStatsReportListener listener)

Sets the RTC stats report listener for the subscriber. See getRtcStatsReport().

Parameters: : listener - The SubscriberKit.SubscriberRtcStatsReportListener object.

getRtcStatsReport

public void getRtcStatsReport()

Gets the RTC stats report for the subscriber. This is an asynchronous operation. Call the SubscriberKit#setRtcStatsReportListener(SubscriberRtcStatsReportListener listener) method, and then implement the SubscriberKit.SubscriberRtcStatsReportListener.onRtcStatsReport(SubscriberKit subscriber, String jsonArrayOfReports) method prior to calling this method. When the stats are available, the implementation of the SubscriberKit.SubscriberRtcStatsReportListener.onRtcStatsReport(SubscriberKit subscriber, String jsonArrayOfReports) method is called.

Also see setAudioStatsListener(SubscriberKit.AudioStatsListener listener), setVideoStatsListener(SubscriberKit.VideoStatsListener listener), and PublisherKit.getRtcStatsReport().

onRtcStatsReport

protected void onRtcStatsReport(String jsonArrayOfReports)

Called when the subscriber's RTC stats report is available in response to a call to getRtcStatsReport().

If you extend the SubscriberKit class, you can override this method instead of implementing the onRtcStatsReport() method of the SubscriberKit.SubscriberRtcStatsReportListener interface.

See onRtcStatsReport(String jsonArrayOfReports).

getPreferredFrameRate

public float getPreferredFrameRate()

Returns the preferred frame rate for the subscriber's stream. This method only applies to streams published using the scalable video feature. See setPreferredFrameRate(float preferredFrameRate).

Returns: : The preferred frame rate for the subscriber stream or -1 if there has been any error retrieving the actual value.

onConnected

protected void onConnected()

Invoked when the instance has successfully connected to the stream and begins playing media.

If you extend the SubscriberKit class, you can override this method instead of the onConnected() method of the SubscriberKit.SubscriberListener interface.

onDisconnected

@Deprecated protected void onDisconnected()

Deprecated.

From 2.17.0 on, this callback won't be invoked. When a subscriber disconnects from the session, the Session.SessionListener.onStreamDropped(com.opentok.android.Session, com.opentok.android.Stream) callback will be invoked.

onError

protected void onError(OpentokError error)

Invoked when a subscriber has failed to connect to the OpenTok server.

If you extend the SubscriberKit class, you can override this method instead of the onError() method of the SubscriberKit.SubscriberListener interface.

Parameters: : error - The error.

onStreamDisconnected

protected void onStreamDisconnected()

Called when the subscriber's stream has been interrupted.

In response to this method being called, you may want to provide a user interface notification, to let the user know that the audio-video stream is temporarily disconnected and the app is trying to reconnect to the stream.

If the client reconnects to the stream, the onStreamReconnected() method is called. Otherwise, the onDisconnected() method is called.

If you extend the SubscriberKit class, you can override this method instead of implementing the onDisconnected() method of the SubscriberKit.StreamListener interface.

onStreamReconnected

protected void onStreamReconnected()

Called when the subscriber's stream has resumed, after the onStreamDisconnected() method is called.

If you extend the SubscriberKit class, you can override this method instead of implementing the onReconnected() method of the SubscriberKit.StreamListener interface.

onAudioEnabled

protected void onAudioEnabled()

Called when the subscriber's stream has the audio enabled.

If you extend the SubscriberKit class, you can override this method instead of implementing the onAudioEnabled() method of the SubscriberKit.StreamListener interface.

onAudioDisabled

protected void onAudioDisabled()

Called when the subscriber's stream audio has been disabled

If you extend the SubscriberKit class, you can override this method instead of implementing the onAudioDisabled() method of the SubscriberKit.StreamListener interface.

onVideoDisabled

protected void onVideoDisabled(String reason)

Called when the subscriber stops receiving video. Check the reason parameter for the reason why the video stopped.

If you extend the SubscriberKit class, you can override this method instead of the onVideoDisabled() method of the SubscriberKit.SubscriberListener interface.

Parameters: : reason - The reason that the video track was disabled. This value is set to one of the following values: VIDEO_REASON_PUBLISH_VIDEO VIDEO_REASON_SUBSCRIBE_TO_VIDEO, VIDEO_REASON_QUALITY, or VIDEO_REASON_CODEC_NOT_SUPPORTED.

onVideoEnabled

protected void onVideoEnabled(String reason)

Called when the subscriber's video stream starts (when there previously was no video) or resumes (after video was disabled). Check the reason parameter for the reason why the video stopped.

If you extend the SubscriberKit class, you can override this method instead of the onVideoEnabled() method of the SubscriberKit.SubscriberListener interface.

Parameters: : reason - The reason that the video track started or resumed. This value is set to one of the following values: VIDEO_REASON_PUBLISH_VIDEO VIDEO_REASON_SUBSCRIBE_TO_VIDEO, or VIDEO_REASON_QUALITY.

onVideoDisableWarning

protected void onVideoDisableWarning()

Called when the OpenTok Media Router determines that the stream quality has degraded and the video will be disabled if the quality degrades further. If the quality degrades further, the subscriber disables the video and the onVideoDisabled(String reason) method is called. If the stream quality improves, the onVideoDisableWarningLifted() method is called.

This feature is only available in sessions that use the OpenTok Media Router (sessions with the media mode set to routed), not in sessions with the media mode set to relayed. (See The OpenTok Media Router and media modes).

This method is mainly called when connection quality degrades.

If you extend the SubscriberKit class, you can override this method instead of the onVideoDisableWarning() method of the SubscriberKit.SubscriberListener interface.

onVideoDisableWarningLifted

protected void onVideoDisableWarningLifted()

Called when the OpenTok Media Router determines that the stream quality has improved to the point at which the video being disabled is not an immediate risk. This method is called after the onVideoDisableWarning() method is called.

This feature is only available in sessions that use the OpenTok Media Router (sessions with the media mode set to routed), not in sessions with the media mode set to relayed. (See The OpenTok Media Router and media modes.)

This method is mainly called when connection quality improves.

If you extend the SubscriberKit class, you can override this method instead of the onVideoDisableWarningLifted() method of the SubscriberKit.SubscriberListener interface.

onVideoDataReceived

protected void onVideoDataReceived()

Invoked when an subscriber initially receives video data.

If you extend the SubscriberKit class, you can override this method instead of the onVideoDataReceived() method of the SubscriberKit.VideoListener interface.

attachToSession

protected void attachToSession(Session session)

detachFromSession

protected void detachFromSession(Session session)

onAudioLevelUpdated

protected void onAudioLevelUpdated(float audioLevel)

onCaptionText

protected void onCaptionText(String text, boolean isFinal)

onPause

public void onPause()

Do not call directly; call Session.onPause() instead.

onResume

public void onResume()

Do not call directly; call Session.onResume() instead.

update

@Deprecated public void update(Observable o, Object arg)

Deprecated.

This method is called whenever the observed object is changed. This class implements the Observer interface, so it observes events, such as session pause and session resume events.

Specified by: : update in interface Observer

Parameters: : o - The observable object. : arg - An argument passed to the notifyObservers method.

finalize

protected void finalize() throws Throwable

Called by the garbage collector on an SubscriberKit object when garbage collection determines that there are no more references to the object.

Overrides: : finalize in class Object

Throws: : Throwable