fix (video): set mimetype automatically

This commit is contained in:
Mickael Kerjean 2019-11-08 16:37:10 +11:00
parent ae2ef413b3
commit 5beba70b36

View file

@ -3,6 +3,7 @@ import ReactCSSTransitionGroup from 'react-addons-css-transition-group';
import { Pager } from './pager'; import { Pager } from './pager';
import { MenuBar } from './menubar'; import { MenuBar } from './menubar';
import { getMimeType } from '../../helpers/';
import videojs from 'video.js'; import videojs from 'video.js';
import 'videojs-contrib-hls'; import 'videojs-contrib-hls';
@ -18,9 +19,10 @@ export class VideoPlayer extends React.Component {
this.player = videojs(this.refs.$video, { this.player = videojs(this.refs.$video, {
fluid: true, fluid: true,
controls: true, controls: true,
aspectRatio: '16:9', aspectRatio: "16:9",
sources: [{ sources: [{
src: this.props.data src: this.props.data,
type: getMimeType(this.props.data)
}] }]
}); });
} }
@ -30,9 +32,10 @@ export class VideoPlayer extends React.Component {
this.player = videojs(this.refs.$video, { this.player = videojs(this.refs.$video, {
fluid: true, fluid: true,
controls: true, controls: true,
aspectRatio: '16:9', aspectRatio: "16:9",
sources: [{ sources: [{
src: nextProps.data src: nextProps.data,
type: getMimeType(this.props.data)
}] }]
}); });
} }