Repository URL to install this package:
|
Version:
2.8.4 ▾
|
"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("../../../atoms/Video");
const VideoControls_1 = require("./VideoControls");
const CONTROL_PROPS = Object.freeze(['state', 'videoLength', 'title', 'slogan', 'shareTitle']);
const VIDEO_PROPS = Object.freeze(['state', 'thumbnailImage', 'shouldAutoPlay', 'shouldLoop', 'preload', 'muted', 'hasNativeControls', 'hasPlayButton', 'shouldShowVideoInformation']);
function defaultRenderControls(props, state) {
const controlProps = utils_1.keep(props, CONTROL_PROPS);
return react_1.default.createElement(VideoControls_1.VideoControls, 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, {
// props overwriting from state
hasNativeControls: state.hasNativeControls,
hasPlayButton: state.hasPlayButton,
shouldShowVideoInformation: state.shouldShowVideoInformation,
isPaused: !state.isPlaying,
muted: strippedProps.shouldAutoPlay
});
return react_1.default.createElement(Video_1.VideoPlayer, Object.assign({}, videoProps));
}
exports.defaultRenderVideo = defaultRenderVideo; //# sourceMappingURL=renderProps.js.map