Repository URL to install this package:
|
Version:
2.1.16 ▾
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const utils_1 = require("@skava/utils");
const Video_1 = require("@skava/ui/dist/components/atoms/Video");
const VideoControls_1 = tslib_1.__importDefault(require("./VideoControls")); // oppositeOfOmit
function keep(props, keysToKeep) {
const obj = {};
keysToKeep.forEach(key => {
obj[key] = props[key];
});
return obj;
}
const CONTROL_PROPS = Object.freeze(['state', 'videoLength', 'title', 'slogan', 'shareTitle']);
const VIDEO_PROPS = Object.freeze(['state', 'thumbnailImage', 'shouldAutoPlay', 'shouldLoop', 'preload', 'hasNativeControls']);
function defaultRenderControls(props, state) {
console.debug('[Video] defaultRenderControls');
const controlProps = keep(props, CONTROL_PROPS);
return react_1.default.createElement(VideoControls_1.default, Object.assign({}, controlProps, {
state: state
}));
}
exports.defaultRenderControls = defaultRenderControls;
function defaultRenderVideo(props, state) {
const {
mp4Source
} = props,
remainingProps = tslib_1.__rest(props, ["mp4Source"]);
const strippedProps = utils_1.omit(remainingProps, CONTROL_PROPS);
const videoProps = Object.assign({}, strippedProps);
console.debug('[Video] defaultRenderVideo');
console.dir(videoProps);
return react_1.default.createElement(Video_1.VideoPlayer, Object.assign({}, videoProps));
}
exports.defaultRenderVideo = defaultRenderVideo;