5

I'm setting up a prototype for using Opentok Webrtc in Safari IOS11 for the Iphone. It all worked fine, untill today (and I don't remember changing anything). The error I'm receiving is

OT.Publisher Access Denied: Permission Denied: End-user denied permission to hardware devices (getUserMedia error: NotAllowedError)

You would say this is local, but i've tried it with the phone of a colleague and the same error now occurred. So it should be somewhere in the code or OpenTok library in my opinion.

Any idea?

// Handling all of our errors here by alerting them
function handleError(error) {
  if (error) {
    alert(error.message);
  }
}
    // make the agent id dynamic alteron, now hardcoded
    var agentIdAvailable = '007';    
    var SERVER_BASE_URL = 'https://XXX.herokuapp.com';
    fetch(SERVER_BASE_URL + '/room/'+ agentIdAvailable).then(function(res) {
      return res.json()
    }).then(function(res) {
      apiKey = res.apiKey;
      sessionId = res.sessionId;
      token = res.token;
      initializeSession();
    }).catch(handleError);

function initializeSession() {
  var session = OT.initSession(apiKey, sessionId);

  // Subscribe to a newly created stream
  session.on('streamCreated', function(event) {
    session.subscribe(event.stream, 'subscriber', {
      insertMode: 'append',
      width: '100%',
      height: '100%'
    }, handleError);
  });

  // Create a publisher
  var publisher = OT.initPublisher('publisher', {
    insertMode: 'append',
    width: '100%',
    height: '100%'
  }, handleError);

  // Connect to the session
  session.connect(token, function(error) {
    // If the connection is successful, initialize a publisher and publish to the session
    if (error) {
      handleError(error);
    } else {
      session.publish(publisher, handleError);
      console.log('*** publishing', publisher);
    }
  });
}
  • Did you get this working? On this safari browser support page they mention a flag to enable http but I cannot find documentation for the actual flag anywhere. https://tokbox.com/developer/sdks/js/safari/ • Safari does not support camera access (or stream publishing) in pages loaded using the http: (insecure) or file: (file system) URI schemes. You must serve the page over https: (secure). However, you can toggle a flag to support HTTP (for testing). • Safari does not support camera access on localhost. You must use 0.0.0.0:xx (where xx is the port number, such as 80). – TaeKwonJoe Jun 07 '19 at 17:09

1 Answers1

0

I had the same problem with vonage (old opentok). There is an article that was the solution of my problem: https://video-api.support.vonage.com/hc/en-us/articles/4983310908948-Issue-with-screensharing-with-embedded-iFrames

I had forget to put "display-capture" on the iframe (to allow screen share), therefore this exactly error message that you mentioned happened to me, but not in safari (i was trying on chrome)

Luiza Rodrigues
  • 185
  • 1
  • 2
  • 15