添加 修改
This commit is contained in:
parent
e2e48c9fea
commit
a68cb5b38b
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -50,5 +50,5 @@ yarn-error.log*
|
||||||
movie
|
movie
|
||||||
server/server
|
server/server
|
||||||
server/main
|
server/main
|
||||||
__debug_bin
|
__debug_bin*
|
||||||
gpt*.txt
|
gpt*.txt
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { createContext } from 'react';
|
||||||
const ConfigContext = createContext();
|
const ConfigContext = createContext();
|
||||||
|
|
||||||
export const config = {
|
export const config = {
|
||||||
Host: 'http://192.168.31.121:4444',
|
Host: 'http://192.168.124.2:4444',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ConfigContext;
|
export default ConfigContext;
|
|
@ -9,11 +9,15 @@ const CategoryNav = ({ categories, currentCategory, onCategoryChange }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<Tabs
|
<Tabs
|
||||||
value={currentCategory}
|
value={currentCategory}
|
||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
indicatorColor="primary"
|
indicatorColor="primary"
|
||||||
textColor="primary"
|
textColor="primary"
|
||||||
|
ScrollButtonComponent="div"
|
||||||
|
variant="scrollable"
|
||||||
|
scrollButtons="auto"
|
||||||
centered
|
centered
|
||||||
>
|
>
|
||||||
{categories.map((category, idx) => (
|
{categories.map((category, idx) => (
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import {React, useContext} from 'react';
|
import {React, useContext, useState} from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import Container from '@mui/material/Container';
|
import Container from '@mui/material/Container';
|
||||||
import Typography from '@mui/material/Typography';
|
import Typography from '@mui/material/Typography';
|
||||||
import ConfigContext from '../Config';
|
import ConfigContext from '../Config';
|
||||||
|
import ReactPlayer from 'react-player';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,21 +12,32 @@ const VideoPlayer = () => {
|
||||||
const config = useContext(ConfigContext);
|
const config = useContext(ConfigContext);
|
||||||
const { filename } = useParams();
|
const { filename } = useParams();
|
||||||
|
|
||||||
|
const [isFullScreen, setIsFullScreen] = useState(false);
|
||||||
|
|
||||||
|
const handleFullScreenChange = (player) => {
|
||||||
|
setIsFullScreen(!isFullScreen);
|
||||||
|
if (isFullScreen) {
|
||||||
|
player.exitFullscreen();
|
||||||
|
} else {
|
||||||
|
player.requestFullscreen();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Typography variant="h6" gutterBottom>
|
<Typography variant="h6" gutterBottom>
|
||||||
{filename}
|
{filename}
|
||||||
</Typography>
|
</Typography>
|
||||||
<video
|
<ReactPlayer
|
||||||
autoPlay={true}
|
url={`${config.Host}/res/${filename}`}
|
||||||
controls
|
controls
|
||||||
style={{ width: '100%', maxHeight: '70vh' }}
|
width="100%"
|
||||||
src={`${config.Host}/res/${filename}`}
|
height="auto"
|
||||||
>
|
playing={isFullScreen}
|
||||||
您的浏览器不支持HTML5视频播放。
|
onReady={handleFullScreenChange}
|
||||||
</video>
|
/>
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default VideoPlayer;
|
export default VideoPlayer;
|
|
@ -11,3 +11,28 @@ code {
|
||||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||||
monospace;
|
monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 对于较小的屏幕 */
|
||||||
|
@media only screen and (max-width: 600px) {
|
||||||
|
.MoviesGrid {
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 中等大小屏幕 */
|
||||||
|
@media only screen and (min-width: 601px) and (max-width: 960px) {
|
||||||
|
.MoviesGrid {
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 大屏幕 */
|
||||||
|
@media only screen and (min-width: 961px) {
|
||||||
|
.MoviesGrid {
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user