Sometimes black frame is rendered instead of participant video
Hello, I've noticed that sometimes remote participant does not appear and black frame is rendered instead. And this issue is not persistent, I can reproduce it like 1 out of 10 times.
So the question is, what can I do as a developer when this issue happens? How can I detect that remote video is not rendering in livekit sdk, and somehow try to restart it or reconnect?
I'm subscribed to Room events, but there is no additional event delivered when this issue happens. I get the same RoomEvent.TrackSubscribed as usual, but when I try to display the track as a view, it just appears as a black rectangle.
Also, this issue sometimes happens with local participant as well, but in this case I'm at least able to fix it by enabling and disabling camera. I had to write code like this:
room.connect(credentials.host, credentials.token)
localParticipant.setMicrophoneEnabled(true)
localParticipant.setCameraEnabled(true)
launch {
fixLocalParticipant(localParticipant)
}
private suspend fun fixLocalParticipant(localParticipant: LocalParticipant) {
delay(1000)
localParticipant.setMicrophoneEnabled(false)
localParticipant.setCameraEnabled(false)
delay(1000)
localParticipant.setMicrophoneEnabled(true)
localParticipant.setCameraEnabled(true)
}
Any help would be much appreciated. Thanks.