How to properly detect and fix remote video problems?

Description
It seems to me that situations where something goes wrong during a video call are inevitable. These could be issues with the user’s internet connection, problems with device permissions, the video feed being captured by another application, etc.

Then the stream inside the <video> tag is either black or transparent.

However, I would like to be able to respond to such problems and fix them. Some time ago I came up with the idea to check statistics from getVideoStatisticData (VideoQosData), but this isn’t a completely reliable method because it’s difficult to determine what parameters should have “healthy” values.

Then I thought that I could check the VideoPlayer object created by attachVideo, which contains a <video> tag inside, like this:

    const stream = videoElement.srcObject as MediaStream;
    const videoTracks = stream.getVideoTracks();

    // Check if we have active video tracks
    const hasActiveTracks = videoTracks.some(track => track.enabled && track.readyState === 'live' && !track.muted);

    // Check if video element has valid state and dimensions
    const hasValidState = videoElement.readyState >= 2 && videoElement.videoWidth > 0 && videoElement.videoHeight > 0;

But this probably isn’t a good idea either and doesn’t guarantee getting accurate information about the “health status” of the video tile.

So my question is: How to properly detect problems with video tiles and how to fix them?

Which Web Video SDK version?
2.2.12.

WebRTC enabled (no SharedArrayBuffer).