fix for hls support

This commit is contained in:
Sean Yesmunt 2021-01-04 10:12:46 -05:00
parent dd1d956bfe
commit f59cdb1929
2 changed files with 27 additions and 19 deletions

View file

@ -311,6 +311,11 @@ export default React.memo<Props>(function VideoJs(props: Props) {
// $FlowFixMe
containerRef.current.appendChild(wrapper);
fetch(source).then(response => {
if (response.redirected && response.url && response.url.endsWith('m3u8')) {
videoJsOptions.sources[0].type = 'application/x-mpegURL';
}
player = videojs(el, videoJsOptions, () => {
if (player) {
player.one('play', onInitialPlay);
@ -332,6 +337,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
player.on('fullscreenchange', () => document.activeElement && document.activeElement.blur());
window.addEventListener('keydown', handleKeyDown);
});
return () => {
window.removeEventListener('keydown', handleKeyDown);

View file

@ -53,6 +53,8 @@
}
.file-render--video {
background-color: black;
&:after {
content: '';
position: absolute;