JCVideoCapture¶
- public class JCVideoCapture implements JCVideoCaptureInterface, Camera.PreviewCallback¶
The JCVideoCapture class implements JCVideoCaptureInterface to access the default Android camera video capture.
Constructors¶
Methods¶
enableHD¶
- public boolean enableHD(boolean enable)¶
Enable HD or SD when capturing the video
Parameters: - enable – boolean to determine HD(ex. 1280x720) or SD(ex. 640x480) quality.
Returns: true if successfully enabled HD, false otherwise
onPreviewFrame¶
- public void onPreviewFrame(byte[] data, Camera camera)¶
Called as preview frames are displayed. This callback is invoked on the event thread android.hardware.Camera.open(int) was called from.
If using the android.graphics.ImageFormat.YV12 format, refer to the equations in Camera.Parameters.setPreviewFormat for the arrangement of the pixel data in the preview callback buffers.
Parameters: - data – the contents of the preview frame in the format defined by android.graphics.ImageFormat, which can be queried with android.hardware.Camera.Parameters.getPreviewFormat(). If android.hardware.Camera.Parameters.setPreviewFormat(int) is never called, the default will be the YCbCr_420_SP (NV21) format.
- camera – the Camera service object.
resumeCapture¶
- public boolean resumeCapture()¶
Resume video capture. Generally restart the capture thread if stopped.
Returns: true if success, false otherwise
selectCamera¶
- public boolean selectCamera(int cameraId)¶
Select the camera id. For example front or back camera. This can be an empty method in a custom stream.
Parameters: - cameraId – Integer to determine if front or back camera should be used. See android.hardware.Camera.open
Returns: true if camera selection was successful, false otherwise
startCapture¶
- public boolean startCapture(int width, int height, int framerate, Context applicationContext, JCVideoCaptureCallback cb)¶
Start a thread to provide video frames to the system. Parameters are suggestions and can be safely ignored when implementing the method.
Parameters: - width – Video frame width
- height – Video frame height
- framerate – Frames per second
- applicationContext – Application context provided in JCClient
- cb – Callback object used to provide video frame to the system
Returns: true if successful, false otherwise