The Kotlin camera2 API audio capture Android development tutorial describes how to capture audio using the MediaRecorder.
This Kotlin tutorial follows on from the switching cameras tutorial.
In this Kotlin on Android tutorial we will cover:
- Adding RECORD_AUDIO permission
- Checking for RECORD_AUDIO runtime permissions
- Where to check for RECORD_AUDIO permissons
- Implementing audio support in the MediaRecorder
- Rear Camera Record
- Round preview thumbnail
- Sharing Uri with ViewModel
- Video Playback with ExoPlayer
- Video PIP
- Front Camera Record (Premium)
- Video Record with Audio (Premium)
- Replace TextureView with SurfaceView (Premium)
Disclaimer, it is recommended to follow this Kotlin on Android tutorial series using a Google Pixel or Nexus device.
Please do not try it with the Android Emulator. Bugs have also been observed in camera stacks of none Google devices, which may be exposed by this tutorial series.
The Kotlin camera2 front video SurfaceView with audio Android development tutorial focused on how to add audio support to the MediaRecorder.
To access the microphone, RECORD_AUDIO permission is required. RECORD_AUDIO is a dangerous permission, which must be granted access from the user in the form of a runtime permission dialog.
The following Kotlin tutorial will describe how to use the SurfaceView to display the preview display.