Regardless of the
StreamViewer 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
StreamViewerControls 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
StreamViewerControls instance anywhere
in the hierarchy, the recorder will find it and set it up.
By default, the
overlay() layout contains a single
StreamViewerControls 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
StreamViewer implementations, the controls can be added to your view hierarchy as an
overlay to the viewer. For example, in case of
StreamViewerView, you can simply using a frame layout:
At runtime, the controls should be bound to the viewer using
this is done, the controls class will start listening to the recorder events and update
the interface accordingly.
StreamViewerControls class offers many APIs to control the controls appearance,
both through XML attributes and programmatically.
|If true, a toast is shown whenever we detect a playback error.|
|If true, a loading spinner is shown when the stream is being loaded or buffered.|
|If true, shows an indicator of the live status, shown in WATCHING and BUFFERING states.|
|Controls the drawable for the live status indicator.|
|If true, shows a close icon to abort the stream viewer.|
|If true, the mute / unmute button will be shown.|
|Controls the drawable for the mute control. Set to @empty to avoid showing a drawable at all.|
|Controls the drawable for the unmute control. Set to @empty to avoid showing a drawable at all.|
|If true, the play / pause button will be shown.|
|Controls the drawable for the play state. Set to @empty to avoid showing a drawable at all.|
|Controls the drawable for the pause state. Set to @empty to avoid showing a drawable at all.|
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 actions accordingly.
You can configure the touch behavior with the
singleTapAction API, both in XML and programmatically.