title: Getting black screen for remote video: WebRTC
body: <p>I'm developing video calling functionality with WebRTC and facing a very strange problem.</p>
  
  <p>When I make a call everything is fine and I'm getting a remote video stream, but when I receive a call, I get a black screen with no remote video. The strange part is that when I refresh the page I get the remote video!</p>
  
  <p>In the console, I'm getting the following thing:</p>
  
  <p><strong>Video constraints false</strong></p>
  
  <p>But when I refresh the page I get the video object.</p>
  
  <p>This is my video container in <strong>index.html</strong>,</p>
  
  <pre><code>&lt;video id="video-container" autoplay="autoplay" class="video-style"&gt;&lt;/video&gt;
  </code></pre>
  
  <p><strong>Main.js:</strong></p>
  
  <pre><code>(function() {
  var vertoHandle, vertoCallbacks, currentCall;
  
  document.getElementById("make-call").addEventListener("click", makeCall);
  document.getElementById("hang-up-call").addEventListener("click", hangupCall);
  document.getElementById("answer-call").addEventListener("click", answerCall);
  
  $.verto.init({}, bootstrap);
  
  function bootstrap(status) {
      vertoHandle = new jQuery.verto({
          // ID of HTML video tag where the video feed is placed.
          tag: "video-container",
          deviceParams: {
            // Asking for camera permissions and devices.
            useCamera: 'any',
            useMic: 'any',
            useSpeak: 'any',
          },
  
          login: '1008@127.0.0.1',
          passwd: '1234',
          socketUrl: 'wss://127.0.0.1:8082',
          ringFile: '',
          iceServers: true,
      }, vertoCallbacks);
  };
  
  vertoCallbacks = {
      onWSLogin : onWSLogin,
      onWSClose : onWSClose,
      onDialogState: onDialogState,
  }
  
  function onWSLogin(verto, success) {
      console.log('onWSLogin', success);
  }
  
  function onWSClose(verto, success) {
      console.log('onWSClose', success);
  }
  
  function onDialogState(d) {
      console.debug('onDialogState', d);
  
      if(!currentCall) {
          currentCall = d;
      }
  
      switch (d.state.name) {
          case 'trying':
              //
              break;
          case 'ringing':
              alert('Someone is calling you, answer!');
              break;
          case 'answering':
              //
              break;
          case 'active':
              //
              break;
          case 'hangup':
              //
              break;
          case 'destroy':
              //
              break;
      }
  }
  
  function makeCall() {
      vertoHandle.videoParams({
          minWidth: 320,
          minHeight: 240,
          maxWidth: 640,
          maxHeight: 480,
          // The minimum frame rate of the client camera, Verto will fail if it's
          // less than this.
          minFrameRate: 15,
          // The maximum frame rate to send from the camera.
          vertoBestFrameRate: 30,
      });
  
      currentCall = vertoHandle.newCall({
          useVideo: true,
          mirrorInput: true,
  
          destination_number : '3520',
          caller_id_name : 'Test Caller',
          caller_id_number: '1008',
          outGoingBandwidth: 'default',
          inComingBandwidth: 'default',
  
          useStereo: true,
          useMic: true,
          useSpeak: true,
  
          userVariables: {
              email: 'test@test.com'
          },
  
          dedEnc: false,
      });
  }
  
  function hangupCall() {
      currentCall.hangup();
  };
  
  function answerCall() {
      currentCall.answer();
  }
  })();
  </code></pre>
  
  <p>What's wrong with this code?</p>
  
  <p>Thanks in advance!</p>