Viewing live streams means interacting with the
This interface provides functions to:
- choose the
Streamthat should be played
- play, pause and stop the stream
- control playback (e.g.
- listen to relevant events for building responsive UIs
The stream viewer will forward all relevant events to subscribers that were registered with the
addListener* functions. We recommend listening at least to the error and stream events:
We provide different implementations that can be used within your app depending on your needs, but all of them share the same API surface described below.
Note: if you use the default controls, the user will be able to control the viewer through the user interface, so there's no need to interact directly with these functions.
Playback is controlled through simple
Similarly to the player module, the stream viewer accepts input data through the
which lets you choose whether the content should be played right away or just preloaded.
To clear the current stream, call
At any moment, the current stream can be retrieved using
StreamViewer.stream. Changes in this
property will also trigger the
We also offer a few extra options that can be used to configure the player:
mute: whether the audio is muted or not.