Hosting live streams means interacting with the
This interface provides functions to:
- start, pause and stop the streaming
- control the camera through
- listen to relevant events for building responsive UIs
The stream host 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. All of them will also automatically request the appropriate permissions (camera and microphone).
Note: if you use the default controls, the user will be able to control the stream host through the user interface, so there's no need to interact directly with these functions.
To start streaming, temporarily pause or toggle between the two, you can use start / pause / toggle:
To stop streaming, marking the underlying
Stream as finished, use
confirm(). This will
StreamHostListener.onResult() which you can use to complete the user flow.
After confirming, the underlying
Stream will be refreshed in case you plan to use the
host again in a new stream.
At any moment, you can retrieve the current stream with the
We recommend, however, using the listener callback
because the stream is created asynchronously, at start up and after every confirmation.
To control the camera, please check out the documentation about the Camera object,
which you can retrieve through
StreamHost.camera, just like you do in the recorder SDK.
On top of this, the stream host offers three different streaming modes, which should be self explanatory.