Class PublisherKit
- java.lang.Object
-
- com.opentok.android.PublisherKit
-
- All Implemented Interfaces:
java.util.Observer
- Direct Known Subclasses:
Publisher
public class PublisherKit extends java.lang.Object implements java.util.Observer
A publisher captures an audio-video stream from the sources you specify. You can then publish the audio-video stream to an OpenTok session by calling theSession.publish(PublisherKit publisher)
method.Create a subclass of PublisherKit if you are interested in providing your own video capturing and rendering implementation. Otherwise, use the
Publisher
class, which includes a pre-built video capturer and renderer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
PublisherKit.AudioLevelListener
Monitors changes in the audio level of the publisher.static interface
PublisherKit.AudioStatsListener
Defines the listener object for getting publisher audio statistcs.class
PublisherKit.AudioTransformer
A transformer for an audio stream.static class
PublisherKit.Builder
Used to build aPublisherKit
object.static interface
PublisherKit.CustomAudioTransformer
Defines a custom transformer for an audio stream, to be passed into theAudioTransformer(String name, CustomAudioTransformer transformer)
constructor.static interface
PublisherKit.CustomVideoTransformer
Defines a custom transformer for a video stream, to be passed into theconstructor.
static interface
PublisherKit.MuteListener
Monitors when a moderator has forced this publisher to mute audio.static class
PublisherKit.PublisherAudioStats
Defines audio statistics for a publisher.static class
PublisherKit.PublisherKitVideoType
Defines values for thesetPublisherVideoType(PublisherKitVideoType type)
method.static interface
PublisherKit.PublisherListener
Monitors when a publisher starts and stops streaming to the session.static class
PublisherKit.PublisherRtcStats
Represents RTC statistics for a media stream published by the publisher.static interface
PublisherKit.PublisherRtcStatsReportListener
Defines the listener object for getting publisher RTC stats reports.static class
PublisherKit.PublisherVideoStats
Defines video statistics for a publisher.static interface
PublisherKit.VideoListener
Monitors when the publisher starts and stops receiving video data.static interface
PublisherKit.VideoStatsListener
Defines the listener object for getting publisher video statistcs.class
PublisherKit.VideoTransformer
A transformer for a video stream.
-
Field Summary
Fields Modifier and Type Field Description protected PublisherKit.AudioLevelListener
audioLevelListener
protected PublisherKit.AudioStatsListener
audioStatsListener
protected BaseVideoCapturer
capturer
protected android.content.Context
context
protected android.os.Handler
handler
protected PublisherKit.MuteListener
muteListener
protected PublisherKit.PublisherListener
publisherListener
protected BaseVideoRenderer
renderer
protected PublisherKit.PublisherRtcStatsReportListener
rtcStatsReportListener
protected PublisherKit.VideoListener
videoListener
protected PublisherKit.VideoStatsListener
videoStatsListener
-
Constructor Summary
Constructors Modifier Constructor Description PublisherKit(android.content.Context context)
Deprecated.PublisherKit(android.content.Context context, java.lang.String name)
Deprecated.PublisherKit(android.content.Context context, java.lang.String name, boolean audioTrack, boolean videoTrack)
Deprecated.protected
PublisherKit(android.content.Context context, java.lang.String name, boolean audioTrack, boolean videoTrack, BaseVideoCapturer capturer, BaseVideoRenderer renderer)
Deprecated.protected
PublisherKit(android.content.Context context, java.lang.String name, boolean audioTrack, int maxAudioBitRate, boolean videoTrack, BaseVideoCapturer capturer, BaseVideoRenderer renderer, boolean enableOpusDtx, boolean scalableScreenshare)
Deprecated.protected
PublisherKit(android.content.Context context, java.lang.String name, boolean audioTrack, int maxAudioBitRate, boolean videoTrack, BaseVideoCapturer capturer, BaseVideoRenderer renderer, boolean enableOpusDtx, boolean scalableScreenshare, boolean subscriberAudioFallback, boolean publisherAudioFallback)
Creates a new PublisherKit object.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
destroy()
Deprecated.protected void
finalize()
Called by the garbage collector when it determines that there are no more references to the PublisherKit object.boolean
getAudioFallbackEnabled()
Deprecated.BaseVideoCapturer
getCapturer()
Returns the video capturer used by this publisher.java.lang.String
getName()
The stream name.boolean
getPublishAudio()
Whether the Publisher is publishing audio (true
) or not (false
).boolean
getPublishCaptions()
Whether the Publisher is publishing captions (true
) or not (false
).PublisherKit.PublisherKitVideoType
getPublisherVideoType()
Returns the type of video for this publisher.boolean
getPublishVideo()
Whether the Publisher is publishing video (true
) or not (false
).BaseVideoRenderer
getRenderer()
Returns the video renderer for this publisher.void
getRtcStatsReport()
Gets the RTC stats report for the publisher.Session
getSession()
Returns theSession
bound to this Publisher instance.Stream
getStream()
Returns the stream object corresponding the the Publisher's stream.android.view.View
getView()
Returns the android.view.View object that contains the Publisher video.protected void
onAudioLevelUpdated(float audioLevel)
Called periodically to report the audio level of the publisher.protected void
onError(OpentokError error)
Invoked when the publisher fails.protected void
onMuteForced()
Invoked when a moderator has forced this publisher to mute audio.void
onPause()
Do not call directly; callSession.onPause()
instead.void
onRestart()
Restarts publisher resources that were previously released by calling theonStop()
method.void
onResume()
Do not call directly; callSession.onResume()
instead.protected void
onRtcStatsReport(PublisherKit.PublisherRtcStats[] stats)
Called when the publisher's RTC stats report is available in response to a call togetRtcStatsReport()
.void
onStop()
Releases resources tied to the publisher.protected void
onStreamCreated(Stream stream)
Invoked when the publisher's stream is created.protected void
onStreamDestroyed(Stream stream)
Invoked when the publisher's stream is destroyed.void
setAudioFallbackEnabled(boolean enabled)
Deprecated.void
setAudioLevelListener(PublisherKit.AudioLevelListener listener)
Binds anPublisherKit.AudioLevelListener
to this PublisherKit instance to monitor audio level updates.void
setAudioStatsListener(PublisherKit.AudioStatsListener listener)
Sets up a listener for publisher audio statistics.void
setAudioTransformers(java.util.ArrayList<PublisherKit.AudioTransformer> audioTransformers)
Sets a list of audio transformers to this publisher's audio stream.void
setCapturer(BaseVideoCapturer newCapturer)
Deprecated.void
setMuteListener(PublisherKit.MuteListener listener)
Sets aPublisherKit.MuteListener
object to monitor when a moderator forces this publisher to mute audio.void
setName(java.lang.String name)
Deprecated.void
setPublishAudio(boolean publishAudio)
Toggles publishing of audio on or off, based on the value passed in.void
setPublishCaptions(boolean publishCaptions)
Toggles publishing of captioning on or off, based on the value passed in.void
setPublisherListener(PublisherKit.PublisherListener listener)
Binds aPublisherKit.PublisherListener
to this Publisher instance to monitor state changes.void
setPublisherVideoType(PublisherKit.PublisherKitVideoType type)
Specifies the type of video for this stream.void
setPublishVideo(boolean publishVideo)
Toggles publishing of video on or off, based on the value passed in.void
setRenderer(BaseVideoRenderer renderer)
Deprecated.void
setRtcStatsReportListener(PublisherKit.PublisherRtcStatsReportListener listener)
Sets the RTC stats report listener the subscriber.void
setStyle(java.lang.String key, java.lang.String value)
Sets a style for the video renderer used by this publisher.void
setVideoListener(PublisherKit.VideoListener listener)
Sets aPublisherKit.VideoListener
object to monitor when the publisher starts and stops sending video.void
setVideoStatsListener(PublisherKit.VideoStatsListener listener)
Sets up a listener for publisher video statistics.void
setVideoTransformers(java.util.ArrayList<PublisherKit.VideoTransformer> videoTransformers)
Sets a list of video transformers to this publisher's video stream.void
update(java.util.Observable o, java.lang.Object arg)
This method is called whenever the observed object is changed.
-
-
-
Field Detail
-
handler
protected android.os.Handler handler
-
publisherListener
protected PublisherKit.PublisherListener publisherListener
-
audioLevelListener
protected PublisherKit.AudioLevelListener audioLevelListener
-
videoStatsListener
protected PublisherKit.VideoStatsListener videoStatsListener
-
audioStatsListener
protected PublisherKit.AudioStatsListener audioStatsListener
-
muteListener
protected PublisherKit.MuteListener muteListener
-
rtcStatsReportListener
protected PublisherKit.PublisherRtcStatsReportListener rtcStatsReportListener
-
context
protected android.content.Context context
-
renderer
protected BaseVideoRenderer renderer
-
capturer
protected BaseVideoCapturer capturer
-
videoListener
protected PublisherKit.VideoListener videoListener
-
-
Constructor Detail
-
PublisherKit
@Deprecated protected PublisherKit(android.content.Context context, java.lang.String name, boolean audioTrack, boolean videoTrack, BaseVideoCapturer capturer, BaseVideoRenderer renderer)
Deprecated.Creates a new PublisherKit instance. If you extend thePublisherKit
class, you can call this constructor to instantiate a publisher object.Use the
Session.publish(PublisherKit publisher)
method to start streaming from this publisher into a session.The
getView()
method returns the android.view.View object containing the published video.Publishers cannot be reused. Instantiate a new
PublisherKit
object each time you want to publish a new stream.- Parameters:
context
- The android.content.Context for the Publisher.name
- The name of the publisher video. TheStream.getName()
method for a published by this publisher will return this value (on all clients).audioTrack
- Whether to include an audio track in the published stream.videoTrack
- Whether to include a video track in the published stream.capturer
- The video capturer for the publisher.renderer
- The video renderer for the publisher.- See Also:
setPublisherListener(PublisherKit.PublisherListener listener)
-
PublisherKit
@Deprecated protected PublisherKit(android.content.Context context, java.lang.String name, boolean audioTrack, int maxAudioBitRate, boolean videoTrack, BaseVideoCapturer capturer, BaseVideoRenderer renderer, boolean enableOpusDtx, boolean scalableScreenshare)
Deprecated.Creates a new PublisherKit object. If you extend thePublisherKit
class, you can call this constructor from the child class.- Parameters:
context
- The android.content.Context for the Publisher.name
- The name of the publisher video. TheStream.getName()
method for a published by this publisher will return this value (on all clients).audioTrack
- Whether to include an audio track in the published stream.maxAudioBitRate
- The desired bitrate of the audio, in bits per second.videoTrack
- Whether to include a video track in the published stream.capturer
- The video capturer for the publisher.renderer
- The video renderer for the publisher.scalableScreenshare
- Whether to allow use of scalable video for a publisher that has the videoType set to PublisherKitVideoTypeScreen (true) or not (false, the default).
-
PublisherKit
protected PublisherKit(android.content.Context context, java.lang.String name, boolean audioTrack, int maxAudioBitRate, boolean videoTrack, BaseVideoCapturer capturer, BaseVideoRenderer renderer, boolean enableOpusDtx, boolean scalableScreenshare, boolean subscriberAudioFallback, boolean publisherAudioFallback)
Creates a new PublisherKit object. If you extend thePublisherKit
class, you can call this constructor from the child class.- Parameters:
context
- The android.content.Context for the Publisher.name
- The name of the publisher video. TheStream.getName()
method for a published by this publisher will return this value (on all clients).audioTrack
- Whether to include an audio track in the published stream.maxAudioBitRate
- The desired bitrate of the audio, in bits per second.videoTrack
- Whether to include a video track in the published stream.capturer
- The video capturer for the publisher.renderer
- The video renderer for the publisher.scalableScreenshare
- Whether to allow use of scalable video for a publisher that has the videoType set to PublisherKitVideoTypeScreen (true) or not (false, the default).subscriberAudioFallback
- Whether the stream will use the subscriber audio-fallback feature (true
) or notpublisherAudioFallback
- Whether the stream will use the publisher audio-fallback feature (true
) or not
-
PublisherKit
@Deprecated public PublisherKit(android.content.Context context, java.lang.String name, boolean audioTrack, boolean videoTrack)
Deprecated.Creates a new PublisherKit instance. This method is deprecated. Use thePublisherKit.Builder
class to instantiate a PublisherKit object.Use the
Session.publish(PublisherKit publisher)
method to start streaming from this publisher into a session.This version of the constructor adds parameters that let you exclude the audio track or video track from the published stream. Creating a Publisher without an audio track or video track can save CPU resources.
The
getView()
method returns the android.view.View object containing the published video.Publishers cannot be reused.
- Parameters:
context
- The android.content.Context for the Publisher.name
- The name of the publisher video. TheStream.getName()
method for a stream published by this publisher will return this value (on all clients).audioTrack
- Whether to include an audio track in the published stream.videoTrack
- Whether to include a video track in the published stream.
-
PublisherKit
@Deprecated public PublisherKit(android.content.Context context)
Deprecated.Creates a new PublisherKit instance. This method is deprecated. Use thePublisherKit.Builder
class to instantiate a PublisherKit object.Use the
Session.publish(PublisherKit publisher)
method to start streaming from this publisher into a session.The
getView()
method returns the android.view.View object containing the published video.- Parameters:
context
- The android.content.Context for the Publisher.- See Also:
setPublisherListener(PublisherKit.PublisherListener listener)
-
PublisherKit
@Deprecated public PublisherKit(android.content.Context context, java.lang.String name)
Deprecated.Creates a new PublisherKit instance. This method is deprecated. Use thePublisherKit.Builder
class to instantiate a PublisherKit object.Use the
Session.publish(PublisherKit publisher)
method to start streaming from this publisher into a session.The
getView()
method returns the android.view.View object containing the published video.- Parameters:
context
- The android.content.Context for the Publisher.name
- The name of the publisher video. TheStream.getName()
method for a stream published by this publisher will return this value (on all clients).- See Also:
setPublisherListener(PublisherKit.PublisherListener listener)
-
-
Method Detail
-
onPause
public void onPause()
Do not call directly; callSession.onPause()
instead.
-
onResume
public void onResume()
Do not call directly; callSession.onResume()
instead.
-
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.
-
setPublishVideo
public void setPublishVideo(boolean publishVideo)
Toggles publishing of video on or off, based on the value passed in.- Parameters:
publishVideo
- Whether to publish video (true
) or not (false
).
-
setPublishAudio
public void setPublishAudio(boolean publishAudio)
Toggles publishing of audio on or off, based on the value passed in.- Parameters:
publishAudio
- Whether to publish audio (true
) or not (false
).
-
setPublishCaptions
public void setPublishCaptions(boolean publishCaptions)
Toggles publishing of captioning on or off, based on the value passed in.- Parameters:
publishCaptions
- Whether to publish captions (true
) or not (false
).
-
setName
@Deprecated public void setName(java.lang.String name)
Deprecated.Set the name for this stream. The name appears at the bottom of the publisher video and at the bottom of subscriber videos associated with the published stream. You can set this name after initializing the publisher and before thePublisherKit.PublisherListener.onStreamCreated(PublisherKit publisher, Stream stream)
method is called. Setting the property after thePublisherKit.PublisherListener.onStreamCreated(PublisherKit publisher, Stream stream)
method is called has no effect on the name displayed for the stream.The default name is "" (an empty string).
-
setPublisherVideoType
public void setPublisherVideoType(PublisherKit.PublisherKitVideoType type)
Specifies the type of video for this stream. Set this to one of the following values:PublisherKitVideoType.PublisherKitVideoTypeScreen
— Optimizes the video encoding for screen sharing. It is recommended to use a low frame rate (5 frames per second or lower) with this video type. When using the screen video type in a session that uses the OpenTok Media Server, you should call thesetAudioFallbackEnabled(boolean enabled)
method and pass infalse
before calling theSession.publish(com.opentok.android.PublisherKit)
method; this disables the audio-only fallback feature, so that the video does not drop out in subscribers. See The OpenTok Media Router and media modes.PublisherKitVideoType.PublisherKitVideoTypeCamera
— This is the default setting, which you should use when using a camera as the video source.
-
getName
public java.lang.String getName()
The stream name. The name appears at the bottom of Subscriber videos.- Returns:
- publisher name
-
getPublishVideo
public boolean getPublishVideo()
Whether the Publisher is publishing video (true
) or not (false
).
-
getPublishAudio
public boolean getPublishAudio()
Whether the Publisher is publishing audio (true
) or not (false
).
-
getPublishCaptions
public boolean getPublishCaptions()
Whether the Publisher is publishing captions (true
) or not (false
).
-
getSession
public Session getSession()
Returns theSession
bound to this Publisher instance.- Returns:
- The
Session
bound to this Publisher instance. - See Also:
Session.publish(com.opentok.android.PublisherKit)
-
getStream
public Stream getStream()
Returns the stream object corresponding the the Publisher's stream.- Returns:
- The stream object.
-
getPublisherVideoType
public PublisherKit.PublisherKitVideoType getPublisherVideoType()
Returns the type of video for this publisher.
-
setPublisherListener
public void setPublisherListener(PublisherKit.PublisherListener listener)
Binds aPublisherKit.PublisherListener
to this Publisher instance to monitor state changes.- Parameters:
listener
- ThePublisherKit.PublisherListener
that will monitor this instance, or null to disconnect a listener.
-
setAudioLevelListener
public void setAudioLevelListener(PublisherKit.AudioLevelListener listener)
Binds anPublisherKit.AudioLevelListener
to this PublisherKit instance to monitor audio level updates.- Parameters:
listener
- ThePublisherKit.AudioLevelListener
that will monitor this instance. Set this to null to disconnect a listener and stop monitoring audio levels.
-
setRtcStatsReportListener
public void setRtcStatsReportListener(PublisherKit.PublisherRtcStatsReportListener listener)
Sets the RTC stats report listener the subscriber. SeegetRtcStatsReport()
.- Parameters:
listener
- ThePublisherKit.PublisherRtcStatsReportListener
object.
-
setVideoTransformers
public void setVideoTransformers(java.util.ArrayList<PublisherKit.VideoTransformer> videoTransformers)
Sets a list of video transformers to this publisher's video stream. If the list is empty, calling this method resets the transformers. The array can be composed by Vonage video transformers provided by ml-library or custom transfomers (see this developer guide). Note: Media transformers are not supported on all devices or Android versions. See this documentation.- Parameters:
videoTransformers
- The list of video transformers, in the order to be applied to the stream.
-
setVideoListener
public void setVideoListener(PublisherKit.VideoListener listener)
Sets aPublisherKit.VideoListener
object to monitor when the publisher starts and stops sending video.- Parameters:
listener
- ThePublisherKit.VideoListener
instance.
-
setAudioTransformers
public void setAudioTransformers(java.util.ArrayList<PublisherKit.AudioTransformer> audioTransformers)
Sets a list of audio transformers to this publisher's audio stream. If the list is empty, calling this method resets the transformers. The array can be composed of Vonage audio transformers provided by ml-library or custom transfomers (see this developer guide). Note: Media transformers are not supported on all devices or Android versions. See this documentation. .- Parameters:
audioTransformers
- The list of audio transformers, in the order to be applied to the stream.
-
setStyle
public void setStyle(java.lang.String key, java.lang.String value)
Sets a style for the video renderer used by this publisher.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. If you do not set this style the default setting isBaseVideoRenderer.STYLE_VIDEO_FIT
.
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.Sets the video renderer for this publisher.This method is deprecated. Instead, call the
PublisherKit.Builder.renderer(BaseVideoRenderer renderer)
method when using the Builder to create the PublisherKit instance.
-
getRenderer
public BaseVideoRenderer getRenderer()
Returns the video renderer for this publisher.
-
getCapturer
public BaseVideoCapturer getCapturer()
Returns the video capturer used by this publisher.
-
setCapturer
@Deprecated public void setCapturer(BaseVideoCapturer newCapturer)
Deprecated.Sets the video capturer for this publisher.This method is deprecated. Instead, call the
PublisherKit.Builder.capturer(BaseVideoCapturer capturer)
method when using the builder to create the PublisherKit instance.
-
getView
public android.view.View getView()
Returns the android.view.View object that contains the Publisher video.
-
setVideoStatsListener
public void setVideoStatsListener(PublisherKit.VideoStatsListener listener)
Sets up a listener for publisher video statistics. The listener object implements thePublisherKit.VideoStatsListener.onVideoStats(PublisherKit publisher, PublisherKit.PublisherVideoStats[] stats)
method. This method is called periodically to report the following:- Total video packets lost
- Total video packets sent
- Total video bytes sent
-
setAudioStatsListener
public void setAudioStatsListener(PublisherKit.AudioStatsListener listener)
Sets up a listener for publisher audio statistics. The listener object implements thePublisherKit.AudioStatsListener.onAudioStats(PublisherKit publisher, PublisherKit.PublisherAudioStats[] stats)
method. This method is called periodically to report the following:- Total audio packets lost
- Total audio packets sent
- Total audio bytes sent
-
setMuteListener
public void setMuteListener(PublisherKit.MuteListener listener)
Sets aPublisherKit.MuteListener
object to monitor when a moderator forces this publisher to mute audio.- Parameters:
listener
- ThePublisherKit.MuteListener
instance.
-
setAudioFallbackEnabled
@Deprecated public void setAudioFallbackEnabled(boolean enabled)
Deprecated.Whether the stream will use the subscriber audio-fallback feature (true
) or not (false
). The audio-fallback feature is available in sessions that use the the OpenTok Media Router. With the audio-fallback feature enabled (the default), when the OpenTok Media Router determines that a stream's quality has degraded significantly for a specific subscriber, it disables the video in that subscriber in order to preserve audio quality.The default setting is
true
(the audio-fallback feature is enabled). To turn off the audio-fallback feature, call this method (and pass infalse
) before calling theSession.publish(com.opentok.android.PublisherKit)
method.
-
getAudioFallbackEnabled
@Deprecated public boolean getAudioFallbackEnabled()
Deprecated.Whether the stream uses the subscriber audio-fallback feature (true
) or not (false
).- See Also:
setAudioFallbackEnabled(boolean enabled)
-
getRtcStatsReport
public void getRtcStatsReport()
Gets the RTC stats report for the publisher. This is an asynchronous operation. Call thesetRtcStatsReportListener(PublisherKit.PublisherRtcStatsReportListener listener)
method, and then implement thePublisherKit.PublisherRtcStatsReportListener.onRtcStatsReport(PublisherKit publisher, PublisherKit.PublisherRtcStats[] stats)
method prior to calling this method. When the stats are available, the implementation of thePublisherKit.PublisherRtcStatsReportListener.onRtcStatsReport(PublisherKit publisher, PublisherKit.PublisherRtcStats[] stats)
method is called.Also see
setAudioStatsListener(PublisherKit.AudioStatsListener listener)
,setVideoStatsListener(PublisherKit.VideoStatsListener listener)
, andSubscriberKit.getRtcStatsReport()
.
-
onRtcStatsReport
protected void onRtcStatsReport(PublisherKit.PublisherRtcStats[] stats)
Called when the publisher's RTC stats report is available in response to a call togetRtcStatsReport()
.If you extend the PublisherKit class, you can override this method instead of implementing the onRtcStatsReport() method of the PublisherKit.PublisherRtcStatsReportListener interface.
-
onStreamCreated
protected void onStreamCreated(Stream stream)
Invoked when the publisher's stream is created.If you extend the PublisherKit class, you can override this method instead of the
onStreamCreated()
method of the PublisherKit.PublisherListener interface.- Parameters:
stream
- The stream that that is created.
-
onStreamDestroyed
protected void onStreamDestroyed(Stream stream)
Invoked when the publisher's stream is destroyed.If you extend the PublisherKit class, you can override this method instead of the
onStreamDestroyed()
method of the PublisherKit.PublisherListener interface.- Parameters:
stream
- The stream that that is destroyed.
-
onError
protected void onError(OpentokError error)
Invoked when the publisher fails.If you extend the PublisherKit class, you can override this method instead of the
onError()
method of the PublisherKit.PublisherListener interface.- Parameters:
error
- The error that invoked this callback.
-
onAudioLevelUpdated
protected void onAudioLevelUpdated(float audioLevel)
Called periodically to report the audio level of the publisher.- Parameters:
audioLevel
- The audio level, from 0 to 1.0. Adjust this value logarithmically for use in a user interface visualization (such as a volume meter).
-
onMuteForced
protected void onMuteForced()
Invoked when a moderator has forced this publisher to mute audio.If you extend the PublisherKit class, you can override this method instead of the
onMuteForced()
method of the PublisherKit.MuteListener interface.
-
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 the 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 when it determines that there are no more references to the PublisherKit object.- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
onStop
public void onStop()
Releases resources tied to the publisher. Calling this method causes the publisher to stop capturing, and then it releases the camera. To reuse the publisher after calling this method, call theonRestart()
method.
-
onRestart
public void onRestart()
Restarts publisher resources that were previously released by calling theonStop()
method.
-
-