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
If you are using
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.
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.
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:
At runtime, the controls should be bound to the recorder using
this is done, the controls class will start listening to the recorder events and update
the interface accordingly.
RecorderControls class offers many APIs to control the controls appearance,
both through XML attributes and programmatically.
|If true, the video will be previewed before confirmation, by calling |
|If true, a shutter is shown whenever the recorder is in the BUSY state.|
|Controls the drawable drawn in the center of the fullscreen shutter.||A video icon|
|Controls the fullscreen shutter background.||A black background|
|If true, shows a close icon in the IDLE and PREVIEW state.|
|If true, shows the clips bar, an horizontal bar marking the video recording progress and the video clips.|
|Controls the drawable that displays the clips bar.|
|If true, shows the 'confirm' button, which will confirm the recording (or preview it, if |
|If true, shows the 'confirm preview', a button shown in the PREVIEW state to confirm it.|
|If true, shows the 'remove clip' button, a delete button that will remove the last recorded clip.|
|If true, shows the 'record' button, which will start or pause recording.|
|Controls the drawable of the 'record' button which, when pressed, will start recording.|
|Controls the drawable of the 'record' button which, when pressed, will pause recording.|
|If true, shows the 'facing' button, which will toggle the active camera sensor (front or back).|
|Controls the drawable of the 'facing' button when the back camera is being used.|
|Controls the drawable of the 'facing' button when the front camera is being used.|
|If true, shows the 'flash' button, which will toggle the flash setting (on or off).|
|Controls the drawable of the 'flash' button when the flash is on.|
|Controls 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
The controls view is able to react to simple touch events and perform recorder actions accordingly.
You can configure the touch behavior with the
recordMovementAction APIs, both in
XML and programmatically.