public class Camera2Capturer
extends java.lang.Object
CameraVideoCapturer.CameraEventsHandler, CameraVideoCapturer.CameraStatistics, CameraVideoCapturer.CameraSwitchHandler, CameraVideoCapturer.MediaRecorderHandler
Constructor and Description |
---|
Camera2Capturer(android.content.Context context,
java.lang.String cameraName,
CameraVideoCapturer.CameraEventsHandler eventsHandler) |
Modifier and Type | Method and Description |
---|---|
void |
changeCaptureFormat(int width,
int height,
int framerate) |
protected void |
createCameraSession(CameraSession.CreateSessionCallback createSessionCallback,
CameraSession.Events events,
android.content.Context applicationContext,
SurfaceTextureHelper surfaceTextureHelper,
java.lang.String cameraName,
int width,
int height,
int framerate) |
void |
dispose()
Perform any final cleanup here.
|
protected java.lang.String |
getCameraName() |
CameraSession |
getCameraSession()
Returns the current camera session.
|
android.os.Handler |
getHandler()
Returns the camera thread Handler.
|
void |
initialize(SurfaceTextureHelper surfaceTextureHelper,
android.content.Context applicationContext,
CapturerObserver capturerObserver)
This function is used to initialize the camera thread, the android application context, and the
capture observer.
|
boolean |
isScreencast() |
void |
printStackTrace() |
void |
startCapture(int width,
int height,
int framerate)
Start capturing frames in a format that is as close as possible to
width x height and
framerate . |
void |
stopCapture()
Stop capturing.
|
void |
switchCamera(CameraVideoCapturer.CameraSwitchHandler switchEventsHandler)
Switch camera to the next valid camera id.
|
void |
switchCamera(CameraVideoCapturer.CameraSwitchHandler switchEventsHandler,
java.lang.String cameraName)
Switch camera to the specified camera id.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addMediaRecorderToCamera, removeMediaRecorderFromCamera
public Camera2Capturer(android.content.Context context, java.lang.String cameraName, CameraVideoCapturer.CameraEventsHandler eventsHandler)
protected void createCameraSession(CameraSession.CreateSessionCallback createSessionCallback, CameraSession.Events events, android.content.Context applicationContext, SurfaceTextureHelper surfaceTextureHelper, java.lang.String cameraName, int width, int height, int framerate)
public void initialize(SurfaceTextureHelper surfaceTextureHelper, android.content.Context applicationContext, CapturerObserver capturerObserver)
VideoCapturer
surfaceTextureHelper
, register itself as a listener, and forward the frames to
CapturerObserver.onFrameCaptured(). The caller still has ownership of surfaceTextureHelper
and is responsible for making sure surfaceTextureHelper.dispose() is
called. This also means that the caller can reuse the SurfaceTextureHelper to initialize a new
VideoCapturer once the previous VideoCapturer has been disposed.initialize
in interface VideoCapturer
public void startCapture(int width, int height, int framerate)
VideoCapturer
width x height
and
framerate
.startCapture
in interface VideoCapturer
public void stopCapture()
VideoCapturer
stopCapture
in interface VideoCapturer
public void changeCaptureFormat(int width, int height, int framerate)
changeCaptureFormat
in interface VideoCapturer
public void dispose()
VideoCapturer
dispose
in interface VideoCapturer
public void switchCamera(CameraVideoCapturer.CameraSwitchHandler switchEventsHandler)
CameraVideoCapturer
switchCamera
in interface CameraVideoCapturer
public void switchCamera(CameraVideoCapturer.CameraSwitchHandler switchEventsHandler, java.lang.String cameraName)
CameraVideoCapturer
switchCamera
in interface CameraVideoCapturer
@Nullable public CameraSession getCameraSession()
@Nullable public android.os.Handler getHandler()
public boolean isScreencast()
isScreencast
in interface VideoCapturer
public void printStackTrace()
protected java.lang.String getCameraName()
7.0.0