vendor/opentok.js
function makeMediaPeerProxy (api) {
    api.setStream = function(stream, completion) {
      api._.setStream(stream);

      if (completion) {
        if (stream.hasVideo()) {
          // FIX ME renderingStarted currently doesn't first
          // api.once('renderingStarted', completion);
          var verifyStream = function() {
            if (!api._) {
              completion(new $.Error('The plugin went away before the stream could be bound.'));
              return;
            }

            if (api._.videoWidth > 0) {
              // This fires a little too soon.
              setTimeout(completion, 200);
            }
            else {
              setTimeout(verifyStream, 500);
            }
          };

          setTimeout(verifyStream, 500);
        }
        else {
          // TODO Investigate whether there is a good way to detect
          // when the audio is ready. Does it even matter?

          // This fires a little too soon.
          setTimeout(completion, 200);
        }
      }

      return api;
    };

    return api;
  }
function makeMediaPeerProxy (api) {
    api.setStream = function(stream, completion) {
      api._.setStream(stream);

      if (completion) {
        if (stream.hasVideo()) {
          // FIX ME renderingStarted currently doesn't first
          // api.once('renderingStarted', completion);
          var verifyStream = function() {
            if (!api._) {
              completion(new $.Error('The plugin went away before the stream could be bound.'));
              return;
            }

            if (api._.videoWidth > 0) {
              // This fires a little too soon.
              setTimeout(completion, 200);
            }
            else {
              setTimeout(verifyStream, 500);
            }
          };

          setTimeout(verifyStream, 500);
        }
        else {
          // TODO Investigate whether there is a good way to detect
          // when the audio is ready. Does it even matter?

          // This fires a little too soon.
          setTimeout(completion, 200);
        }
      }

      return api;
    };

    return api;
  }
function makeMediaPeerProxy ( api ) { api . setStream = function ( stream , completion ) { api . _ . setStream ( stream ) ; if ( completion ) { if ( stream . hasVideo ( ) ) { // FIX ME renderingStarted currently doesn't first // api.once('renderingStarted', completion); var verifyStream = function ( ) { if ( ! api . _ ) { completion ( new $ . Error ( 'The plugin went away before the stream could be bound.' ) ) ; return ; } if ( api . _ . videoWidth > 0 ) { // This fires a little too soon. setTimeout ( completion , 200 ) ; } else { setTimeout ( verifyStream , 500 ) ; } } ; setTimeout ( verifyStream , 500 ) ; } else { // TODO Investigate whether there is a good way to detect // when the audio is ready. Does it even matter? // This fires a little too soon. setTimeout ( completion , 200 ) ; } } return api ; } ; return api ; }
Specialisation for the MediaPeer API surface
Specialisation for the MediaPeer API surface