Skip to main content
Version: Android 1.2.0

UI Controls

Regardless of the Recorder implementation that you are using, the user must be presented with UI controls to control the recorder behavior. Similar to what happens in the player module, we offer a default UI implementation called

With fragments#

If you are using RecorderFragment, a RecorderControls view will be automatically added to the hierarchy and it is managed by the fragment itself, so there's nothing you should do.

When creating the fragment, you also have the option to pass a more generic layout resource that contains your overlays. If the view contains a RecorderControls instance anywhere in the hierarchy, the recorder will find it and set it up.

val options = {
overlay(R.layout.recorder_overlay) // customize overlays
overlay(null) // disable default controls

By default, the overlay() layout contains a single RecorderControls view. Your overlays can contain a richer hierarchy or you can leverage a layout file to customize controls with the XML attributes listed below. You can also pass null to disable the default controls.

With other Recorder implementations#

When using other Recorder implementations, the controls can be added to your view hierarchy as an overlay to the recorder. For example, in case of RecorderView, you can simply using a frame layout:

<!-- Part of your UI... -->
<!-- Add RecorderView here: -->
<!-- Then add controls: -->

At runtime, the controls should be bound to the recorder using RecorderControls.setRecorder(). Once this is done, the controls class will start listening to the recorder events and update the interface accordingly.

val recorderView: RecorderView = findViewById(
val recorderControls: RecorderControls = findViewById(

Customizing controls#

The RecorderControls class offers many APIs to control the controls appearance, both through XML attributes and programmatically.

APIXML AttributeDescriptionDefault
showPreviewScreenapp:recorderControlsShowPreviewScreenIf true, the video will be previewed before confirmation, by calling recorder.enterPreview() before recorder.completeRecord().true
showShutterapp:recorderControlsShowShutterIf true, a shutter is shown whenever the recorder is in the BUSY state.true
shutterDrawableapp:recorderControlsShutterDrawableControls the drawable drawn in the center of the fullscreen shutter.A video icon
shutterBackgroundDrawableapp:recorderControlsShutterBackgroundDrawableControls the fullscreen shutter background.A black background
showAbortapp:recorderControlsShowAbortIf true, shows a close icon in the IDLE and PREVIEW state.true
showClipsBarapp:recorderControlsShowClipsBarIf true, shows the clips bar, an horizontal bar marking the video recording progress and the video clips.true
clipsBarDrawableapp:recorderControlsClipsBarDrawableControls the drawable that displays the clips bar.ClipsBarDrawable()
showConfirmapp:recorderControlsShowConfirmIf true, shows the 'confirm' button, which will confirm the recording (or preview it, if showPreviewScreen is true).true
showConfirmPreviewapp:recorderControlsShowConfirmPreviewIf true, shows the 'confirm preview', a button shown in the PREVIEW state to confirm it.-
showRemoveClipapp:recorderControlsShowRemoveClipIf true, shows the 'remove clip' button, a delete button that will remove the last recorded clip.true
showRecordapp:recorderControlsShowRecordIf true, shows the 'record' button, which will start or pause recording.true
recordStartDrawableapp:recorderControlsRecordStartDrawableControls the drawable of the 'record' button which, when pressed, will start recording.RecordDrawable()
recordPauseDrawableapp:recorderControlsRecordPauseDrawableControls the drawable of the 'record' button which, when pressed, will pause recording.recordStartDrawable
showFacingapp:recorderControlsShowFacingIf true, shows the 'facing' button, which will toggle the active camera sensor (front or back).true
facingBackDrawableapp:recorderControlsFacingBackDrawableControls the drawable of the 'facing' button when the back camera is being used.-
facingFrontDrawableapp:recorderControlsFacingFrontDrawableControls the drawable of the 'facing' button when the front camera is being used.-
showFlashapp:recorderControlsShowFlashIf true, shows the 'flash' button, which will toggle the flash setting (on or off).true
flashOnDrawableapp:recorderControlsFlashOnDrawableControls the drawable of the 'flash' button when the flash is on.-
flashOffDrawableapp:recorderControlsFlashOffDrawableControls the drawable of the 'flash' button when the flash is off.-

You can also have full control over the UI by passing your own layout resource to app:recorderControlsLayout.

Touch controls#

The controls view is able to react to simple touch events and perform recorder actions accordingly. You can configure the touch behavior with the moveRecordOnTouch and recordMovementAction APIs, both in XML and programmatically.

val controls: RecorderControls = findViewById(
controls.moveRecordOnTouch = true // now the record button will follow the finger on long press
controls.recordMovementAction = RecordMovementAction.ZOOM // translating the button controls camera zoom
controls.recordMovementAction = RecordMovementAction.NONE // translating the button does nothing
Last updated on