Udostępnij za pośrednictwem


CameraCaptureSession.CaptureCallback.OnCaptureStarted Method

Definition

This method is called when the camera device has started capturing the output image for the request, at the beginning of image exposure, or when the camera device has started processing an input image for a reprocess request.

[Android.Runtime.Register("onCaptureStarted", "(Landroid/hardware/camera2/CameraCaptureSession;Landroid/hardware/camera2/CaptureRequest;JJ)V", "GetOnCaptureStarted_Landroid_hardware_camera2_CameraCaptureSession_Landroid_hardware_camera2_CaptureRequest_JJHandler")]
public virtual void OnCaptureStarted (Android.Hardware.Camera2.CameraCaptureSession session, Android.Hardware.Camera2.CaptureRequest request, long timestamp, long frameNumber);
[<Android.Runtime.Register("onCaptureStarted", "(Landroid/hardware/camera2/CameraCaptureSession;Landroid/hardware/camera2/CaptureRequest;JJ)V", "GetOnCaptureStarted_Landroid_hardware_camera2_CameraCaptureSession_Landroid_hardware_camera2_CaptureRequest_JJHandler")>]
abstract member OnCaptureStarted : Android.Hardware.Camera2.CameraCaptureSession * Android.Hardware.Camera2.CaptureRequest * int64 * int64 -> unit
override this.OnCaptureStarted : Android.Hardware.Camera2.CameraCaptureSession * Android.Hardware.Camera2.CaptureRequest * int64 * int64 -> unit

Parameters

session
CameraCaptureSession

the session returned by CameraDevice#createCaptureSession

request
CaptureRequest

the request for the capture that just begun

timestamp
Int64

the timestamp at start of capture for a regular request, or the timestamp at the input image's start of capture for a reprocess request, in nanoseconds.

frameNumber
Int64

the frame number for this capture

Attributes

Remarks

This method is called when the camera device has started capturing the output image for the request, at the beginning of image exposure, or when the camera device has started processing an input image for a reprocess request.

For a regular capture request, this callback is invoked right as the capture of a frame begins, so it is the most appropriate time for playing a shutter sound, or triggering UI indicators of capture.

The request that is being used for this capture is provided, along with the actual timestamp for the start of exposure. For a reprocess request, this timestamp will be the input image's start of exposure which matches CaptureResult#SENSOR_TIMESTAMP the result timestamp field of the TotalCaptureResult that was used to CameraDevice#createReprocessCaptureRequest create the reprocess request. This timestamp matches the timestamps that will be included in CaptureResult#SENSOR_TIMESTAMP the result timestamp field, and in the buffers sent to each output Surface. These buffer timestamps are accessible through, for example, android.media.Image#getTimestamp() Image.getTimestamp() or android.graphics.SurfaceTexture#getTimestamp(). The frame number included is equal to the frame number that will be included in CaptureResult#getFrameNumber.

For the simplest way to play a shutter sound camera shutter or a video recording start/stop sound, see the android.media.MediaActionSound class.

The default implementation of this method does nothing.

Java documentation for android.hardware.camera2.CameraCaptureSession.CaptureCallback.onCaptureStarted(android.hardware.camera2.CameraCaptureSession, android.hardware.camera2.CaptureRequest, long, long).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to