How to capture Camera disconnect in using Webcamtexture for Webgl

Hi,
I wrote a script where I attempted to handle the edge cases with Unity Webcamtexture. So in case of a sudden camera disconnect an error message should pop up showing ‘Camera not available’. While this works perfectly in Unity Editor it fails to work on the actual build. Here’s the snippet.

    IEnumerator CameraErrCheck()
    {
        while (WebCamTexture.devices.Length > 0)
        {

            //Debug.Log(WebCamTexture.devices.Length + "length");
            yield return new WaitForSeconds(0.3f);
        }
        
            errdialog.throwError("Oops! Camera might have been disconnected!");

        }
     void WebCamInit()
    {
      
        webcamtexture = new WebCamTexture();
     
        webcamtexture.Play();

        StartCoroutine(CameraErrCheck());

    }
    }

Webcaminit goes on to making a webcamtexture object and playing it. This works in Unity Editor but fails in the webversion. Logging Webcamtexture.devices.length I realized that even after camera disconnects, it still gives the length as 1.

Can someone help me out here?

It was a Unity bug that I reported and it’s sent for resolution. Till then I’m using the browser APIs to get media devices and checking if videoinput is available. Hope that helps someone out there.