x-movie/src/VideoPlayer.js

30 lines
731 B
JavaScript
Raw Normal View History

2023-07-08 03:15:48 +08:00
import {React, useContext} from 'react';
2023-07-04 23:47:01 +08:00
import { useParams } from 'react-router-dom';
import Container from '@mui/material/Container';
import Typography from '@mui/material/Typography';
2023-07-08 03:15:48 +08:00
import ConfigContext from './Config';
2023-07-04 23:47:01 +08:00
const VideoPlayer = () => {
2023-07-08 03:15:48 +08:00
const config = useContext(ConfigContext);
2023-07-04 23:47:01 +08:00
const { filename } = useParams();
return (
<Container>
<Typography variant="h6" gutterBottom>
{filename}
</Typography>
<video
2023-07-08 17:44:51 +08:00
autoPlay={true}
2023-07-04 23:47:01 +08:00
controls
style={{ width: '100%', maxHeight: '70vh' }}
src={`${config.Host}/res/${filename}`}
>
您的浏览器不支持HTML5视频播放
</video>
</Container>
);
};
export default VideoPlayer;