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 Toolbar from "@mui/material/Toolbar";
|
||||
import Box from "@mui/material/Box";
|
||||
import Stack from "@mui/material/Stack";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Typography from "@mui/material/Typography";
|
||||
|
||||
@@ -11,6 +12,7 @@ import ReactPlayer from "react-player";
|
||||
|
||||
import { usePlaybackStore } from "../../utils/store/playback";
|
||||
import { MdiArrowLeft } from "../../components/icons/mdiArrowLeft";
|
||||
import { MdiPlay } from "../../components/icons/mdiPlay";
|
||||
|
||||
import { useNavigate } from "react-router-dom";
|
||||
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 "./videoPlayer.module.scss";
|
||||
import { MdiPause } from "../../components/icons/mdiPause";
|
||||
import { MdiFastForward } from "../../components/icons/mdiFastForward";
|
||||
import { MdiRewind } from "../../components/icons/mdiRewind";
|
||||
|
||||
export const VideoPlayer = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
@@ -54,32 +61,85 @@ export const VideoPlayer = () => {
|
||||
state.itemName,
|
||||
],
|
||||
);
|
||||
|
||||
let timer;
|
||||
return (
|
||||
<Box sx={{ background: "black" }}>
|
||||
<AppBar
|
||||
position="fixed"
|
||||
elevation={0}
|
||||
<Box
|
||||
className="video"
|
||||
sx={{ background: "black" }}
|
||||
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={{
|
||||
background:
|
||||
"linear-gradient(to bottom, rgb(0 0 0 / 0.75), transparent)",
|
||||
position: "fixed",
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
}}
|
||||
alignItems="center"
|
||||
justifyContent="space-between"
|
||||
direction="column"
|
||||
zIndex="10000000"
|
||||
>
|
||||
<Toolbar>
|
||||
<IconButton onClick={() => navigate(-1)}>
|
||||
<MdiArrowLeft />
|
||||
<AppBar
|
||||
position="static"
|
||||
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>
|
||||
<Typography ml={2} variant="h6">
|
||||
{itemName}
|
||||
</Typography>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
<IconButton onClick={() => setIsPlaying(!isPlaying)}>
|
||||
{isPlaying ? <MdiPause /> : <MdiPlay />}
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
playerRef.current.seekTo(
|
||||
playerRef.current.getCurrentTime() + 15,
|
||||
)
|
||||
}
|
||||
>
|
||||
<MdiFastForward />
|
||||
</IconButton>
|
||||
</Stack>
|
||||
</Stack>
|
||||
<ReactPlayer
|
||||
ref={playerRef}
|
||||
width="100vw"
|
||||
height="100vh"
|
||||
playing={true}
|
||||
playing={isPlaying}
|
||||
url={url}
|
||||
controls={true}
|
||||
// controls={true}
|
||||
onProgress={onProgress}
|
||||
onReady={onReady}
|
||||
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