public class LocalVideoTrack extends VideoTrack
VideoCapturer
or VideoCapturer
.
When a local video track is created, the SDK will call VideoCapturer.initialize(SurfaceTextureHelper, Context, CapturerObserver)
and VideoCapturer.startCapture(int, int, int)
on the calling thread before returning the
local video track instance. The capturer will be instructed to start capturing at the default
video format of 640x480 at 30 FPS unless any of the following conditions are true:
VideoFormat
when creating the local video track. In
this case, the VideoCapturer
is responsible for capturing at the
provided VideoFormat
.
VideoCapturer
and no VideoFormat
is provided
when creating the local video track. In this case, the SDK will call VideoCapturer.startCapture(int, int, int)
with the result of VideoCapturer.getCaptureFormat()
.
VideoCapturer
Modifier and Type | Method and Description |
---|---|
void |
addSink(VideoSink videoSink)
Add a video sink to receive frames from the video track.
|
static LocalVideoTrack |
create(android.content.Context context,
boolean enabled,
VideoCapturer videoCapturer)
Creates a local video track.
|
static LocalVideoTrack |
create(android.content.Context context,
boolean enabled,
VideoCapturer videoCapturer,
java.lang.String name)
Creates a local video track.
|
static LocalVideoTrack |
create(android.content.Context context,
boolean enabled,
VideoCapturer videoCapturer,
VideoFormat videoFormat)
Creates a local video track.
|
static LocalVideoTrack |
create(android.content.Context context,
boolean enabled,
VideoCapturer videoCapturer,
VideoFormat videoFormat,
java.lang.String name)
Creates a local video track.
|
void |
enable(boolean enabled)
Sets the state of the local video track.
|
java.lang.String |
getName()
Returns the local video track name.
|
VideoCapturer |
getVideoCapturer()
Returns the
VideoCapturer associated with this video track. |
VideoFormat |
getVideoFormat()
Returns the video track's
VideoFormat . |
VideoSource |
getVideoSource()
Returns the
VideoSource associated with this video track. |
boolean |
isEnabled()
Check if the local video track is enabled.
|
void |
release()
Releases native memory owned by video track.
|
void |
removeSink(VideoSink videoSink)
Remove a video sink to stop receiving video from the video track.
|
getSinks
@Nullable public static LocalVideoTrack create(@NonNull android.content.Context context, boolean enabled, @NonNull VideoCapturer videoCapturer)
If the capturer is an instance of VideoCapturer
then VideoCapturer.startCapture(int, int, int)
will be called with the result of
VideoCapturer.getCaptureFormat()
. This behavior allows VideoCapturer
implementations to provide a better default capture format. For example, the ScreenCapturer
provides a resolution derived from the device's screen dimensions.
If the capturer is an instance of VideoCapturer
then the default format
of 640x480 at 30 FPS will be used.
context
- application context.enabled
- initial state of video track.videoCapturer
- capturer that provides video frames.null
if video track could not be
created.@Nullable public static LocalVideoTrack create(@NonNull android.content.Context context, boolean enabled, @NonNull VideoCapturer videoCapturer, @Nullable VideoFormat videoFormat)
The video capturer will be instructed to capture at the provided VideoFormat
.
context
- application context.enabled
- initial state of video track.videoCapturer
- capturer that provides video frames.videoFormat
- format to capture frames.@Nullable public static LocalVideoTrack create(@NonNull android.content.Context context, boolean enabled, @NonNull VideoCapturer videoCapturer, @Nullable java.lang.String name)
If the capturer is an instance of VideoCapturer
then VideoCapturer.startCapture(int, int, int)
will be called with the result of
VideoCapturer.getCaptureFormat()
. This behavior allows VideoCapturer
implementations to provide a better default capture format. For example, the ScreenCapturer
provides a resolution derived from the device's screen dimensions.
If the capturer is an instance of VideoCapturer
then the default format
of 640x480 at 30 FPS will be used.
context
- application context.enabled
- initial state of video track.videoCapturer
- capturer that provides video frames.name
- video track name.@Nullable public static LocalVideoTrack create(@NonNull android.content.Context context, boolean enabled, @NonNull VideoCapturer videoCapturer, @Nullable VideoFormat videoFormat, @Nullable java.lang.String name)
The video capturer will be instructed to capture at the provided VideoFormat
.
context
- application context.enabled
- initial state of video track.videoCapturer
- capturer that provides video frames.videoFormat
- format to capture frames.name
- video track name.@NonNull public VideoCapturer getVideoCapturer()
VideoCapturer
associated with this video track.@NonNull public VideoFormat getVideoFormat()
VideoFormat
.@NonNull public VideoSource getVideoSource()
VideoSource
associated with this video track.public void addSink(@NonNull VideoSink videoSink)
VideoTrack
addSink
in class VideoTrack
videoSink
- video sink that receives video.public void removeSink(@NonNull VideoSink videoSink)
VideoTrack
removeSink
in class VideoTrack
videoSink
- the video sink that should no longer receives video.public boolean isEnabled()
When the value is false, blank video frames are sent. When the value is true, frames from the video capturer are provided.
isEnabled
in interface Track
isEnabled
in class VideoTrack
@NonNull public java.lang.String getName()
getName
in interface Track
getName
in class VideoTrack
public void enable(boolean enabled)
enabled
- the desired state of the local video track.public void release()
6.0.0