Problem with OpenTok accessDenied in Chrome

I'm having problems with the OpenTok 2 API . When I start to publish the stream, and I will be asked to allow or deny the website to use my webcam and microphone, if I permit (), it should be done, but if I deny that denied () should work.

publisher.addEventListener('accessAllowed', allowed);
publisher.addEventListener('accessDenied', denied);

function allowed() {
    console.log('Allowed');
}

function denied() {
    console.log('Denied');
}

It works as expected in Firefox. However, in accessAllowed Chrome, accessDenied works. Instead, I get the following error:

OT.Publisher.onStreamAvailableError PermissionDeniedError:
TB.exception :: title: Internal Error (2000) msg: Publisher failed to access camera/mic:

Any ideas?

+4
source share
1 answer

JS OpenTok. , , , .

var waiting = false;
publisher.addEventListener('accessAllowed', function() {
  waiting = false;
  allowed();
});
publisher.addEventListener('accessDenied', function() {
  waiting = false;
  denied();
});
publisher.addEventListener('accessDialogOpened', function() {
  waiting = true;
});
publisher.addEventListener('accessDialogClosed', function() {
  setTimeout(function() {
    if (waiting) {
      waiting = false;
      denied();
    }
  }, 0);
});

, Chrome , , . , - , "accessDialogOpened" . .

+5

Source: https://habr.com/ru/post/1525278/


All Articles