36 lines
1.7 KiB
JavaScript
36 lines
1.7 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.useUnsafeVideoConfig = void 0;
|
|
const react_1 = require("react");
|
|
const SequenceContext_js_1 = require("./SequenceContext.js");
|
|
const use_video_js_1 = require("./use-video.js");
|
|
const useUnsafeVideoConfig = () => {
|
|
var _a, _b, _c;
|
|
const context = (0, react_1.useContext)(SequenceContext_js_1.SequenceContext);
|
|
const ctxWidth = (_a = context === null || context === void 0 ? void 0 : context.width) !== null && _a !== void 0 ? _a : null;
|
|
const ctxHeight = (_b = context === null || context === void 0 ? void 0 : context.height) !== null && _b !== void 0 ? _b : null;
|
|
const ctxDuration = (_c = context === null || context === void 0 ? void 0 : context.durationInFrames) !== null && _c !== void 0 ? _c : null;
|
|
const video = (0, use_video_js_1.useVideo)();
|
|
return (0, react_1.useMemo)(() => {
|
|
if (!video) {
|
|
return null;
|
|
}
|
|
const { id, durationInFrames, fps, height, width, defaultProps, props, defaultCodec, defaultOutName, defaultVideoImageFormat, defaultPixelFormat, defaultProResProfile, } = video;
|
|
return {
|
|
id,
|
|
width: ctxWidth !== null && ctxWidth !== void 0 ? ctxWidth : width,
|
|
height: ctxHeight !== null && ctxHeight !== void 0 ? ctxHeight : height,
|
|
fps,
|
|
durationInFrames: ctxDuration !== null && ctxDuration !== void 0 ? ctxDuration : durationInFrames,
|
|
defaultProps,
|
|
props,
|
|
defaultCodec,
|
|
defaultOutName,
|
|
defaultVideoImageFormat,
|
|
defaultPixelFormat,
|
|
defaultProResProfile,
|
|
};
|
|
}, [ctxDuration, ctxHeight, ctxWidth, video]);
|
|
};
|
|
exports.useUnsafeVideoConfig = useUnsafeVideoConfig;
|