lbry-desktop/ui/component/viewers/videoViewer/internal/videojs-functions.jsx
mayeaux 58bdcbd1ed
Reduce triple call to single call, improve video loading, fix embed play button being off-center (#546)
Lots of optimizations and cleanup for the player. If we run into any strange issues, can revert.
2022-01-06 14:28:27 -05:00

29 lines
710 B
JavaScript

// @flow
const VideoJsFunctions = ({
isAudio,
}: {
isAudio: boolean,
}) => {
// TODO: can remove this function as well
// Create the video DOM element and wrapper
function createVideoPlayerDOM(container: any) {
if (!container) return;
// This seems like a poor way to generate the DOM for video.js
const wrapper = document.createElement('div');
wrapper.setAttribute('data-vjs-player', 'true');
const el = document.createElement(isAudio ? 'audio' : 'video');
el.className = 'video-js vjs-big-play-centered ';
wrapper.appendChild(el);
container.appendChild(wrapper);
return el;
}
return {
createVideoPlayerDOM,
};
};
export default VideoJsFunctions;