Package tvi.webrtc
Class Camera2Session
- java.lang.Object
-
- tvi.webrtc.Camera2Session
-
- All Implemented Interfaces:
CameraSession
public class Camera2Session extends java.lang.Object implements CameraSession
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface tvi.webrtc.CameraSession
CameraSession.CreateSessionCallback, CameraSession.Events, CameraSession.FailureType
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description android.hardware.camera2.CaptureRequest.Builder
configureCaptureRequestBuilder()
Configures a CaptureRequest.Builder with optimal settings for capturing video frames.static void
create(CameraSession.CreateSessionCallback callback, CameraSession.Events events, android.content.Context applicationContext, android.hardware.camera2.CameraManager cameraManager, SurfaceTextureHelper surfaceTextureHelper, java.lang.String cameraId, int width, int height, int framerate)
boolean
setSessionRepeatingRequest(android.hardware.camera2.CaptureRequest.Builder captureRequestBuilder)
Set the current capture session repeating request.void
stop()
Stops the capture.
-
-
-
Method Detail
-
create
public static void create(CameraSession.CreateSessionCallback callback, CameraSession.Events events, android.content.Context applicationContext, android.hardware.camera2.CameraManager cameraManager, SurfaceTextureHelper surfaceTextureHelper, java.lang.String cameraId, int width, int height, int framerate)
-
stop
public void stop()
Description copied from interface:CameraSession
Stops the capture. Waits until no more calls to capture observer will be made. If waitCameraStop is true, also waits for the camera to stop.- Specified by:
stop
in interfaceCameraSession
-
setSessionRepeatingRequest
public boolean setSessionRepeatingRequest(@Nullable android.hardware.camera2.CaptureRequest.Builder captureRequestBuilder)
Set the current capture session repeating request. This method enables use cases that require an update to the default CaptureRequest.Builder used to start the initial capture session. For example, a developer may need to turn the flash on.- Parameters:
captureRequestBuilder
- the capture request builder that will be applied to the current capture session.- Returns:
- true if the call to setRepeatingRequest succeeded with the provided capture request builder or false if the captureRequestBuilder is null or a CameraAccessException occurred.
-
configureCaptureRequestBuilder
@Nullable public android.hardware.camera2.CaptureRequest.Builder configureCaptureRequestBuilder()
Configures a CaptureRequest.Builder with optimal settings for capturing video frames. The viable options for video capture requests are: TEMPLATE_PREVIEW: High frame rate is given priority over the highest-quality post-processing. TEMPLATE_RECORD: Stable frame rate is used, and post-processing is set for recording quality.- Returns:
- CaptureRequest.Builder or null if a CameraAccessException occurrs.
-
-