public static class Publisher.Builder extends PublisherKit.Builder
Publisher
object. Instantiate a Builder object using the
Publisher.Builder(Context context)
constructor. Then call methods of the
Builder
instance to add settings for the publisher. (Note that the
Publisher.Builder
class inherits methods from the PublisherKit.Builder
class.) Then call the build()
method, which returns a Publisher
object.
Use the Session.publish(PublisherKit publisher)
method to start streaming
from the publisher into a session.
Constructor and Description |
---|
Builder(android.content.Context context)
Instantiates a
Publisher.Builder object. |
Modifier and Type | Method and Description |
---|---|
Publisher.Builder |
audioBitrate(int bitsPerSecond)
Sets the desired bitrate for the published audio, in bits per second.
|
Publisher.Builder |
audioTrack(boolean enabled)
Sets whether to include an audio track in the published stream (
true ,
the default) or not (false ). |
Publisher |
build()
Returns a new
Publisher instance based on the Publisher.Builder
settings. |
Publisher.Builder |
capturer(BaseVideoCapturer capturer)
Sets the video capturer to use for the publisher.
|
Publisher.Builder |
frameRate(Publisher.CameraCaptureFrameRate frameRate)
Sets the desired frame rate of the published video.
|
Publisher.Builder |
name(java.lang.String name)
Sets the name of the published video.
|
Publisher.Builder |
renderer(BaseVideoRenderer renderer)
Sets the video renderer to use for the publisher.
|
Publisher.Builder |
resolution(Publisher.CameraCaptureResolution resolution)
Sets the video resolution of the published video.
|
Publisher.Builder |
videoTrack(boolean enabled)
Sets whether to include an video track in the published stream (
true ,
the default) or not (false ). |
public Builder(android.content.Context context)
Publisher.Builder
object.public Publisher.Builder resolution(Publisher.CameraCaptureResolution resolution)
Publisher.CameraCaptureResolution
enumpublic Publisher.Builder frameRate(Publisher.CameraCaptureFrameRate frameRate)
Publisher.CameraCaptureFrameRate
enum. If the device does not support the
specified frame rate, it will use the closest supported frame rate. Note that
in sessions that use the OpenTok Media Router (sessions with the media mode set to
routed), lowering the frame rate proportionally reduces the bandwidth the stream uses.
However, in sessions that have the media mode set to relayed, lowering the frame rate
does not reduce the stream's bandwidth. (See
The OpenTok Media Router and media modes.)public Publisher.Builder name(java.lang.String name)
Stream.getName()
method for a stream
published by this publisher will return this value (on all clients).name
in class PublisherKit.Builder
public Publisher.Builder audioTrack(boolean enabled)
true
,
the default) or not (false
). Creating a publisher without an audio track
can save CPU resources and reduce the bandwidth used by the stream.
If you call this and pass in false
, the audio subsystem will not be
initialized for the publisher, and calling the
PublisherKit.setPublishAudio(boolean publishAudio)
method will have no effect.
If your application does not require the use of audio, it is recommended to use this
Builder setting rather than use the
PublisherKit.setPublishAudio(boolean publishAudio)
method, which only
temporarily disables the audio track.
audioTrack
in class PublisherKit.Builder
public Publisher.Builder videoTrack(boolean enabled)
true
,
the default) or not (false
). Creating a publisher without a video track
can save CPU resources and reduce the bandwidth used by the stream.
If you call this and pass in false
, the video subsystem will not be
initialized for the publisher, and calling the
PublisherKit.setPublishVideo(boolean publishVideo)
method will have no effect.
If your application does not require the use of video, it is recommended to use this
Builder setting rather than use the
PublisherKit.setPublishVideo(boolean publishVideo)
method, which only
temporarily disables the video track.
videoTrack
in class PublisherKit.Builder
public Publisher.Builder capturer(BaseVideoCapturer capturer)
capturer
in class PublisherKit.Builder
public Publisher.Builder renderer(BaseVideoRenderer renderer)
renderer
in class PublisherKit.Builder
public Publisher.Builder audioBitrate(int bitsPerSecond)
PublisherKit.Builder
The following are recommended settings:
The default value is 40,000.
To set other audio settings, see the AudioDeviceManager
class.
audioBitrate
in class PublisherKit.Builder
bitsPerSecond
- The desired bitrate of the audio, in bits per second.public Publisher build()
Publisher
instance based on the Publisher.Builder
settings.build
in class PublisherKit.Builder