opentok-network-test-js icon indicating copy to clipboard operation
opentok-network-test-js copied to clipboard

Report on user denying access to camera.

Open slpn1 opened this issue 6 years ago • 2 comments

When the user denies access to the camera/mic, the reported error is: 'Failed to create a local publisher object'. This error object does not have a 'type' that corresponds to a publishing problem (OpenTok.js). As it is a common scenario that the user denies the camera (at least for our clients!), it would be good to have a more specific description and a new type so we can detect when the user has denied access and instruct them appropriately. Thanks.

slpn1 avatar Aug 12 '18 11:08 slpn1

Any updates on that?

@slpn1 how did you handle this?

thodwris avatar Jan 15 '20 23:01 thodwris

Can confirm this is still an issue.

@thodwris , our solutions for now is to ensure that we have permission first before running the test.

const otNetworkTest = new NetworkTest(window.OT, { apiKey, sessionId: sessionID, token });

      try {
       // Checking Permissions
        await window.OT.getUserMedia();

       // Put your test code in here e.g.
       // You know you have permission at this point
       // try { await otNetworkTest.testConnectivity(); } catch (err) {}

      } catch(permissionError) {
         // If Permissions were denied, 
         if (error.name === 'OT_USER_MEDIA_ACCESS_DENIED') { 
             // User has denied permissions
         }
      }

Patrick-Ullrich avatar Apr 19 '20 18:04 Patrick-Ullrich