'use strict';

/**
 * 获取视频的宽高比
 * @param {*} videoFile 视频文件
 */
function getVideoSizeRatio(videoFile) {
  var url = URL.createObjectURL(videoFile);
  var video = document.createElement('video');
  video.src = url;

  video.onloadedmetadata = function () {
    URL.revokeObjectURL(url);
    return (video.videoWidth / video.videoHeight).toFixed(4);
  };

  video.load();
}

module.exports = getVideoSizeRatio;
