BaseVideoCapturer
public abstract class BaseVideoCapturer
Defines a video capturer to be used by a PublisherKit object.
Nested types: BaseVideoCapturer.VideoContentHint, BaseVideoCapturer.CaptureSettings, BaseVideoCapturer.CaptureSwitch
Properties
| Name | Type | Description |
|---|---|---|
frameMirrorX |
boolean | protected |
NV21 |
int | static final Defines the value for the NV21 pixel format used by the CaptureSettings#format property. Constant value: 1 |
ARGB |
int | static final Defines the value for the ARGB pixel format used by the CaptureSettings#format property. Constant value: 2 |
YUV420P |
int | static final Defines the value for the YUV420P pixel format used by the CaptureSettings#format property. Constant value: 3 |
NV12 |
int | static final Defines the value for the NV12 pixel format used by the CaptureSettings#format property. Constant value: 4 |
YUY2 |
int | static final Defines the value for the YUY2 pixel format used by the CaptureSettings#format property. Constant value: 5 |
UYVY |
int | static final Defines the value for the UYVY pixel format used by the CaptureSettings#format property. Constant value: 6 |
BGRA |
int | static final Defines the value for the BGRA pixel format used by the CaptureSettings#format property. Constant value: 7 |
RGB |
int | static final Defines the value for the RGB pixel format used by the CaptureSettings#format property. Constant value: 8 |
MJPEG |
int | static final Defines the value for the MJPEG pixel format used by the CaptureSettings#format property. Constant value: 9 |
ABGR |
int | static final Defines the value for the ABGR pixel format used by the CaptureSettings#format property. Constant value: 10 |
RGBA |
int | static final Defines the value for the RGBA pixel format used by the CaptureSettings#format property. Constant value: 11 |
Methods
| Name | Description |
|---|---|
BaseVideoCapturer() |
|
destroy() |
Destroys the BaseVideoCapturer object. |
getCaptureSettings() → {BaseVideoCapturer.CaptureSettings} |
Returns the settings for the video capturer. |
getVideoContentHint() → {BaseVideoCapturer.VideoContentHint} |
Returns the video content hint setting. |
init() |
Initializes the video capturer. |
isCaptureStarted() → {boolean} |
Whether video is being captured (true) or not (false). |
onCameraChanged(cameraID) |
|
onCaptureError(exp) |
|
onPause() |
Call this method when the activity pauses. |
onRestart() |
Call this method when the activity is restarted. |
onResume() |
Call this method when the activity resumes. |
onStop() |
Call this method when the activity stops. |
provideBufferFrame(buffer, format, width, height, rotation, mirrorX) |
Provide a frame of video as a byte buffer. |
provideBufferFrame(buffer, format, width, height, rotation, mirrorX, metadata) |
Provide a frame of video as a byte buffer. |
provideBufferFramePlanar(yplane, uplane, vplane, yPixelStride, yRowStride, uPixelStride, uRowStride, vPixelStride, vRowStride, width, height, rotation, mirrorX) |
Provide a frame of video as 3 bytebuffer planes. |
provideBufferFramePlanar(yplane, uplane, vplane, yPixelStride, yRowStride, uPixelStride, uRowStride, vPixelStride, vRowStride, width, height, rotation, mirrorX, metadata) |
Provide a frame of video as 3 bytebuffer planes. |
provideByteArrayFrame(data, format, width, height, rotation, mirrorX) |
Provide a frame of video as a byte array. |
provideByteArrayFrame(data, format, width, height, rotation, mirrorX, metadata) |
Provide a frame of video as a byte array. |
provideIntArrayFrame(data, format, width, height, rotation, mirrorX) |
Provide a frame of video as an array of integers. |
provideIntArrayFrame(data, format, width, height, rotation, mirrorX, metadata) |
Provide a frame of video as an array of integers. |
setPublisherKit(publisher) |
|
setVideoContentHint(contentHint) |
Sets the video content hint. |
startCapture() → {int} |
Starts capturing video. |
stopCapture() → {int} |
Stops capturing video. |
BaseVideoCapturer()
destroy()
Destroys the BaseVideoCapturer object.
getCaptureSettings() → {BaseVideoCapturer.CaptureSettings}
Returns the settings for the video capturer.
Returns:
BaseVideoCapturer.CaptureSettings
getVideoContentHint() → {BaseVideoCapturer.VideoContentHint}
Returns the video content hint setting.
See:
: - VideoContentHint
Returns:
The video content hint setting.
init()
Initializes the video capturer.
isCaptureStarted() → {boolean}
Whether video is being captured (true) or not (false).
Returns:
boolean
onCameraChanged(cameraID)
Parameters:
| Name | Type | Description |
|---|---|---|
cameraID |
int |
onCaptureError(exp)
Parameters:
| Name | Type | Description |
|---|---|---|
exp |
Exception |
onPause()
Call this method when the activity pauses. When you override this method, implement code to respond to the activity being paused. For example, you may pause capturing audio or video.
See:
: - onResume()
onRestart()
Call this method when the activity is restarted. When you override this method, implement code to respond to the activity being restarted. For example, you may restart video capturing.
See:
: - onStop()
onResume()
Call this method when the activity resumes. When you override this method, implement code to respond to the activity being resumed. For example, you may resume capturing audio or video.
See:
: - onPause()
onStop()
Call this method when the activity stops. When you override this method, implement code to respond to the activity being stopped. For example, you may release all the resources this capture owns like the camera capturing session.
See:
: - onRestart()
provideBufferFrame(buffer, format, width, height, rotation, mirrorX)
Provide a frame of video as a byte buffer.
Parameters:
| Name | Type | Description |
|---|---|---|
buffer |
ByteBuffer | The video frame data, as a byte buffer. |
format |
int | The video format, as defined by the ARGB and NV21 constants. |
width |
int | The width of the video frame, in pixels. |
height |
int | The height of the video frame, in pixels. |
rotation |
int | The rotation of the video frame. Valid values are defined by constants in the android.view.Surface class. |
mirrorX |
boolean | Whether to mirror the video on the x-axis (true) or not (false). |
provideBufferFrame(buffer, format, width, height, rotation, mirrorX, metadata)
Provide a frame of video as a byte buffer. This version of the method
includes a metadata parameter, for including frame metadata.
Deprecated — Deprecated. Use BaseVideoCapturer#provideBufferFrame(ByteBuffer, int, int, int, int, boolean) instead. This method will be removed in a future version.
Parameters:
| Name | Type | Description |
|---|---|---|
buffer |
ByteBuffer | The video frame data, as a byte buffer. |
format |
int | The video format, as defined by the ARGB and NV21 constants. |
width |
int | The width of the video frame, in pixels. |
height |
int | The height of the video frame, in pixels. |
rotation |
int | The rotation of the video frame. Valid values are defined by constants in the android.view.Surface class. |
mirrorX |
boolean | Whether to mirror the video on the x-axis (true) or not (false). |
metadata |
byte[] | The video frame metadata to be associated with the frame, as a byte array. The maximum size allowed is 32 bytes. |
provideBufferFramePlanar(yplane, uplane, vplane, yPixelStride, yRowStride, uPixelStride, uRowStride, vPixelStride, vRowStride, width, height, rotation, mirrorX)
Provide a frame of video as 3 bytebuffer planes.
Parameters:
| Name | Type | Description |
|---|---|---|
yplane |
ByteBuffer | The y video frame data, as a byte buffer. |
uplane |
ByteBuffer | The u video frame data, as a byte buffer. |
vplane |
ByteBuffer | The v video frame data, as a byte buffer. |
yPixelStride |
int | The y pixel stride, in bytes. |
yRowStride |
int | The y row stride, in bytes. |
uPixelStride |
int | The u pixel stride, in bytes. |
uRowStride |
int | The u row stride, in bytes. |
vPixelStride |
int | The v pixel stride, in bytes. |
vRowStride |
int | The v row stride, in bytes. |
width |
int | The width of the video frame, in pixels. |
height |
int | The height of the video frame, in pixels. |
rotation |
int | The rotation of the video frame. Valid values are defined by constants in the android.view.Surface class. |
mirrorX |
boolean | Whether to mirror the video on the x-axis (true) or not (false). |
provideBufferFramePlanar(yplane, uplane, vplane, yPixelStride, yRowStride, uPixelStride, uRowStride, vPixelStride, vRowStride, width, height, rotation, mirrorX, metadata)
Provide a frame of video as 3 bytebuffer planes. This version of
the method includes a metadata parameter, for including
frame metadata.
Deprecated — Deprecated. Use BaseVideoCapturer#provideBufferFramePlanar(ByteBuffer, ByteBuffer, ByteBuffer, int, int, int, int, int, int, int, int, int, boolean) instead. This method will be removed in a future version.
Parameters:
| Name | Type | Description |
|---|---|---|
yplane |
ByteBuffer | The y video frame data, as a byte buffer. |
uplane |
ByteBuffer | The u video frame data, as a byte buffer. |
vplane |
ByteBuffer | The v video frame data, as a byte buffer. |
yPixelStride |
int | The y pixel stride, in bytes. |
yRowStride |
int | The y row stride, in bytes. |
uPixelStride |
int | The u pixel stride, in bytes. |
uRowStride |
int | The u row stride, in bytes. |
vPixelStride |
int | The v pixel stride, in bytes. |
vRowStride |
int | The v row stride, in bytes. |
width |
int | The width of the video frame, in pixels. |
height |
int | The height of the video frame, in pixels. |
rotation |
int | The rotation of the video frame. Valid values are defined by constants in the android.view.Surface class. |
mirrorX |
boolean | Whether to mirror the video on the x-axis (true) or not (false). |
metadata |
byte[] | The video frame metadata to be associated with the frame, as a byte array. The maximum size allowed is 32 bytes. |
provideByteArrayFrame(data, format, width, height, rotation, mirrorX)
Provide a frame of video as a byte array.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
byte[] | The video frame data, as a byte array. |
format |
int | The video format, as defined by the ARGB and NV21 constants. |
width |
int | The width of the video frame, in pixels. |
height |
int | The height of the video frame, in pixels. |
rotation |
int | The rotation of the video frame. Valid values are defined by constants in the android.view.Surface class. |
mirrorX |
boolean | Whether to mirror the video on the x-axis (true) or not (false). |
provideByteArrayFrame(data, format, width, height, rotation, mirrorX, metadata)
Provide a frame of video as a byte array.
Deprecated — Deprecated. Use BaseVideoCapturer#provideByteArrayFrame(byte[], int, int, int, int, boolean) instead. This method will be removed in a future version.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
byte[] | The video frame data, as a byte array. |
format |
int | The video format, as defined by the ARGB and NV21 constants. |
width |
int | The width of the video frame, in pixels. |
height |
int | The height of the video frame, in pixels. |
rotation |
int | The rotation of the video frame. Valid values are defined by constants in the android.view.Surface class. |
mirrorX |
boolean | Whether to mirror the video on the x-axis (true) or not (false). |
metadata |
byte[] | The video frame metadata to be associated with the frame, as a byte array. The maximum size allowed is 32 bytes. |
provideIntArrayFrame(data, format, width, height, rotation, mirrorX)
Provide a frame of video as an array of integers.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
int[] | The video frame data, as an array of integers. |
format |
int | The video format, as defined by the ARGB and NV21 constants. |
width |
int | The width of the video frame, in pixels. |
height |
int | The height of the video frame, in pixels. |
rotation |
int | The rotation of the video frame. Valid values are defined by constants in the android.view.Surface class. |
mirrorX |
boolean | Whether to mirror the video on the x-axis (true) or not (false). |
provideIntArrayFrame(data, format, width, height, rotation, mirrorX, metadata)
Provide a frame of video as an array of integers.
Deprecated — Deprecated. Use BaseVideoCapturer#provideIntArrayFrame(int[], int, int, int, int, boolean) instead. This method will be removed in a future version.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
int[] | The video frame data, as an array of integers. |
format |
int | The video format, as defined by the ARGB and NV21 constants. |
width |
int | The width of the video frame, in pixels. |
height |
int | The height of the video frame, in pixels. |
rotation |
int | The rotation of the video frame. Valid values are defined by constants in the android.view.Surface class. |
mirrorX |
boolean | Whether to mirror the video on the x-axis (true) or not (false). |
metadata |
byte[] | The video frame metadata to be associated with the frame, as a byte array. The maximum size allowed is 32 bytes. |
setPublisherKit(publisher)
Parameters:
| Name | Type | Description |
|---|---|---|
publisher |
PublisherKit |
setVideoContentHint(contentHint)
Sets the video content hint. Valid values are defined in the VideoContentHint enum.
The default setting is VideoContentHint#NONE.
Parameters:
| Name | Type | Description |
|---|---|---|
contentHint |
BaseVideoCapturer.VideoContentHint | The video content hint. |
startCapture() → {int}
Starts capturing video.
Returns:
int
stopCapture() → {int}
Stops capturing video.
Returns:
int