title: OT.Publisher.onStreamAvailableError Permission Denied
body: <p>I'm working with OpenTok, trying to publish an app where a person shows a room and some clients can see, in order to buy it or not.</p>
  
  <p>When using the example code in my localhost (and also in Firefox and nasty iExplorer) everything works smooth, but when I do it in Chrome i get this error in my JS Console:</p>
  
  <pre><code>OT.Publisher.onStreamAvailableError Permission Denied
  </code></pre>
  
  <p>I dont remember never saying "no" to any pop up that asked me permition to share my cam, so is not like "Chrome will remember my last choise".</p>
  
  <p>Any help?</p>
  
  <p>This is the code that I'm executing:</p>
  
  <pre><code>&lt;?php
      //Obviously I changed this.
      $apiKey = "123456789";
      $apiSecret = "VICTORIA's SECRET";
  
      require '../vendor/autoload.php';
  
      use OpenTok\OpenTok;
      use OpenTok\MediaMode;
      use OpenTok\Session;
      use OpenTok\Role;
  
      $opentok    = new OpenTok($apiKey,$apiSecret);
      $session    = $opentok-&gt;createSession();
      $sessionId  = $session-&gt;getSessionId();
      $data = array(
              'role'      =&gt; Role::PUBLISHER,
              'data'      =&gt;""
          );                 
      $token = $session-&gt;generateToken($data);
  ?&gt;
  
  &lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;title&gt;OpenTok Hello World&lt;/title&gt;
      &lt;script src='https://static.opentok.com/v2/js/opentok.min.js'&gt;&lt;/script&gt;
      &lt;!--script src="//static.opentok.com/webrtc/v2.2/js/TB.min.js"&gt;&lt;/script--&gt;
      &lt;script type="text/javascript"&gt;
          var token       = '&lt;?php echo $token; ?&gt;';
          var apiKey      = '&lt;?php echo $apiKey; ?&gt;';
          var sessionId   = '&lt;?php echo $sessionId; ?&gt;';
  
          var session     = TB.initSession(sessionId);
          var publisher   = TB.initPublisher(apiKey, 'subscribers');
  
          // Attach event handlers
          session.on({
            sessionConnected: function(event) 
            {
              session.publish(publisher);
            },
            streamCreated: function(event) 
            {
              var subContainer = document.createElement('div');
              subContainer.id = 'stream-' + event.stream.streamId;
              document.getElementById('subscribers').appendChild(subContainer);
              session.subscribe(event.stream, subContainer);
            }
  
          });
          session.connect(apiKey, token);
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h2&gt;Hello, Universe!&lt;/h2&gt;
  
      &lt;div id="publisher"&gt;&lt;/div&gt;
  
      &lt;div id="subscribers"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I check the JS Console, I get this warning:</p>
  
  <pre><code>getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.
  </code></pre>
  
  <p>An also this Error:</p>
  
  <pre><code>OT.Publisher.onStreamAvailableError Permission Denied
  </code></pre>
  
  <p>This is our development server, so is not https.</p>
  
  <p>EDIT:</p>
  
  <p>After checking the OpenTok JS that I have to load at the beging, I realice this:</p>
  
  <pre><code>  // The user has clicked the 'deny' button the the allow access dialog
    // (or it's set to always deny)
    var onAccessDenied = function(error) {
      if (_isScreenSharing) {
        if (global.location.protocol !== 'https:') {
          /**
           * in http:// the browser will deny permission without asking the
           * user. There is also no way to tell if it was denied by the
           * user, or prevented from the browser.
           */
          error.message += ' Note: https:// is required for screen sharing.';
        }
      }
  
      logging.error('OT.Publisher.onStreamAvailableError Permission Denied');
  </code></pre>
  
  <p>So, It won't ask me if I'm using http. There's a way to workaround this? Overwrite this behavior?</p>