# MediaRecorder.VideoSource

Added in[API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# VideoSource

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/media/MediaRecorder.VideoSource "View this page in Java")  

```
class VideoSource
```

|---|------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                     ||
| ↳ | [android.media.MediaRecorder.VideoSource](https://developer.android.com/reference/kotlin/android/media/MediaRecorder.VideoSource#) |

Defines the video source. These constants are used with[MediaRecorder.setVideoSource(int)](https://developer.android.com/reference/kotlin/android/media/MediaRecorder#setVideoSource(kotlin.Int)).

## Summary

|                                                                                                          Constants                                                                                                          ||
|----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [CAMERA](https://developer.android.com/reference/kotlin/android/media/MediaRecorder.VideoSource#CAMERA:kotlin.Int) Camera video source    |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [DEFAULT](https://developer.android.com/reference/kotlin/android/media/MediaRecorder.VideoSource#DEFAULT:kotlin.Int) <br />               |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [SURFACE](https://developer.android.com/reference/kotlin/android/media/MediaRecorder.VideoSource#SURFACE:kotlin.Int) Surface video source |

## Constants

### CAMERA

Added in[API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val CAMERA: Int
```

Camera video source

Using the[android.hardware.Camera](https://developer.android.com/reference/kotlin/android/hardware/Camera.html#)API as video source.  

    Value: 1

### DEFAULT

Added in[API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val DEFAULT: Int
```  

    Value: 0

### SURFACE

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val SURFACE: Int
```

Surface video source

Using a Surface as video source.

This flag must be used when recording from an[android.hardware.camera2](https://developer.android.com/reference/kotlin/android/hardware/camera2/package-summary.html)API source.

When using this video source type, use[MediaRecorder.getSurface()](https://developer.android.com/reference/kotlin/android/media/MediaRecorder#getSurface())to retrieve the surface created by MediaRecorder.  

    Value: 2