vendor/opentok.js
function fixFitModeCover(element, containerWidth, containerHeight, intrinsicRatio, rotated) {

      var $video = OT.$('.OT_video-element', element);

      if ($video.length > 0) {

        var cssProps = {left: '', top: ''};

        if (OTPlugin.isInstalled()) {
          cssProps.width = '100%';
          cssProps.height = '100%';
        } else {
          intrinsicRatio = intrinsicRatio || defaultAspectRatio;
          intrinsicRatio = rotated ? 1 / intrinsicRatio : intrinsicRatio;

          var containerRatio = containerWidth / containerHeight;

          var enforcedVideoWidth,
              enforcedVideoHeight;

          if (rotated) {
            // in case of rotation same code works for both kind of ration
            enforcedVideoHeight = containerWidth;
            enforcedVideoWidth = enforcedVideoHeight * intrinsicRatio;

            cssProps.width = enforcedVideoWidth + 'px';
            cssProps.height = enforcedVideoHeight + 'px';
            cssProps.top = (enforcedVideoWidth + containerHeight) / 2 + 'px';
          } else {
            if (intrinsicRatio < containerRatio) {
              // the container is wider than the video -> we will crop the height of the video
              enforcedVideoWidth = containerWidth;
              enforcedVideoHeight = enforcedVideoWidth / intrinsicRatio;

              cssProps.width = enforcedVideoWidth + 'px';
              cssProps.height = enforcedVideoHeight + 'px';
              cssProps.top = (-enforcedVideoHeight + containerHeight) / 2 + 'px';
            } else {
              enforcedVideoHeight = containerHeight;
              enforcedVideoWidth = enforcedVideoHeight * intrinsicRatio;

              cssProps.width = enforcedVideoWidth + 'px';
              cssProps.height = enforcedVideoHeight + 'px';
              cssProps.left = (-enforcedVideoWidth + containerWidth) / 2 + 'px';
            }
          }
        }

        $video.css(cssProps);
      }
    }
function fixFitModeCover(element, containerWidth, containerHeight, intrinsicRatio, rotated) {

      var $video = OT.$('.OT_video-element', element);

      if ($video.length > 0) {

        var cssProps = {left: '', top: ''};

        if (OTPlugin.isInstalled()) {
          cssProps.width = '100%';
          cssProps.height = '100%';
        } else {
          intrinsicRatio = intrinsicRatio || defaultAspectRatio;
          intrinsicRatio = rotated ? 1 / intrinsicRatio : intrinsicRatio;

          var containerRatio = containerWidth / containerHeight;

          var enforcedVideoWidth,
              enforcedVideoHeight;

          if (rotated) {
            // in case of rotation same code works for both kind of ration
            enforcedVideoHeight = containerWidth;
            enforcedVideoWidth = enforcedVideoHeight * intrinsicRatio;

            cssProps.width = enforcedVideoWidth + 'px';
            cssProps.height = enforcedVideoHeight + 'px';
            cssProps.top = (enforcedVideoWidth + containerHeight) / 2 + 'px';
          } else {
            if (intrinsicRatio < containerRatio) {
              // the container is wider than the video -> we will crop the height of the video
              enforcedVideoWidth = containerWidth;
              enforcedVideoHeight = enforcedVideoWidth / intrinsicRatio;

              cssProps.width = enforcedVideoWidth + 'px';
              cssProps.height = enforcedVideoHeight + 'px';
              cssProps.top = (-enforcedVideoHeight + containerHeight) / 2 + 'px';
            } else {
              enforcedVideoHeight = containerHeight;
              enforcedVideoWidth = enforcedVideoHeight * intrinsicRatio;

              cssProps.width = enforcedVideoWidth + 'px';
              cssProps.height = enforcedVideoHeight + 'px';
              cssProps.left = (-enforcedVideoWidth + containerWidth) / 2 + 'px';
            }
          }
        }

        $video.css(cssProps);
      }
    }
function fixFitModeCover ( element , containerWidth , containerHeight , intrinsicRatio , rotated ) { var $video = OT . $ ( '.OT_video-element' , element ) ; if ( $video . length > 0 ) { var cssProps = { left : '' , top : '' } ; if ( OTPlugin . isInstalled ( ) ) { cssProps . width = '100%' ; cssProps . height = '100%' ; } else { intrinsicRatio = intrinsicRatio || defaultAspectRatio ; intrinsicRatio = rotated ? 1 / intrinsicRatio : intrinsicRatio ; var containerRatio = containerWidth / containerHeight ; var enforcedVideoWidth , enforcedVideoHeight ; if ( rotated ) { // in case of rotation same code works for both kind of ration enforcedVideoHeight = containerWidth ; enforcedVideoWidth = enforcedVideoHeight * intrinsicRatio ; cssProps . width = enforcedVideoWidth + 'px' ; cssProps . height = enforcedVideoHeight + 'px' ; cssProps . top = ( enforcedVideoWidth + containerHeight ) / 2 + 'px' ; } else { if ( intrinsicRatio < containerRatio ) { // the container is wider than the video -> we will crop the height of the video enforcedVideoWidth = containerWidth ; enforcedVideoHeight = enforcedVideoWidth / intrinsicRatio ; cssProps . width = enforcedVideoWidth + 'px' ; cssProps . height = enforcedVideoHeight + 'px' ; cssProps . top = ( - enforcedVideoHeight + containerHeight ) / 2 + 'px' ; } else { enforcedVideoHeight = containerHeight ; enforcedVideoWidth = enforcedVideoHeight * intrinsicRatio ; cssProps . width = enforcedVideoWidth + 'px' ; cssProps . height = enforcedVideoHeight + 'px' ; cssProps . left = ( - enforcedVideoWidth + containerWidth ) / 2 + 'px' ; } } } $video . css ( cssProps ) ; } }
Sets the video element size so by preserving the intrinsic aspect ratio of the element content
but altering the width and height so that the video completely covers the container.

@param {Element} element the container of the video element
@param {number} containerWidth
@param {number} containerHeight
@param {number} intrinsicRatio the aspect ratio of the video media
@param {boolean} rotated
Sets the video element size so by preserving the intrinsic aspect ratio of the element content but altering the width and height so that the video completely covers the container .