Viewing Concepts
Viewing live streams means interacting with the io.video.videokit.live.viewer.StreamViewer
interface.
This interface provides functions to:
- choose the
Stream
that should be played - play, pause and stop the stream
- control playback (e.g.
StreamViewer.mute
,StreamViewer.aspectMode
) - 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.
#
StreamViewer interfaceNote: 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 controlPlayback is controlled through simple play
and pause
functions.
#
Stream controlSimilarly to the player module, the stream viewer accepts input data through the set()
function,
which lets you choose whether the content should be played right away or just preloaded.
To clear the current stream, call reset()
.
At any moment, the current stream can be retrieved using StreamViewer.stream
. Changes in this
property will also trigger the onStreamChanged()
callback.
#
Other optionsWe also offer a few extra options that can be used to configure the player:
aspectMode
: eitherAspectMode.FILL
,AspectMode.CENTER_CROP
orAspectMode.CENTER_INSIDE
.mute
: whether the audio is muted or not.