Start implementing player Ui #10
This commit is contained in:
5 files changed
+123
-16
No files matched your search
@@ -0,0 +1,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiFastForward } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiFastForward = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiFastForward}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiPause } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiPause = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiPause}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiRewind } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiRewind = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiRewind}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -4,6 +4,7 @@ import { appWindow } from "@tauri-apps/api/window";
|
|||||||
import AppBar from "@mui/material/AppBar";
|
import AppBar from "@mui/material/AppBar";
|
||||||
import Toolbar from "@mui/material/Toolbar";
|
import Toolbar from "@mui/material/Toolbar";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
|
import Stack from "@mui/material/Stack";
|
||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
@@ -11,6 +12,7 @@ import ReactPlayer from "react-player";
|
|||||||
|
|
||||||
import { usePlaybackStore } from "../../utils/store/playback";
|
import { usePlaybackStore } from "../../utils/store/playback";
|
||||||
import { MdiArrowLeft } from "../../components/icons/mdiArrowLeft";
|
import { MdiArrowLeft } from "../../components/icons/mdiArrowLeft";
|
||||||
|
import { MdiPlay } from "../../components/icons/mdiPlay";
|
||||||
|
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useRef, useState, useCallback } from "react";
|
import { useRef, useState, useCallback } from "react";
|
||||||
@@ -18,6 +20,11 @@ import { secToTicks, ticksToSec } from "../../utils/date/time";
|
|||||||
|
|
||||||
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api";
|
||||||
|
|
||||||
|
import "./videoPlayer.module.scss";
|
||||||
|
import { MdiPause } from "../../components/icons/mdiPause";
|
||||||
|
import { MdiFastForward } from "../../components/icons/mdiFastForward";
|
||||||
|
import { MdiRewind } from "../../components/icons/mdiRewind";
|
||||||
|
|
||||||
export const VideoPlayer = () => {
|
export const VideoPlayer = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
@@ -54,32 +61,85 @@ export const VideoPlayer = () => {
|
|||||||
state.itemName,
|
state.itemName,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let timer;
|
||||||
return (
|
return (
|
||||||
<Box sx={{ background: "black" }}>
|
<Box
|
||||||
<AppBar
|
className="video"
|
||||||
position="fixed"
|
sx={{ background: "black" }}
|
||||||
elevation={0}
|
onMouseMove={(e) => {
|
||||||
|
let a = "he";
|
||||||
|
clearTimeout(timer);
|
||||||
|
e.currentTarget.classList.add("video-osd-visible");
|
||||||
|
timer = setTimeout(() => {
|
||||||
|
document
|
||||||
|
.querySelector(".video")
|
||||||
|
.classList.remove("video-osd-visible");
|
||||||
|
}, 2000);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Stack
|
||||||
|
className="video-osd"
|
||||||
sx={{
|
sx={{
|
||||||
background:
|
position: "fixed",
|
||||||
"linear-gradient(to bottom, rgb(0 0 0 / 0.75), transparent)",
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
}}
|
}}
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="space-between"
|
||||||
|
direction="column"
|
||||||
|
zIndex="10000000"
|
||||||
>
|
>
|
||||||
<Toolbar>
|
<AppBar
|
||||||
<IconButton onClick={() => navigate(-1)}>
|
position="static"
|
||||||
<MdiArrowLeft />
|
elevation={0}
|
||||||
|
sx={{
|
||||||
|
background:
|
||||||
|
"linear-gradient(to bottom, rgb(0 0 0 / 0.75), transparent)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Toolbar>
|
||||||
|
<IconButton onClick={() => navigate(-1)}>
|
||||||
|
<MdiArrowLeft />
|
||||||
|
</IconButton>
|
||||||
|
<Typography ml={2} variant="h6">
|
||||||
|
{itemName}
|
||||||
|
</Typography>
|
||||||
|
</Toolbar>
|
||||||
|
</AppBar>
|
||||||
|
<Stack padding={2} direction="row">
|
||||||
|
<IconButton
|
||||||
|
onClick={() =>
|
||||||
|
playerRef.current.seekTo(
|
||||||
|
playerRef.current.getCurrentTime() - 15,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<MdiRewind />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<Typography ml={2} variant="h6">
|
<IconButton onClick={() => setIsPlaying(!isPlaying)}>
|
||||||
{itemName}
|
{isPlaying ? <MdiPause /> : <MdiPlay />}
|
||||||
</Typography>
|
</IconButton>
|
||||||
</Toolbar>
|
<IconButton
|
||||||
</AppBar>
|
onClick={() =>
|
||||||
|
playerRef.current.seekTo(
|
||||||
|
playerRef.current.getCurrentTime() + 15,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<MdiFastForward />
|
||||||
|
</IconButton>
|
||||||
|
</Stack>
|
||||||
|
</Stack>
|
||||||
<ReactPlayer
|
<ReactPlayer
|
||||||
ref={playerRef}
|
ref={playerRef}
|
||||||
width="100vw"
|
width="100vw"
|
||||||
height="100vh"
|
height="100vh"
|
||||||
playing={true}
|
playing={isPlaying}
|
||||||
url={url}
|
url={url}
|
||||||
controls={true}
|
// controls={true}
|
||||||
onProgress={onProgress}
|
onProgress={onProgress}
|
||||||
onReady={onReady}
|
onReady={onReady}
|
||||||
muted={isMuted}
|
muted={isMuted}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
.video {
|
||||||
|
&-osd {
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.1s linear;
|
||||||
|
}
|
||||||
|
&-osd-visible &-osd {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user