Source

media/readVideoProps.js

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var isStr_1 = __importDefault(require("../string/isStr"));
/**
 * Read the file props of the video
 * @category media
 * @module readVideoProps
 */
var readVideoProps = function (src) { return new Promise(function (resolve, reject) {
    var video = document.createElement('video');
    video.onloadedmetadata = function () { return resolve({
        width: video.videoWidth,
        height: video.videoHeight,
    }); };
    video.onerror = reject;
    video.src = (0, isStr_1.default)(src) ? src : window.URL.createObjectURL(src);
}); };
exports.default = readVideoProps;