Rendering Playback

Access the Player to show the Playback

To render the Playback or access the player to show the Playback, The following method can be used:

viewModelScope.launch {
  client.player.collectLatest { player ->
    // The player is an instance of TextureViewRenderer which can be inflated to any view that can be used
    // to render the playback.
  }
}
// In Jetpack compose you can do client.player.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
  }
}