SubscriberKit
public class SubscriberKit 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 types: SubscriberKit.SubscriberListener, SubscriberKit.VideoListener, SubscriberKit.AudioLevelListener, SubscriberKit.CaptionsListener, SubscriberKit.StreamListener, SubscriberKit.SenderStats, SubscriberKit.SubscriberVideoStats, SubscriberKit.SubscriberAudioStats, SubscriberKit.SubscriberMediaLinkStats, SubscriberKit.VideoStatsListener, SubscriberKit.AudioStatsListener, SubscriberKit.MediaLinkStatsListener, SubscriberKit.SubscriberRtcStatsReportListener, SubscriberKit.Builder
Properties
| Name | Type | Description |
|---|---|---|
VIDEO_REASON_NONE |
String | static final Constant value: none |
VIDEO_REASON_PUBLISH_VIDEO |
String | static final 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 Constant value: publishVideo |
VIDEO_REASON_SUBSCRIBE_TO_VIDEO |
String | static final The video event was caused by a call to the SubscriberKit#setSubscribeToVideo(boolean subscribeToVideo) method. Constant value: subscribeToVideo |
VIDEO_REASON_QUALITY |
String | static final 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 VideoListener#onVideoDisabled(SubscriberKit, String) method being called. When conditions improve, the video stream resumes, and the 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. Constant value: quality |
VIDEO_REASON_CODEC_NOT_SUPPORTED |
String | static final 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. Constant value: codecNotSupported |
VIDEO_REASON_INTERRUPTION |
String | static final The video stream was interrupted. Constant value: videoInterruption |
VIDEO_REASON_RESOLUTION_CHANGE |
String | static final The resolution for the stream has changed. Constant value: resolutionChange |
VIDEO_REASON_CODEC_CHANGE |
String | static final The video codec for the stream has changed. Constant value: codecChange |
VIDEO_REASON_SENDER_QUALITY_RESTRICTION |
String | static final Sender restricted video quality. Constant value: senderQualityRestriction |
NETWORK_REASON_NETWORK_CONDITION_CHANGE |
String | static final 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. Constant value: networkConditionChange |
NO_PREFERRED_RESOLUTION |
VideoUtils.Size | static final Defines a reset value to passed into the Subscriber#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 |
float | static final Defines a reset value to passed into the SubscriberKit#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. Constant value: 3.4028235E38 |
videoStatsListener |
SubscriberKit.VideoStatsListener | protected |
audioStatsListener |
SubscriberKit.AudioStatsListener | protected |
mediaLinkStatsListener |
SubscriberKit.MediaLinkStatsListener | protected |
subscriberListener |
SubscriberKit.SubscriberListener | protected |
rtcStatsReportListener |
SubscriberKit.SubscriberRtcStatsReportListener | protected |
videoListener |
SubscriberKit.VideoListener | protected |
audioLevelListener |
SubscriberKit.AudioLevelListener | protected |
captionsListener |
SubscriberKit.CaptionsListener | protected |
streamListener |
SubscriberKit.StreamListener | protected |
session |
Session | protected |
renderer |
BaseVideoRenderer | protected |
stream |
Stream | protected |
Methods
| Name | Description |
|---|---|
SubscriberKit(builder) |
|
attachToSession(session) |
|
destroy() |
Manually destroying the object is not safe. |
detachFromSession(session) |
|
finalize() |
Called by the garbage collector on an SubscriberKit object when garbage collection determines that there are no more references to the object. |
getAudioVolume() → {double} |
Returns the audio volume, between 0 and 100, of the subscriber. |
getCaptionsTranslationLanguage() → {String} |
Gets the configured caption translation language for this subscriber. |
getPreferredFrameRate() → {float} |
Returns the preferred frame rate for the subscriber's stream. |
getPreferredResolution() → {VideoUtils.Size} |
Returns the preferred resolution for the subscriber's stream. |
getRenderer() → {BaseVideoRenderer} |
Returns the video renderer for this subscriber. |
getRtcStatsReport() |
Gets the RTC stats report for the subscriber. |
getSession() → {Session} |
Returns the Session that the subscriber is bound to (by calling the connect() method of the Session object). |
getStream() → {Stream} |
Returns the Stream that this instance is bound to. |
getSubscribeToAudio() → {boolean} |
Whether the Subscriber is subscribing to audio or not. |
getSubscribeToCaptions() → {boolean} |
Whether the Subscriber is subscribing to captions or not. |
getSubscribeToVideo() → {boolean} |
Whether the Subscriber is subscribing to audio or not. |
getView() → {View} |
Returns the android.view.View object that contains the Subscriber video. |
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. |
onAudioEnabled() |
Called when the subscriber's stream has the audio enabled. |
onAudioLevelUpdated(audioLevel) |
|
onCaptionText(text, isFinal) |
|
onConnected() |
Invoked when the instance has successfully connected to the stream and begins playing media. |
onDisconnected() |
From 2.17.0 on, this callback won't be invoked. |
onError(error) |
Invoked when a subscriber fails. |
onPause() |
Do not call directly; call Session#onPause() instead. |
onResume() |
Do not call directly; call Session#onResume() instead. |
onRtcStatsReport(jsonArrayOfReports) |
Called when the subscriber's RTC stats report is available in response to a call to SubscriberKit#getRtcStatsReport(). |
onStreamDisconnected() |
Called when the subscriber's stream has been interrupted. |
onStreamReconnected() |
Called when the subscriber's stream has resumed, after the Subscriber#onStreamDisconnected method is called. |
onVideoDataReceived() |
Invoked when an subscriber initially receives video data. |
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. |
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. |
onVideoDisabled(reason) |
Called when the subscriber stops receiving video. |
onVideoEnabled(reason) |
Called when the subscriber's video stream starts (when there previously was no video) or resumes (after video was disabled). |
setAudioLevelListener(listener) |
Binds an AudioLevelListener to this SubscriberKit instance to monitor audio level updates. |
setAudioStatsListener(listener) |
Sets up a listener for subscriber audio statistics. |
setAudioVolume(volume) |
Sets the audio volume, between 0 and 100, of the subscriber. |
setCaptionsListener(listener) |
Binds a CaptionsListener to this SubscriberKit instance to receive captions. |
setCaptionsTranslationLanguage(language) |
Sets the preferred caption translation language for this subscriber. |
setMediaLinkStatsListener(listener) |
Sets up a listener for subscriber media link statistics. |
setPreferredFrameRate(preferredFrameRate) |
Sets the preferred frame rate for the subscriber's stream. |
setPreferredResolution(preferredResolution) |
Sets the preferred resolution for the subscriber's stream. |
setRenderer(renderer) |
Set the video renderer for this subscriber. |
setRtcStatsReportListener(listener) |
Sets the RTC stats report listener for the subscriber. |
setStreamListener(listener) |
Sets up a listener for events related to the subscriber's stream being interrupted and resuming. |
setStyle(key, value) |
Set a style used by this subscriber. |
setSubscribeToAudio(subscribeToAudio) |
Whether to subscribe to the stream's audio (true) or not (false). |
setSubscribeToCaptions(subscribeToCaptions) |
Whether to subscribe to the stream's captions (true) or not (false).. |
setSubscribeToVideo(subscribeToVideo) |
Whether to subscribe to the stream's video (true) or not (false). |
setSubscriberListener(listener) |
Sets a SubscriberListener object to monitor state changes. |
setVideoListener(listener) |
Sets a VideoListener object to monitor when the subscriber starts and stops receiving video. |
setVideoStatsListener(listener) |
Sets up a listener for subscriber video statistics. |
update(o, arg) |
This method is called whenever the observed object is changed. |
SubscriberKit(builder)
Parameters:
| Name | Type | Description |
|---|---|---|
builder |
SubscriberKit.Builder |
attachToSession(session)
Parameters:
| Name | Type | Description |
|---|---|---|
session |
Session |
destroy()
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.
Deprecated
detachFromSession(session)
Parameters:
| Name | Type | Description |
|---|---|---|
session |
Session |
finalize()
Called by the garbage collector on an SubscriberKit object when garbage collection determines that there are no more references to the object.
See:
: - Throws Throwable
getAudioVolume() → {double}
Returns the audio volume, between 0 and 100, of the subscriber.
The default value is 100.
Returns:
double
getCaptionsTranslationLanguage() → {String}
Gets the configured caption translation language for this subscriber.
Returns:
The configured BCP-47 language code, or null if translation is not set.
getPreferredFrameRate() → {float}
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.
getPreferredResolution() → {VideoUtils.Size}
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).
Returns:
VideoUtils.Size
getRenderer() → {BaseVideoRenderer}
Returns the video renderer for this subscriber.
Returns:
BaseVideoRenderer
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
SubscriberRtcStatsReportListener#onRtcStatsReport(SubscriberKit subscriber, String jsonArrayOfReports)
method prior to calling this method. When the stats are available, the implementation
of the SubscriberRtcStatsReportListener#onRtcStatsReport(SubscriberKit subscriber, String jsonArrayOfReports)
method is called.
Also see setAudioStatsListener(SubscriberKit.AudioStatsListener listener),
setVideoStatsListener(SubscriberKit.VideoStatsListener listener), and
PublisherKit#getRtcStatsReport().
getSession() → {Session}
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() → {Stream}
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() → {boolean}
Whether the Subscriber is subscribing to audio or not.
Returns:
true if the Subscriber is subscribing to audio; false if it is not.
getSubscribeToCaptions() → {boolean}
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).
getSubscribeToVideo() → {boolean}
Whether the Subscriber is subscribing to audio or not.
Returns:
true if the Subscriber is subscribing to audio; false if it is not.
getView() → {View}
Returns the android.view.View object that contains the Subscriber video.
Returns:
View
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.
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.
onAudioLevelUpdated(audioLevel)
Parameters:
| Name | Type | Description |
|---|---|---|
audioLevel |
float |
onCaptionText(text, isFinal)
Parameters:
| Name | Type | Description |
|---|---|---|
text |
String | |
isFinal |
boolean |
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()
From 2.17.0 on, this callback won't be invoked. When a subscriber disconnects from the
session, the Session.SessionListener#onStreamDropped callback will be invoked.
Deprecated
onError(error)
Invoked when a subscriber fails.
Most errors are fatal: the subscriber is automatically dropped and can no longer be used. Some errors are continuable and leave the subscriber usable; when an error is non-fatal it is stated in the error description.
If you extend the SubscriberKit class, you can override this method instead of the
onError() method of the SubscriberKit.SubscriberListener interface.
Parameters:
| Name | Type | Description |
|---|---|---|
error |
OpentokError | The error. |
onPause()
Do not call directly; call Session#onPause() instead.
onResume()
Do not call directly; call Session#onResume() instead.
onRtcStatsReport(jsonArrayOfReports)
Called when the subscriber's RTC stats report is available in response to a
call to SubscriberKit#getRtcStatsReport().
If you extend the SubscriberKit class, you can override this method instead of implementing the onRtcStatsReport() method of the SubscriberKit.SubscriberRtcStatsReportListener interface.
See SubscriberRtcStatsReportListener#onRtcStatsReport(String jsonArrayOfReports).
Parameters:
| Name | Type | Description |
|---|---|---|
jsonArrayOfReports |
String |
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()
Called when the subscriber's stream has resumed, after the
Subscriber#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.
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.
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()
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.
onVideoDisabled(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:
| Name | Type | Description |
|---|---|---|
reason |
String | 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(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:
| Name | Type | Description |
|---|---|---|
reason |
String | 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. |
setAudioLevelListener(listener)
Binds an AudioLevelListener to this SubscriberKit instance to monitor audio
level updates.
Parameters:
| Name | Type | Description |
|---|---|---|
listener |
SubscriberKit.AudioLevelListener | The AudioLevelListener that will monitor this instance. Set this to null to disconnect a listener and stop monitoring audio levels. |
setAudioStatsListener(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
Parameters:
| Name | Type | Description |
|---|---|---|
listener |
SubscriberKit.AudioStatsListener |
See:
: - setVideoStatsListener(VideoStatsListener listener)
setAudioVolume(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:
| Name | Type | Description |
|---|---|---|
volume |
double | The volume of the subscriber. |
setCaptionsListener(listener)
Binds a CaptionsListener to this SubscriberKit instance to receive captions.
Parameters:
| Name | Type | Description |
|---|---|---|
listener |
SubscriberKit.CaptionsListener | The CaptionsListener that will monitor this instance. Set this to null to disconnect a listener and stop receiving captions. |
setCaptionsTranslationLanguage(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.
Parameters:
| Name | Type | Description |
|---|---|---|
language |
String | A supported BCP-47 language code, or null to disable translation. |
setMediaLinkStatsListener(listener)
Sets up a listener for subscriber media link statistics. The listener object
implements the MediaLinkStatsListener interface, which includes:
MediaLinkStatsListener#onMediaLinkStats(SubscriberKit, SubscriberMediaLinkStats)— called periodically with transport-level metrics.MediaLinkStatsListener#onNetworkConditionChanged(SubscriberKit, SubscriberMediaLinkStats, String)— called when the network condition changes.
Parameters:
| Name | Type | Description |
|---|---|---|
listener |
SubscriberKit.MediaLinkStatsListener | The MediaLinkStatsListener instance, or null to remove the listener. |
setPreferredFrameRate(preferredFrameRate)
Sets the preferred frame rate for the subscriber's stream.
Limiting the frame rate and video resolution (see
SubscriberKit#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.
Parameters:
| Name | Type | Description |
|---|---|---|
preferredFrameRate |
float |
setPreferredResolution(preferredResolution)
Sets the preferred resolution for the subscriber's stream.
Limiting the video resolution and frame rate (see
SubscriberKit#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.
Parameters:
| Name | Type | Description |
|---|---|---|
preferredResolution |
VideoUtils.Size |
setRenderer(renderer)
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.
Deprecated
Parameters:
| Name | Type | Description |
|---|---|---|
renderer |
BaseVideoRenderer |
setRtcStatsReportListener(listener)
Sets the RTC stats report listener for the subscriber. See getRtcStatsReport().
Parameters:
| Name | Type | Description |
|---|---|---|
listener |
SubscriberKit.SubscriberRtcStatsReportListener | The SubscriberRtcStatsReportListener object. |
setStreamListener(listener)
Sets up a listener for events related to the subscriber's stream being interrupted and resuming.
Parameters:
| Name | Type | Description |
|---|---|---|
listener |
SubscriberKit.StreamListener |
setStyle(key, 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:
BaseVideoRenderer#STYLE_VIDEO_FILL— The video scales to fill the entire area of the renderer, with cropping as needed.BaseVideoRenderer#STYLE_VIDEO_FIT— The video shrinks, as needed, so that the entire video is visible, with pillarboxing (the default setting).
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:
| Name | Type | Description |
|---|---|---|
key |
String | The style to set. |
value |
String | The value you are setting the style to. |
setSubscribeToAudio(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:
| Name | Type | Description |
|---|---|---|
subscribeToAudio |
boolean | Whether to subscribe to the stream's audio (true) or not (false). |
setSubscribeToCaptions(subscribeToCaptions)
Whether to subscribe to the stream's captions (true) or not (false)..
Parameters:
| Name | Type | Description |
|---|---|---|
subscribeToCaptions |
boolean | Whether to subscribe to the stream's captions (true) or not (false). |
setSubscribeToVideo(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:
| Name | Type | Description |
|---|---|---|
subscribeToVideo |
boolean | Whether to subscribe to the stream's video (true) or not (false). |
setSubscriberListener(listener)
Sets a SubscriberListener object to monitor state changes.
Parameters:
| Name | Type | Description |
|---|---|---|
listener |
SubscriberKit.SubscriberListener | The SubscriberListener that monitors this SubscriberKit instance. |
setVideoListener(listener)
Sets a VideoListener object to monitor when the subscriber starts
and stops receiving video.
Parameters:
| Name | Type | Description |
|---|---|---|
listener |
SubscriberKit.VideoListener | The VideoListener instance. |
setVideoStatsListener(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
Parameters:
| Name | Type | Description |
|---|---|---|
listener |
SubscriberKit.VideoStatsListener |
See:
: - setAudioStatsListener(AudioStatsListener listener)
update(o, arg)
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.
Deprecated
Parameters:
| Name | Type | Description |
|---|---|---|
o |
Observable | The observable object. |
arg |
Object | An argument passed to the notifyObservers method. |