Rendering Playback
Access the Player to show the Playback
To render the Playback or access the player(s) to show the Playback, The following method can be used:
viewModelScope.launch {
client.players.collectLatest { players ->
// players is a List<TextureViewRenderer?> - one renderer per camera sensor. Most cameras
// expose a single sensor, so this list will usually have one element. Each renderer can be
// inflated into any view used to render the playback.
}
}
// In Jetpack compose you can do client.players.collectStateWithLifecycle()
Checking if the SD Playback Stream loaded
One you have created the SDCardPlaybackClient and started the playback.
To get the status if the camera has started streaming, The following can be used:
viewModelScope.launch {
client.hasLoadedStream.collectLatest { hasLoaded ->
// hasLoaded will report true as soon as the first video frame is received.
}
}
Observing the status of SD Card Playback
To observer the status of the Playback, The following observer can be used:
viewModelScope.launch {
client.status.collectLatest { status ->
// status is updated when ever something happens to the connection the possible values
// are CONNECTING, STARTED or FAILED
}
}