opentok-network-test-js
opentok-network-test-js copied to clipboard
Report on user denying access to camera.
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.
Any updates on that?
@slpn1 how did you handle this?
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
}
}