Regardless of the
StreamHost implementation that you are using, the user must
be presented with UI controls to control the streamer behavior. Similar to
what happens in all other modules, we offer a default UI implementation
If you are using
StreamHostControls 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
StreamHostControls instance anywhere
in the hierarchy, the recorder will find it and set it up.
By default, the
overlay() layout contains a single
StreamHostControls 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
StreamHost implementations, the controls can be added to your view hierarchy as an
overlay to the host. For example, in case of
StreamHostView, you can simply using a frame layout:
At runtime, the controls should be bound to the host using
this is done, the controls class will start listening to the recorder events and update
the interface accordingly.
StreamHostControls class offers many APIs to control the controls appearance,
both through XML attributes and programmatically.
|If true, a shutter is shown whenever the host 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 when not in the BUSY state.|
|If true, shows a loading spinner in the BACKPRESSURE state.|
|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.|
|If true, shows an indicator of the live status, shown in STREAMING and BACKPRESSURE states.|
|Controls the drawable for the live status indicator.|
|If true, shows the 'confirm' button, which will confirm the stream by calling |
|If true, shows the 'stream' button, which will start or pause streaming.|
|Controls the drawable of the 'stream' button which, when pressed, will start recording.|
|Controls the drawable of the 'stream' button which, when pressed, will pause recording.|
You can also have full control over the UI by passing your own layout resource to