.. java:import:: java.io IOException .. java:import:: java.util ArrayList .. java:import:: java.util List .. java:import:: java.util.concurrent Exchanger .. java:import:: android.content Context .. java:import:: android.graphics ImageFormat .. java:import:: android.graphics SurfaceTexture .. java:import:: android.hardware Camera .. java:import:: android.opengl GLES11Ext .. java:import:: android.opengl GLES20 .. java:import:: android.os Handler .. java:import:: android.os Looper .. java:import:: android.os SystemClock .. java:import:: at.jumpch.utils Log .. java:import:: android.view Surface .. java:import:: android.view SurfaceHolder .. java:import:: android.view WindowManager JCVideoCapture ============== .. java:package:: at.jumpch.sdk :noindex: .. java:type:: @SuppressWarnings public class JCVideoCapture implements JCVideoCaptureInterface, Camera.PreviewCallback The JCVideoCapture class implements \ :java:ref:`JCVideoCaptureInterface`\ to access the default Android camera video capture. Constructors ------------ JCVideoCapture ^^^^^^^^^^^^^^ .. java:constructor:: public JCVideoCapture() :outertype: JCVideoCapture Creates a new JCVideoCapture object to access a particular hardware camera and provide frames for streaming. Methods ------- enableHD ^^^^^^^^ .. java:method:: public boolean enableHD(boolean enable) :outertype: JCVideoCapture Enable HD or SD when capturing the video :param enable: boolean to determine HD(ex. 1280x720) or SD(ex. 640x480) quality. :return: \ ``true``\ if successfully enabled HD, \ ``false``\ otherwise onPreviewFrame ^^^^^^^^^^^^^^ .. java:method:: @Override public void onPreviewFrame(byte[] data, Camera camera) :outertype: JCVideoCapture Called as preview frames are displayed. This callback is invoked on the event thread \ :java:ref:`android.hardware.Camera.open(int)`\ was called from. If using the \ :java:ref:`android.graphics.ImageFormat.YV12`\ format, refer to the equations in \ :java:ref:`Camera.Parameters.setPreviewFormat`\ for the arrangement of the pixel data in the preview callback buffers. :param data: the contents of the preview frame in the format defined by \ :java:ref:`android.graphics.ImageFormat`\ , which can be queried with \ :java:ref:`android.hardware.Camera.Parameters.getPreviewFormat()`\ . If \ :java:ref:`android.hardware.Camera.Parameters.setPreviewFormat(int)`\ is never called, the default will be the YCbCr_420_SP (NV21) format. :param camera: the Camera service object. resumeCapture ^^^^^^^^^^^^^ .. java:method:: public boolean resumeCapture() :outertype: JCVideoCapture Resume video capture. Generally restart the capture thread if stopped. :return: \ ``true``\ if success, \ ``false``\ otherwise selectCamera ^^^^^^^^^^^^ .. java:method:: public boolean selectCamera(int cameraId) :outertype: JCVideoCapture Select the camera id. For example front or back camera. This can be an empty method in a custom stream. :param cameraId: Integer to determine if front or back camera should be used. See \ :java:ref:`android.hardware.Camera.open`\ :return: \ ``true``\ if camera selection was successful, \ ``false``\ otherwise startCapture ^^^^^^^^^^^^ .. java:method:: public boolean startCapture(int width, int height, int framerate, Context applicationContext, JCVideoCaptureCallback cb) :outertype: JCVideoCapture Start a thread to provide video frames to the system. Parameters are suggestions and can be safely ignored when implementing the method. :param width: Video frame width :param height: Video frame height :param framerate: Frames per second :param applicationContext: Application context provided in \ :java:ref:`JCClient`\ :param cb: Callback object used to provide video frame to the system :return: \ ``true``\ if successful, \ ``false``\ otherwise stopCapture ^^^^^^^^^^^ .. java:method:: public synchronized boolean stopCapture() :outertype: JCVideoCapture Stop the capture thread. Called when app goes into the background. :return: \ ``true``\ if successful, \ ``false``\ otherwise switchCamera ^^^^^^^^^^^^ .. java:method:: public boolean switchCamera() :outertype: JCVideoCapture Switch the camera. Used to toggle between front and back camera. :return: \ ``true``\ if successful, \ ``false``\ otherwise