# Recorder

Artifact: [androidx.camera:camera-video](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/video/Recorder.java+class:androidx.camera.video.Recorder) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

*** ** * ** ***


```
class Recorder : VideoOutput
```

<br />

*** ** * ** ***

An implementation of `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoOutput` for starting video recordings that are saved to a `https://developer.android.com/reference/java/io/File.html`, `https://developer.android.com/reference/android/os/ParcelFileDescriptor.html`, or `https://developer.android.com/reference/android/provider/MediaStore.html`.

A recorder can be used to save the video frames sent from the `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapture` use case in common recording formats such as MPEG4.

Usage example of setting up `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapture` with a recorder as output:

```kotlin
ProcessCameraProvider cameraProvider = ...;
CameraSelector cameraSelector = ...;
...
// Create our preview to show on screen
Preview preview = new Preview.Builder.build();
// Create the video capture use case with a Recorder as the output
VideoCapturevideoCapture = VideoCapture.withOutput(new Recorder.Builder().build());

// Bind use cases to Fragment/Activity lifecycle
cameraProvider.bindToLifecycle(this, cameraSelector, preview, videoCapture);
```

Once the recorder is attached to a video source as a `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoOutput`, e.g. using it to create a `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapture` by calling `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapture#withOutput(T)`, a new recording can be generated with one of the prepareRecording methods, such as `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#prepareRecording(android.content.Context,androidx.camera.video.MediaStoreOutputOptions)`. The `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording` class then can be used to adjust per-recording settings and to start the recording. It also requires passing a listener to `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording#start(java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.video.VideoRecordEvent>)` to listen for `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoRecordEvent`s such as `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoRecordEvent.Start`, `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoRecordEvent.Pause`, `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoRecordEvent.Resume`, and `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoRecordEvent.Finalize`. This listener will also receive regular recording status updates via the `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoRecordEvent.Status` event.

Attaching a single Recorder instance to multiple video sources at the same time may causes unexpected behaviors and is not recommended.

A recorder can also capture and save audio alongside video. The audio must be explicitly enabled with `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording#withAudioEnabled()` before starting the recording.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapture#withOutput(T)` |   |
| `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording` |   |

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder` Builder class for `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder` objects. |

| ### Constants |
|---|---|
| `const https://developer.android.com/reference/kotlin/androidx/camera/video/QualitySelector!` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#DEFAULT_QUALITY_SELECTOR()` Default quality selector for recordings. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#VIDEO_CAPABILITIES_SOURCE_CAMCORDER_PROFILE() = 0` Video capabilities are derived from `https://developer.android.com/reference/android/media/CamcorderProfile.html`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#VIDEO_CAPABILITIES_SOURCE_CODEC_CAPABILITIES() = 1` Video capabilities are derived from codec capabilities. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getAspectRatio()()` Gets the aspect ratio of this Recorder. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getAudioMimeType()()` Gets the audio MIME type of this Recorder. |
| `https://developer.android.com/reference/java/util/concurrent/Executor.html?` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getExecutor()()` Returns the executor provided to the builder for this recorder. |
| `java-static https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities?` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getHighSpeedVideoCapabilities(androidx.camera.core.CameraInfo)(cameraInfo: https://developer.android.com/reference/kotlin/androidx/camera/core/CameraInfo)` Returns the high-speed `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` of Recorder with respect to input camera information. |
| `https://developer.android.com/reference/kotlin/androidx/camera/video/QualitySelector` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getQualitySelector()()` Gets the quality selector of this Recorder. |
| `java-static (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | `@https://developer.android.com/reference/kotlin/androidx/camera/video/ExperimentalMimeTypeApi https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getSupportedAudioMimeTypes()()` Returns the audio MIME types supported by the device that are compatible with Recorder. |
| `java-static (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | `@https://developer.android.com/reference/kotlin/androidx/camera/video/ExperimentalMimeTypeApi https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getSupportedVideoMimeTypes()()` Returns the video MIME types supported by the device that are compatible with Recorder. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getTargetAudioChannelCount()()` Returns the target audio channel count of this Recorder. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getTargetAudioEncodingBitRate()()` Gets the target audio encoding bitrate of this Recorder. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getTargetVideoEncodingBitRate()()` Gets the target video encoding bitrate of this Recorder. |
| `java-static https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getVideoCapabilities(androidx.camera.core.CameraInfo)(cameraInfo: https://developer.android.com/reference/kotlin/androidx/camera/core/CameraInfo)` Returns the `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` of Recorder with respect to input camera information. |
| `java-static https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities?` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getVideoCapabilities(androidx.camera.core.CameraInfo,java.lang.String)(cameraInfo: https://developer.android.com/reference/kotlin/androidx/camera/core/CameraInfo, mimeType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Returns the `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` of Recorder with respect to input camera information and video MIME type. |
| `java-static https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getVideoCapabilities(androidx.camera.core.CameraInfo,int)( cameraInfo: https://developer.android.com/reference/kotlin/androidx/camera/core/CameraInfo, videoCapabilitiesSource: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Returns the `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` of Recorder with respect to input camera information and video capabilities source. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getVideoCapabilitiesSource()()` Gets the video capabilities source of this Recorder. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getVideoMimeType()()` Gets the video MIME type of this Recorder. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#onSurfaceRequested(androidx.camera.core.SurfaceRequest)(request: https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceRequest)` Called when a new `https://developer.android.com/reference/android/view/Surface.html` has been requested by a video frame producer. |
| `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 26) https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#prepareRecording(android.content.Context,androidx.camera.video.FileDescriptorOutputOptions)( context: https://developer.android.com/reference/android/content/Context.html, fileDescriptorOutputOptions: https://developer.android.com/reference/kotlin/androidx/camera/video/FileDescriptorOutputOptions )` Prepares a recording that will be saved to a `https://developer.android.com/reference/android/os/ParcelFileDescriptor.html`. |
| `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#prepareRecording(android.content.Context,androidx.camera.video.FileOutputOptions)(context: https://developer.android.com/reference/android/content/Context.html, fileOutputOptions: https://developer.android.com/reference/kotlin/androidx/camera/video/FileOutputOptions)` Prepares a recording that will be saved to a `https://developer.android.com/reference/java/io/File.html`. |
| `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording` | `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#prepareRecording(android.content.Context,androidx.camera.video.MediaStoreOutputOptions)( context: https://developer.android.com/reference/android/content/Context.html, mediaStoreOutputOptions: https://developer.android.com/reference/kotlin/androidx/camera/video/MediaStoreOutputOptions )` Prepares a recording that will be saved to a `https://developer.android.com/reference/android/provider/MediaStore.html`. |

## Constants

### DEFAULT_QUALITY_SELECTOR

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

```
const val DEFAULT_QUALITY_SELECTOR: QualitySelector!
```

Default quality selector for recordings.

The default quality selector chooses a video quality suitable for recordings based on device and compatibility constraints. It is equivalent to:

```kotlin
QualitySelector.fromOrderedList(Arrays.asList(Quality.FHD, Quality.HD, Quality.SD),
        FallbackStrategy.higherQualityOrLowerThan(Quality.FHD));
```

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/QualitySelector` |   |

### VIDEO_CAPABILITIES_SOURCE_CAMCORDER_PROFILE

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
const val VIDEO_CAPABILITIES_SOURCE_CAMCORDER_PROFILE = 0: Int
```

Video capabilities are derived from `https://developer.android.com/reference/android/media/CamcorderProfile.html`.

The `https://developer.android.com/reference/kotlin/androidx/camera/video/Quality` supported by the video capabilities of this source are determined by the device's `https://developer.android.com/reference/android/media/CamcorderProfile.html`. This means that the quality of recorded videos is guaranteed by the device manufacturer. This is the recommended type for recording high-quality video.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setVideoCapabilitiesSource(int)` |   |

### VIDEO_CAPABILITIES_SOURCE_CODEC_CAPABILITIES

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
const val VIDEO_CAPABILITIES_SOURCE_CODEC_CAPABILITIES = 1: Int
```

Video capabilities are derived from codec capabilities.

The `https://developer.android.com/reference/kotlin/androidx/camera/video/Quality` supported by the video capabilities of this source are determined by the codec capabilities. However, the recorded videos is not guaranteed. For example, there may be frame drops due to thermal throttling or memory pressure. Therefore, it is recommended to use `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#VIDEO_CAPABILITIES_SOURCE_CAMCORDER_PROFILE()` unless there is a specific reason. A common use case is when the application strives to record UHD video whenever feasible, but the device's `https://developer.android.com/reference/android/media/CamcorderProfile.html` does not include a UHD quality setting, even though the codec is capable of recording UHD video.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setVideoCapabilitiesSource(int)` |   |

## Public functions

### getAspectRatio

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/camera#1.3.0)

```
fun getAspectRatio(): Int
```

Gets the aspect ratio of this Recorder.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the value from `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setAspectRatio(int)` or `https://developer.android.com/reference/kotlin/androidx/camera/core/AspectRatio#RATIO_DEFAULT()` if not set. |

### getAudioMimeType

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
fun getAudioMimeType(): String
```

Gets the audio MIME type of this Recorder.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the audio MIME type provided to `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setAudioMimeType(java.lang.String)`. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setAudioMimeType(java.lang.String)` |   |

### getExecutor

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

```
fun getExecutor(): Executor?
```

Returns the executor provided to the builder for this recorder.

| Returns |
|---|---|
| `https://developer.android.com/reference/java/util/concurrent/Executor.html?` | the `https://developer.android.com/reference/java/util/concurrent/Executor.html` provided to `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setExecutor(java.util.concurrent.Executor)` on the builder used to create this recorder. If no executor was provided, returns {code null}. |

### getHighSpeedVideoCapabilities

Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/camera#1.5.0)

```
java-static fun getHighSpeedVideoCapabilities(cameraInfo: CameraInfo): VideoCapabilities?
```

Returns the high-speed `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` of Recorder with respect to input camera information.

The returned `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` provides methods to query supported dynamic ranges, qualities for high-speed video. For recording high-speed and slow-motion videos, refer to `https://developer.android.com/reference/kotlin/androidx/camera/video/HighSpeedVideoSessionConfig`.

| Parameters |
|---|---|
| `cameraInfo: https://developer.android.com/reference/kotlin/androidx/camera/core/CameraInfo` | info about the camera. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities?` | high-speed VideoCapabilities with respect to the input camera info, or null if high-speed video is not supported. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/HighSpeedVideoSessionConfig` |   |

### getQualitySelector

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

```
fun getQualitySelector(): QualitySelector
```

Gets the quality selector of this Recorder.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/QualitySelector` | the `https://developer.android.com/reference/kotlin/androidx/camera/video/QualitySelector` provided to `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setQualitySelector(androidx.camera.video.QualitySelector)` on the builder used to create this recorder, or the default value of `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#DEFAULT_QUALITY_SELECTOR()` if no quality selector was provided. |

### getSupportedAudioMimeTypes

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
@ExperimentalMimeTypeApi
java-static fun getSupportedAudioMimeTypes(): (Mutable)List<String!>
```

Returns the audio MIME types supported by the device that are compatible with Recorder.

The returned list contains only those MIME types that are supported by the device's encoders and are compatible with Recorder. This list is a subset of the formats accepted by `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setAudioMimeType(java.lang.String)`.

This method should be used to discover available formats at runtime. Once a MIME type is selected from this list, it can be passed to `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setAudioMimeType(java.lang.String)` to configure the recorder.

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | A list of strings representing the supported audio MIME types. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setAudioMimeType(java.lang.String)` |   |

### getSupportedVideoMimeTypes

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
@ExperimentalMimeTypeApi
java-static fun getSupportedVideoMimeTypes(): (Mutable)List<String!>
```

Returns the video MIME types supported by the device that are compatible with Recorder.

The returned list contains only those MIME types that are supported by the device's encoders and are compatible with Recorder. This list is a subset of the formats accepted by `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setVideoMimeType(java.lang.String)`.

This method should be used to discover available formats at runtime. Once a MIME type is selected from this list, it can be passed to `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setVideoMimeType(java.lang.String)` to configure the recorder. To query specific camera-dependent capabilities for a chosen MIME type, such as supported qualities or dynamic ranges, use `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getVideoCapabilities(androidx.camera.core.CameraInfo,java.lang.String)`.

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | A list of strings representing the supported video MIME types. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setVideoMimeType(java.lang.String)` |   |
| `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getVideoCapabilities(androidx.camera.core.CameraInfo,java.lang.String)` |   |

### getTargetAudioChannelCount

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
fun getTargetAudioChannelCount(): @IntRange(from = 0) Int
```

Returns the target audio channel count of this Recorder.

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the value provided to `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setTargetAudioChannelCount(int)` on the builder used to create this recorder. Returns 0 if `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setTargetAudioChannelCount(int)` is not called. |

### getTargetAudioEncodingBitRate

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
fun getTargetAudioEncodingBitRate(): @IntRange(from = 0) Int
```

Gets the target audio encoding bitrate of this Recorder.

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the value provided to `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setTargetAudioEncodingBitRate(int)` on the builder used to create this recorder. Returns 0, if `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setTargetAudioEncodingBitRate(int)` is not called. |

### getTargetVideoEncodingBitRate

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/camera#1.3.0)

```
fun getTargetVideoEncodingBitRate(): @IntRange(from = 0) Int
```

Gets the target video encoding bitrate of this Recorder.

| Returns |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the value provided to `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setTargetVideoEncodingBitRate(int)` on the builder used to create this recorder. Returns 0, if `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setTargetVideoEncodingBitRate(int)` is not called. |

### getVideoCapabilities

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/camera#1.3.0)

```
java-static fun getVideoCapabilities(cameraInfo: CameraInfo): VideoCapabilities
```

Returns the `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` of Recorder with respect to input camera information.

`https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` provides methods to query supported dynamic ranges and qualities. This information can be used for things like checking if HDR is supported for configuring VideoCapture to record HDR video.

The source of the returned `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` is `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#VIDEO_CAPABILITIES_SOURCE_CAMCORDER_PROFILE()`. To get a `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` from a different source, use `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getVideoCapabilities(androidx.camera.core.CameraInfo,int)`.

| Parameters |
|---|---|
| `cameraInfo: https://developer.android.com/reference/kotlin/androidx/camera/core/CameraInfo` | info about the camera. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` | VideoCapabilities with respect to the input camera info. |

### getVideoCapabilities

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
java-static fun getVideoCapabilities(cameraInfo: CameraInfo, mimeType: String): VideoCapabilities?
```

Returns the `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` of Recorder with respect to input camera information and video MIME type.

`https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` provides methods to query supported dynamic ranges and qualities. This information can be used for things like checking if HDR is supported for configuring VideoCapture to record HDR video.

This method provides an aggregated view of the combined capabilities of the selected camera and the device's video encoder for the specified format. It allows discovery of supported qualities, dynamic ranges, and other constraints associated with a specific encoding format without the need to manually cross-reference camera and encoder capabilities.

| Parameters |
|---|---|
| `cameraInfo: https://developer.android.com/reference/kotlin/androidx/camera/core/CameraInfo` | info about the camera. |
| `mimeType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the video MIME type to query capabilities for (e.g., "video/hevc"). |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities?` | VideoCapabilities with respect to the input camera info and video MIME type, or `null` if no capabilities are found for the given MIME type. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#getSupportedVideoMimeTypes()` |   |
| `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setVideoMimeType(java.lang.String)` |   |

### getVideoCapabilities

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
java-static fun getVideoCapabilities(
    cameraInfo: CameraInfo,
    videoCapabilitiesSource: Int
): VideoCapabilities
```

Returns the `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` of Recorder with respect to input camera information and video capabilities source.

`https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` provides methods to query supported dynamic ranges and qualities. This information can be used for things like checking if HDR is supported for configuring VideoCapture to record HDR video.

The possible video capabilities sources include `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#VIDEO_CAPABILITIES_SOURCE_CAMCORDER_PROFILE()` and `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#VIDEO_CAPABILITIES_SOURCE_CODEC_CAPABILITIES()`.

| Parameters |
|---|---|
| `cameraInfo: https://developer.android.com/reference/kotlin/androidx/camera/core/CameraInfo` | info about the camera. |
| `videoCapabilitiesSource: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the video capabilities source. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/VideoCapabilities` | VideoCapabilities with respect to the input camera info and video capabilities source. |

### getVideoCapabilitiesSource

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

```
fun getVideoCapabilitiesSource(): Int
```

Gets the video capabilities source of this Recorder.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the value provided to `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setVideoCapabilitiesSource(int)` on the builder used to create this recorder, or the default value `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder#VIDEO_CAPABILITIES_SOURCE_CAMCORDER_PROFILE()` if not set. |

### getVideoMimeType

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
fun getVideoMimeType(): String
```

Gets the video MIME type of this Recorder.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | the video MIME type provided to `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setVideoMimeType(java.lang.String)`. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder.Builder#setVideoMimeType(java.lang.String)` |   |

### onSurfaceRequested

```
fun onSurfaceRequested(request: SurfaceRequest): Unit
```

Called when a new `https://developer.android.com/reference/android/view/Surface.html` has been requested by a video frame producer.

Users of this class should not call this method directly. It will be called by the video frame producer. Implementors of this class should be aware that this method is called when a video frame producer is ready to receive a surface that it can use to send video frames to the video output. The video frame producer may repeatedly request a surface more than once, but only the latest `https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceRequest` should be considered active. All previous surface requests will complete by sending a `https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceRequest.Result` to the consumer passed to `https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceRequest#provideSurface(android.view.Surface,java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.core.SurfaceRequest.Result>)`.

A request is considered active until it is `https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceRequest#provideSurface(android.view.Surface,java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.core.SurfaceRequest.Result>)`, `https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceRequest#willNotProvideSurface()`, or `https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceRequest#addRequestCancellationListener(java.util.concurrent.Executor,java.lang.Runnable)`. After one of these conditions occurs, a request is considered completed.

Once a request is successfully completed, it is guaranteed that if a new request is made, the `https://developer.android.com/reference/android/view/Surface.html` used to fulfill the previous request will be detached from the video frame producer and the `resultListener` provided in `https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceRequest#provideSurface(android.view.Surface,java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.core.SurfaceRequest.Result>)` will be invoked with a `https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceRequest.Result` containing `https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceRequest.Result#RESULT_SURFACE_USED_SUCCESSFULLY()`.

| Parameters |
|---|---|
| `request: https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceRequest` | the request for a surface which contains the requirements of the surface and methods for completing the request. |

### prepareRecording

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

```
@RequiresApi(value = 26)
fun prepareRecording(
    context: Context,
    fileDescriptorOutputOptions: FileDescriptorOutputOptions
): PendingRecording
```

Prepares a recording that will be saved to a `https://developer.android.com/reference/android/os/ParcelFileDescriptor.html`.

The provided `https://developer.android.com/reference/kotlin/androidx/camera/video/FileDescriptorOutputOptions` specifies the `https://developer.android.com/reference/android/os/ParcelFileDescriptor.html` to use.

Currently, file descriptors as output destinations are not supported on pre-Android O (API 26) devices.

Calling this method multiple times will generate multiple `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording`s, each of the recordings can be used to adjust per-recording settings individually. The recording will not begin until `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording#start(java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.video.VideoRecordEvent>)` is called. Only a single pending recording can be started per `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder` instance.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | the context used to enforce runtime permissions, interface with the media scanner service, and attribute access to permission protected data, such as audio. If using this context to [audit audio access](https://developer.android.com/guide /topics/data/audit-access#audit-by-attribution-tagaudit) on API level 31+, a context created with `https://developer.android.com/reference/android/content/Context.html#createAttributionContext(java.lang.String)` should be used. |
| `fileDescriptorOutputOptions: https://developer.android.com/reference/kotlin/androidx/camera/video/FileDescriptorOutputOptions` | the options that configures how the output will be handled. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording` | a `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording` that is associated with this Recorder. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html` | if this method is called on per-Android O (API 26) devices. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/FileDescriptorOutputOptions` |   |

### prepareRecording

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

```
fun prepareRecording(context: Context, fileOutputOptions: FileOutputOptions): PendingRecording
```

Prepares a recording that will be saved to a `https://developer.android.com/reference/java/io/File.html`.

The provided `https://developer.android.com/reference/kotlin/androidx/camera/video/FileOutputOptions` specifies the file to use.

Calling this method multiple times will generate multiple `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording`s, each of the recordings can be used to adjust per-recording settings individually. The recording will not begin until `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording#start(java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.video.VideoRecordEvent>)` is called. Only a single pending recording can be started per `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder` instance.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | the context used to enforce runtime permissions, interface with the media scanner service, and attribute access to permission protected data, such as audio. If using this context to [audit audio access](https://developer.android.com/guide /topics/data/audit-access#audit-by-attribution-tagaudit) on API level 31+, a context created with `https://developer.android.com/reference/android/content/Context.html#createAttributionContext(java.lang.String)` should be used. |
| `fileOutputOptions: https://developer.android.com/reference/kotlin/androidx/camera/video/FileOutputOptions` | the options that configures how the output will be handled. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording` | a `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording` that is associated with this Recorder. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/FileOutputOptions` |   |

### prepareRecording

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

```
fun prepareRecording(
    context: Context,
    mediaStoreOutputOptions: MediaStoreOutputOptions
): PendingRecording
```

Prepares a recording that will be saved to a `https://developer.android.com/reference/android/provider/MediaStore.html`.

The provided `https://developer.android.com/reference/kotlin/androidx/camera/video/MediaStoreOutputOptions` specifies the options which will be used to save the recording to a `https://developer.android.com/reference/android/provider/MediaStore.html`.

Calling this method multiple times will generate multiple `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording`s, each of the recordings can be used to adjust per-recording settings individually. The recording will not begin until `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording#start(java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.video.VideoRecordEvent>)` is called. Only a single pending recording can be started per `https://developer.android.com/reference/kotlin/androidx/camera/video/Recorder` instance.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | the context used to enforce runtime permissions, interface with the media scanner service, and attribute access to permission protected data, such as audio. If using this context to [audit audio access](https://developer.android.com/guide /topics/data/audit-access#audit-by-attribution-tagaudit) on API level 31+, a context created with `https://developer.android.com/reference/android/content/Context.html#createAttributionContext(java.lang.String)` should be used. |
| `mediaStoreOutputOptions: https://developer.android.com/reference/kotlin/androidx/camera/video/MediaStoreOutputOptions` | the options that configures how the output will be handled. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording` | a `https://developer.android.com/reference/kotlin/androidx/camera/video/PendingRecording` that is associated with this Recorder. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/video/MediaStoreOutputOptions` |   |