Class SubscriberKit
- java.lang.Object
-
- com.opentok.android.SubscriberKit
-
- All Implemented Interfaces:
java.util.Observer
- Direct Known Subclasses:
Subscriber
public class SubscriberKit extends java.lang.Object implements java.util.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 theSubscriber
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 statistcs.static class
SubscriberKit.Builder
Used to build aSubscriberKit
object.static interface
SubscriberKit.CaptionsListener
A listener for updated caption text.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 aSubscriberKit
instance.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 statistcs.
-
Field Summary
Fields Modifier and Type Field Description protected SubscriberKit.AudioLevelListener
audioLevelListener
protected SubscriberKit.AudioStatsListener
audioStatsListener
protected SubscriberKit.CaptionsListener
captionsListener
static float
NO_PREFERRED_FRAMERATE
Defines a reset value to passed into thesetPreferredFrameRate(float preferredFrameRate)
method.static VideoUtils.Size
NO_PREFERRED_RESOLUTION
Defines a reset value to passed into thesetPreferredResolution(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 java.lang.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 java.lang.String
VIDEO_REASON_PUBLISH_VIDEO
The video event was caused by the stream's publisher starting or stopping the video stream.static java.lang.String
VIDEO_REASON_QUALITY
The video event was caused by a change to the video stream quality.static java.lang.String
VIDEO_REASON_SUBSCRIBE_TO_VIDEO
The video event was caused by a call to thesetSubscribeToVideo(boolean subscribeToVideo)
method.protected SubscriberKit.VideoListener
videoListener
protected SubscriberKit.VideoStatsListener
videoStatsListener
-
Constructor Summary
Constructors Modifier Constructor Description SubscriberKit(android.content.Context context, Stream stream)
Deprecated.protected
SubscriberKit(android.content.Context context, Stream stream, BaseVideoRenderer renderer)
Creates a new SubscriberKit object for a given stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated 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.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 theSession
that the subscriber is bound to (by calling theconnect()
method of the Session object).Stream
getStream()
Returns theStream
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 disabledprotected void
onAudioEnabled()
Called when the subscriber's stream has the audio enabled.protected void
onAudioLevelUpdated(float audioLevel)
protected void
onCaptionText(java.lang.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; callSession.onPause()
instead.void
onResume()
Do not call directly; callSession.onResume()
instead.protected void
onRtcStatsReport(java.lang.String jsonArrayOfReports)
Called when the subscriber's RTC stats report is available in response to a call togetRtcStatsReport()
.protected void
onStreamDisconnected()
Called when the subscriber's stream has been interrupted.protected void
onStreamReconnected()
Called when the subscriber's stream has resumed, after theonStreamDisconnected()
method is called.protected void
onVideoDataReceived()
Invoked when an subscriber initially receives video data.protected void
onVideoDisabled(java.lang.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(java.lang.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 anSubscriberKit.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 aSubscriberKit.CaptionsListener
to this SubscriberKit instance to receive captions.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(java.lang.String key, java.lang.String value)
Set a style used by this subscriber.void
setSubscriberListener(SubscriberKit.SubscriberListener listener)
Sets aSubscriberKit.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 aSubscriberKit.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(java.util.Observable o, java.lang.Object arg)
This method is called whenever the observed object is changed.
-
-
-
Field Detail
-
VIDEO_REASON_PUBLISH_VIDEO
public static final java.lang.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 java.lang.String VIDEO_REASON_SUBSCRIBE_TO_VIDEO
The video event was caused by a call to thesetSubscribeToVideo(boolean subscribeToVideo)
method.
-
VIDEO_REASON_QUALITY
public static final java.lang.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.This reason is only used in sessions that have the media mode set to "routed". (See The OpenTok Media Router and media modes. This feature of the OpenTok Media Router has a subscriber drop the video stream when the video stream quality degrades, and the
SubscriberKit.VideoListener.onVideoDisabled(SubscriberKit, String)
method is called. When conditions improve, the video stream resumes, and theSubscriberKit.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.
- See Also:
method.
,method.
, Constant Field Values
-
VIDEO_REASON_CODEC_NOT_SUPPORTED
public static final java.lang.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
-
NO_PREFERRED_RESOLUTION
public static final VideoUtils.Size NO_PREFERRED_RESOLUTION
Defines a reset value to passed into thesetPreferredResolution(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 thesetPreferredFrameRate(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
-
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 Detail
-
SubscriberKit
@Deprecated public SubscriberKit(android.content.Context context, Stream stream)
Deprecated.Creates a new subscriber for a given stream. This method is deprecated. Use theSubscriberKit.Builder
class to instantiate aSubscriberKit
object.- Parameters:
context
- The android.content.Context for the Subscriber.stream
- The Stream object corresponding to the stream you will subscribe to.
-
SubscriberKit
protected SubscriberKit(android.content.Context context, Stream stream, BaseVideoRenderer renderer)
Creates a new SubscriberKit object for a given stream. If you extend theSubscriberKit
class, you can call this constructor from the child class.- Parameters:
context
- The android.content.Context for the Subscriber.stream
- The Stream object corresponding to the stream you will subscribe to.renderer
- The renderer for the subscriber.
-
-
Method Detail
-
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 aSubscriberKit.SubscriberListener
object to monitor state changes.- Parameters:
listener
- TheSubscriberKit.SubscriberListener
that monitors this SubscriberKit instance.
-
setVideoListener
public void setVideoListener(SubscriberKit.VideoListener listener)
Sets aSubscriberKit.VideoListener
object to monitor when the subscriber starts and stops receiving video.- Parameters:
listener
- TheSubscriberKit.VideoListener
instance.
-
setAudioLevelListener
public void setAudioLevelListener(SubscriberKit.AudioLevelListener listener)
Binds anSubscriberKit.AudioLevelListener
to this SubscriberKit instance to monitor audio level updates.- Parameters:
listener
- TheSubscriberKit.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 aSubscriberKit.CaptionsListener
to this SubscriberKit instance to receive captions.- Parameters:
listener
- TheSubscriberKit.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 theSession
that the subscriber is bound to (by calling theconnect()
method of the Session object).- Returns:
- The
Session
that the subscriber is bound to.
-
getStream
public Stream getStream()
Returns theStream
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 thehasAudio
method of the Stream object returnsfalse
.- 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 thehasVideo
method of the Stream object returnsfalse
.- 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
).
-
setStyle
public void setStyle(java.lang.String key, java.lang.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:-
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:
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 theSubscriberKit.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
-
setAudioStatsListener
public void setAudioStatsListener(SubscriberKit.AudioStatsListener listener)
Sets up a listener for subscriber audio statistics. The listener object implements theSubscriberKit.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
-
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()
andStream.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. SeesetPreferredResolution(VideoUtils.Size preferredResolution)
.
-
setRtcStatsReportListener
public void setRtcStatsReportListener(SubscriberKit.SubscriberRtcStatsReportListener listener)
Sets the RTC stats report listener for the subscriber. SeegetRtcStatsReport()
.- Parameters:
listener
- TheSubscriberKit.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 theSubscriberKit.SubscriberRtcStatsReportListener.onRtcStatsReport(SubscriberKit subscriber, String jsonArrayOfReports)
method prior to calling this method. When the stats are available, the implementation of theSubscriberKit.SubscriberRtcStatsReportListener.onRtcStatsReport(SubscriberKit subscriber, String jsonArrayOfReports)
method is called.Also see
setAudioStatsListener(SubscriberKit.AudioStatsListener listener)
,setVideoStatsListener(SubscriberKit.VideoStatsListener listener)
, andPublisherKit.getRtcStatsReport()
.
-
onRtcStatsReport
protected void onRtcStatsReport(java.lang.String jsonArrayOfReports)
Called when the subscriber's RTC stats report is available in response to a call togetRtcStatsReport()
.If you extend the SubscriberKit class, you can override this method instead of implementing the onRtcStatsReport() method of the SubscriberKit.SubscriberRtcStatsReportListener interface.
-
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. SeesetPreferredFrameRate(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, theSession.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, theonDisconnected()
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 theonStreamDisconnected()
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 disabledIf 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(java.lang.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
, orVIDEO_REASON_CODEC_NOT_SUPPORTED
.
-
onVideoEnabled
protected void onVideoEnabled(java.lang.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
, orVIDEO_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 theonVideoDisabled(String reason)
method is called. If the stream quality improves, theonVideoDisableWarningLifted()
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 theonVideoDisableWarning()
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(java.lang.String text, boolean isFinal)
-
onPause
public void onPause()
Do not call directly; callSession.onPause()
instead.
-
onResume
public void onResume()
Do not call directly; callSession.onResume()
instead.
-
update
public void update(java.util.Observable o, java.lang.Object 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.- Specified by:
update
in interfacejava.util.Observer
- Parameters:
o
- The observable object.arg
- An argument passed to the notifyObservers method.
-
finalize
protected void finalize() throws java.lang.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 classjava.lang.Object
- Throws:
java.lang.Throwable
-
-