2019-03-01 03:58:27 +00:00
|
|
|
import React from 'react';
|
|
|
|
import ReactDOM from 'react-dom';
|
2019-03-26 12:04:18 +00:00
|
|
|
import FileView from './components/file-view/file-view';
|
2019-03-01 03:58:27 +00:00
|
|
|
import FileViewTip from './components/file-view/file-view-tip';
|
|
|
|
import VideoPlayer from './components/video-player';
|
|
|
|
|
|
|
|
import './css/video-file-view.css';
|
|
|
|
|
2019-03-26 12:04:18 +00:00
|
|
|
const {
|
|
|
|
err, rawPath
|
2019-03-01 03:58:27 +00:00
|
|
|
} = window.app.pageOptions;
|
|
|
|
|
|
|
|
class ViewFileVideo extends React.Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2019-03-26 12:04:18 +00:00
|
|
|
<FileView content={<FileContent />} />
|
2019-03-01 03:58:27 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class FileContent extends React.Component {
|
|
|
|
|
|
|
|
render() {
|
|
|
|
if (err) {
|
|
|
|
return <FileViewTip />;
|
|
|
|
}
|
|
|
|
|
|
|
|
const videoJsOptions = {
|
|
|
|
autoplay: false,
|
|
|
|
controls: true,
|
2019-03-09 08:31:34 +00:00
|
|
|
preload: 'auto',
|
2019-03-01 03:58:27 +00:00
|
|
|
sources: [{
|
|
|
|
src: rawPath
|
|
|
|
}]
|
|
|
|
};
|
|
|
|
return (
|
2019-03-19 09:01:29 +00:00
|
|
|
<div className="file-view-content flex-1">
|
2019-03-01 03:58:27 +00:00
|
|
|
<VideoPlayer { ...videoJsOptions } />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ReactDOM.render (
|
|
|
|
<ViewFileVideo />,
|
|
|
|
document.getElementById('wrapper')
|
|
|
|
);
|