java.lang.Object

com.opentok.android.BaseVideoCapturer


public abstract class BaseVideoCapturer extends Object

Defines a video capturer to be used by a PublisherKit object.

See Also: : - PublisherKit.getCapturer()

Nested Class Summary

Nested Classes

Modifier and Type

Class

Description

static class

BaseVideoCapturer.CaptureSettings

Defines the capture settings for a video capturer.

static interface

BaseVideoCapturer.CaptureSwitch

An interface for defining how the BaseVideoCapturer.CaptureSwitch.cycleCamera() method of a Publisher object that implements a custom video capturer.

static enum

BaseVideoCapturer.VideoContentHint

Defines the content hint settings for a video capturer.

Field Summary

Fields

Modifier and Type

Field

Description

static final int

ABGR

Defines the value for the ABGR pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

static final int

ARGB

Defines the value for the ARGB pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

static final int

BGRA

Defines the value for the BGRA pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

protected boolean

frameMirrorX

static final int

MJPEG

Defines the value for the MJPEG pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

static final int

NV12

Defines the value for the NV12 pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

static final int

NV21

Defines the value for the NV21 pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

static final int

RGB

Defines the value for the RGB pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

static final int

RGBA

Defines the value for the RGBA pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

static final int

UYVY

Defines the value for the UYVY pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

static final int

YUV420P

Defines the value for the YUV420P pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

static final int

YUY2

Defines the value for the YUY2 pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

Constructor Summary

Constructors

Constructor

Description

BaseVideoCapturer()

Method Summary

All MethodsInstance MethodsAbstract MethodsConcrete MethodsDeprecated Methods

Modifier and Type

Method

Description

abstract void

destroy()

Destroys the BaseVideoCapturer object.

abstract BaseVideoCapturer.CaptureSettings

getCaptureSettings()

Returns the settings for the video capturer.

BaseVideoCapturer.VideoContentHint

getVideoContentHint()

Returns the video content hint setting.

abstract void

init()

Initializes the video capturer.

abstract boolean

isCaptureStarted()

Whether video is being captured (true) or not (false).

protected void

onCameraChanged(int cameraID)

protected void

onCaptureError(Exception exp)

abstract void

onPause()

Call this method when the activity pauses.

void

onRestart()

Call this method when the activity is restarted.

abstract void

onResume()

Call this method when the activity resumes.

void

onStop()

Call this method when the activity stops.

void

provideBufferFrame(ByteBuffer buffer, int format, int width, int height, int rotation, boolean mirrorX)

Provide a frame of video as a byte buffer.

void

provideBufferFrame(ByteBuffer buffer, int format, int width, int height, int rotation, boolean mirrorX, byte[] metadata)

Deprecated.

Deprecated.

void

provideBufferFramePlanar(ByteBuffer yplane, ByteBuffer uplane, ByteBuffer vplane, int yPixelStride, int yRowStride, int uPixelStride, int uRowStride, int vPixelStride, int vRowStride, int width, int height, int rotation, boolean mirrorX)

Provide a frame of video as 3 bytebuffer planes.

void

provideBufferFramePlanar(ByteBuffer yplane, ByteBuffer uplane, ByteBuffer vplane, int yPixelStride, int yRowStride, int uPixelStride, int uRowStride, int vPixelStride, int vRowStride, int width, int height, int rotation, boolean mirrorX, byte[] metadata)

Deprecated.

Deprecated.

void

provideByteArrayFrame(byte[] data, int format, int width, int height, int rotation, boolean mirrorX)

Provide a frame of video as a byte array.

void

provideByteArrayFrame(byte[] data, int format, int width, int height, int rotation, boolean mirrorX, byte[] metadata)

Deprecated.

Deprecated.

void

provideIntArrayFrame(int[] data, int format, int width, int height, int rotation, boolean mirrorX)

Provide a frame of video as an array of integers.

void

provideIntArrayFrame(int[] data, int format, int width, int height, int rotation, boolean mirrorX, byte[] metadata)

Deprecated.

Deprecated.

protected void

setPublisherKit(PublisherKit publisher)

void

setVideoContentHint(BaseVideoCapturer.VideoContentHint contentHint)

Sets the video content hint.

abstract int

startCapture()

Starts capturing video.

abstract int

stopCapture()

Stops capturing video.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

frameMirrorX

protected boolean frameMirrorX

NV21

public static final int NV21

Defines the value for the NV21 pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

See Also: : - [Constant Field Values]

ARGB

public static final int ARGB

Defines the value for the ARGB pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

See Also: : - [Constant Field Values]

YUV420P

public static final int YUV420P

Defines the value for the YUV420P pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

See Also: : - [Constant Field Values]

NV12

public static final int NV12

Defines the value for the NV12 pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

See Also: : - [Constant Field Values]

YUY2

public static final int YUY2

Defines the value for the YUY2 pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

See Also: : - [Constant Field Values]

UYVY

public static final int UYVY

Defines the value for the UYVY pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

See Also: : - [Constant Field Values]

BGRA

public static final int BGRA

Defines the value for the BGRA pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

See Also: : - [Constant Field Values]

RGB

public static final int RGB

Defines the value for the RGB pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

See Also: : - [Constant Field Values]

MJPEG

public static final int MJPEG

Defines the value for the MJPEG pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

See Also: : - [Constant Field Values]

ABGR

public static final int ABGR

Defines the value for the ABGR pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

See Also: : - [Constant Field Values]

RGBA

public static final int RGBA

Defines the value for the RGBA pixel format used by the BaseVideoCapturer.CaptureSettings.format property.

See Also: : - [Constant Field Values]

Constructor Details

BaseVideoCapturer

public BaseVideoCapturer()

Method Details

setVideoContentHint

public void setVideoContentHint(BaseVideoCapturer.VideoContentHint contentHint)

Sets the video content hint. Valid values are defined in the BaseVideoCapturer.VideoContentHint enum. The default setting is BaseVideoCapturer.VideoContentHint.NONE.

Parameters: : contentHint - The video content hint.

getVideoContentHint

public BaseVideoCapturer.VideoContentHint getVideoContentHint()

Returns the video content hint setting.

Returns: : The video content hint setting.

See Also: : - BaseVideoCapturer.VideoContentHint

init

public abstract void init()

Initializes the video capturer.

startCapture

public abstract int startCapture()

Starts capturing video.

stopCapture

public abstract int stopCapture()

Stops capturing video.

destroy

public abstract void destroy()

Destroys the BaseVideoCapturer object.

isCaptureStarted

public abstract boolean isCaptureStarted()

Whether video is being captured (true) or not (false).

getCaptureSettings

public abstract BaseVideoCapturer.CaptureSettings getCaptureSettings()

Returns the settings for the video capturer.

onPause

public abstract void 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 Also: : - onResume()

onResume

public abstract void 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 Also: : - onPause()

onStop

public void 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 Also: : - onRestart()

onRestart

public void 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 Also: : - onStop()

provideByteArrayFrame

public void provideByteArrayFrame(byte[] data, int format, int width, int height, int rotation, boolean mirrorX)

Provide a frame of video as a byte array.

Parameters: : data - The video frame data, as a byte array. : format - The video format, as defined by the ARGB and NV21 constants. : width - The width of the video frame, in pixels. : height - The height of the video frame, in pixels. : rotation - The rotation of the video frame. Valid values are defined by constants in the android.view.Surface class. : mirrorX - Whether to mirror the video on the x-axis (true) or not (false).

provideByteArrayFrame

@Deprecated public void provideByteArrayFrame(byte[] data, int format, int width, int height, int rotation, boolean mirrorX, byte[] metadata)

Deprecated.

Deprecated. Use provideByteArrayFrame(byte[], int, int, int, int, boolean) instead. This method will be removed in a future version.

Provide a frame of video as a byte array.

Parameters: : data - The video frame data, as a byte array. : format - The video format, as defined by the ARGB and NV21 constants. : width - The width of the video frame, in pixels. : height - The height of the video frame, in pixels. : rotation - The rotation of the video frame. Valid values are defined by constants in the android.view.Surface class. : mirrorX - Whether to mirror the video on the x-axis (true) or not (false). : metadata - The video frame metadata to be associated with the frame, as a byte array. The maximum size allowed is 32 bytes.

provideIntArrayFrame

public void provideIntArrayFrame(int[] data, int format, int width, int height, int rotation, boolean mirrorX)

Provide a frame of video as an array of integers.

Parameters: : data - The video frame data, as an array of integers. : format - The video format, as defined by the ARGB and NV21 constants. : width - The width of the video frame, in pixels. : height - The height of the video frame, in pixels. : rotation - The rotation of the video frame. Valid values are defined by constants in the android.view.Surface class. : mirrorX - Whether to mirror the video on the x-axis (true) or not (false).

provideIntArrayFrame

@Deprecated public void provideIntArrayFrame(int[] data, int format, int width, int height, int rotation, boolean mirrorX, byte[] metadata)

Deprecated.

Deprecated. Use provideIntArrayFrame(int[], int, int, int, int, boolean) instead. This method will be removed in a future version.

Provide a frame of video as an array of integers.

Parameters: : data - The video frame data, as an array of integers. : format - The video format, as defined by the ARGB and NV21 constants. : width - The width of the video frame, in pixels. : height - The height of the video frame, in pixels. : rotation - The rotation of the video frame. Valid values are defined by constants in the android.view.Surface class. : mirrorX - Whether to mirror the video on the x-axis (true) or not (false). : metadata - The video frame metadata to be associated with the frame, as a byte array. The maximum size allowed is 32 bytes.

provideBufferFrame

public void provideBufferFrame(ByteBuffer buffer, int format, int width, int height, int rotation, boolean mirrorX)

Provide a frame of video as a byte buffer.

Parameters: : buffer - The video frame data, as a byte buffer. : format - The video format, as defined by the ARGB and NV21 constants. : width - The width of the video frame, in pixels. : height - The height of the video frame, in pixels. : rotation - The rotation of the video frame. Valid values are defined by constants in the android.view.Surface class. : mirrorX - Whether to mirror the video on the x-axis (true) or not (false).

provideBufferFrame

@Deprecated public void provideBufferFrame(ByteBuffer buffer, int format, int width, int height, int rotation, boolean mirrorX, byte[] metadata)

Deprecated.

Deprecated. Use provideBufferFrame(ByteBuffer, int, int, int, int, boolean) instead. This method will be removed in a future version.

Provide a frame of video as a byte buffer. This version of the method includes a metadata parameter, for including frame metadata.

Parameters: : buffer - The video frame data, as a byte buffer. : format - The video format, as defined by the ARGB and NV21 constants. : width - The width of the video frame, in pixels. : height - The height of the video frame, in pixels. : rotation - The rotation of the video frame. Valid values are defined by constants in the android.view.Surface class. : mirrorX - Whether to mirror the video on the x-axis (true) or not (false). : metadata - The video frame metadata to be associated with the frame, as a byte array. The maximum size allowed is 32 bytes.

provideBufferFramePlanar

public void provideBufferFramePlanar(ByteBuffer yplane, ByteBuffer uplane, ByteBuffer vplane, int yPixelStride, int yRowStride, int uPixelStride, int uRowStride, int vPixelStride, int vRowStride, int width, int height, int rotation, boolean mirrorX)

Provide a frame of video as 3 bytebuffer planes.

Parameters: : yplane - The y video frame data, as a byte buffer. : uplane - The u video frame data, as a byte buffer. : vplane - The v video frame data, as a byte buffer. : yPixelStride - The y pixel stride, in bytes. : yRowStride - The y row stride, in bytes. : uPixelStride - The u pixel stride, in bytes. : uRowStride - The u row stride, in bytes. : vPixelStride - The v pixel stride, in bytes. : vRowStride - The v row stride, in bytes. : width - The width of the video frame, in pixels. : height - The height of the video frame, in pixels. : rotation - The rotation of the video frame. Valid values are defined by constants in the android.view.Surface class. : mirrorX - Whether to mirror the video on the x-axis (true) or not (false).

provideBufferFramePlanar

@Deprecated public void provideBufferFramePlanar(ByteBuffer yplane, ByteBuffer uplane, ByteBuffer vplane, int yPixelStride, int yRowStride, int uPixelStride, int uRowStride, int vPixelStride, int vRowStride, int width, int height, int rotation, boolean mirrorX, byte[] metadata)

Deprecated.

Deprecated. Use provideBufferFramePlanar(ByteBuffer, ByteBuffer, ByteBuffer, int, int, int, int, int, int, int, int, int, boolean) instead. This method will be removed in a future version.

Provide a frame of video as 3 bytebuffer planes. This version of the method includes a metadata parameter, for including frame metadata.

Parameters: : yplane - The y video frame data, as a byte buffer. : uplane - The u video frame data, as a byte buffer. : vplane - The v video frame data, as a byte buffer. : yPixelStride - The y pixel stride, in bytes. : yRowStride - The y row stride, in bytes. : uPixelStride - The u pixel stride, in bytes. : uRowStride - The u row stride, in bytes. : vPixelStride - The v pixel stride, in bytes. : vRowStride - The v row stride, in bytes. : width - The width of the video frame, in pixels. : height - The height of the video frame, in pixels. : rotation - The rotation of the video frame. Valid values are defined by constants in the android.view.Surface class. : mirrorX - Whether to mirror the video on the x-axis (true) or not (false). : metadata - The video frame metadata to be associated with the frame, as a byte array. The maximum size allowed is 32 bytes.

onCaptureError

protected void onCaptureError(Exception exp)

onCameraChanged

protected void onCameraChanged(int cameraID)

setPublisherKit

protected void setPublisherKit(PublisherKit publisher)