Revert UI changes in @e4ade56
This commit is contained in:
11 files changed
+450
-711
No files matched your search
@@ -5,7 +5,6 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/icon.svg" />
|
<link rel="icon" type="image/svg+xml" href="/icon.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<script src="http://localhost:8097"></script>
|
|
||||||
<title>Jellyplayer</title>
|
<title>Jellyplayer</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|||||||
Generated
+281
-616
File diff suppressed because it is too large.
Load diff
+1
-3
@@ -12,7 +12,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.10.5",
|
"@emotion/react": "^11.10.5",
|
||||||
"@emotion/styled": "^11.10.5",
|
"@emotion/styled": "^11.10.5",
|
||||||
"@fontsource/open-sans": "^4.5.13",
|
"@fontsource/open-sans": "^5.0.2",
|
||||||
"@jellyfin/sdk": "^0.8.2",
|
"@jellyfin/sdk": "^0.8.2",
|
||||||
"@mdi/js": "^7.2.96",
|
"@mdi/js": "^7.2.96",
|
||||||
"@mui/lab": "^5.0.0-alpha.128",
|
"@mui/lab": "^5.0.0-alpha.128",
|
||||||
@@ -20,7 +20,6 @@
|
|||||||
"@tanstack/react-query": "^4.26.1",
|
"@tanstack/react-query": "^4.26.1",
|
||||||
"@tanstack/react-query-devtools": "^4.29.7",
|
"@tanstack/react-query-devtools": "^4.29.7",
|
||||||
"@tauri-apps/api": "^1.2.0",
|
"@tauri-apps/api": "^1.2.0",
|
||||||
"@videojs/http-streaming": "^3.0.2",
|
|
||||||
"axios": "^1.4.0",
|
"axios": "^1.4.0",
|
||||||
"blurhash": "^2.0.5",
|
"blurhash": "^2.0.5",
|
||||||
"events": "^3.3.0",
|
"events": "^3.3.0",
|
||||||
@@ -45,7 +44,6 @@
|
|||||||
"@types/react-dom": "^18.2.1",
|
"@types/react-dom": "^18.2.1",
|
||||||
"@vitejs/plugin-react": "^4.0.0",
|
"@vitejs/plugin-react": "^4.0.0",
|
||||||
"sass": "^1.62.1",
|
"sass": "^1.62.1",
|
||||||
"video.js": "^8.3.0",
|
|
||||||
"vite": "^4.3.1"
|
"vite": "^4.3.1"
|
||||||
},
|
},
|
||||||
"license": "GPL-3.0-only"
|
"license": "GPL-3.0-only"
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 393 KiB After Width: | Height: | Size: 632 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
-41
@@ -1,41 +0,0 @@
|
|||||||
#root {
|
|
||||||
max-width: 1280px;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 2rem;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo {
|
|
||||||
height: 6em;
|
|
||||||
padding: 1.5em;
|
|
||||||
will-change: filter;
|
|
||||||
}
|
|
||||||
.logo:hover {
|
|
||||||
filter: drop-shadow(0 0 2em #646cffaa);
|
|
||||||
}
|
|
||||||
.logo.react:hover {
|
|
||||||
filter: drop-shadow(0 0 2em #61dafbaa);
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes logo-spin {
|
|
||||||
from {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-reduced-motion: no-preference) {
|
|
||||||
a:nth-of-type(2) .logo {
|
|
||||||
animation: logo-spin infinite 20s linear;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
padding: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.read-the-docs {
|
|
||||||
color: #888;
|
|
||||||
}
|
|
||||||
@@ -31,19 +31,19 @@ export const CardScroller = ({
|
|||||||
slidesToSlide: displayCards + 1,
|
slidesToSlide: displayCards + 1,
|
||||||
},
|
},
|
||||||
desktop: {
|
desktop: {
|
||||||
breakpoint: { max: 3000, min: 1025 },
|
breakpoint: { max: 3000, min: 625 },
|
||||||
items: displayCards,
|
items: displayCards,
|
||||||
slidesToSlide: displayCards, // optional, default to 1.
|
slidesToSlide: displayCards, // optional, default to 1.
|
||||||
},
|
},
|
||||||
tablet: {
|
tablet: {
|
||||||
breakpoint: { max: 1024, min: 464 },
|
breakpoint: { max: 624, min: 464 },
|
||||||
items: displayCards - 2,
|
items: displayCards - 2,
|
||||||
slidesToSlide: displayCards - 2, // optional, default to 1.
|
slidesToSlide: displayCards - 2, // optional, default to 1.
|
||||||
},
|
},
|
||||||
mobile: {
|
mobile: {
|
||||||
breakpoint: { max: 464, min: 0 },
|
breakpoint: { max: 464, min: 0 },
|
||||||
items: displayCards - 3,
|
items: displayCards - 5,
|
||||||
slidesToSlide: displayCards - 3, // optional, default to 1.
|
slidesToSlide: displayCards - 5, // optional, default to 1.
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiPlaySpeed } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiPlaySpeed = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiPlaySpeed}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -9,7 +9,11 @@ import IconButton from "@mui/material/IconButton";
|
|||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
import Slider from "@mui/material/Slider";
|
import Slider from "@mui/material/Slider";
|
||||||
import CircularProgress from "@mui/material/CircularProgress";
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
import Grow from "@mui/material/Grow";
|
import Menu from "@mui/material/Menu";
|
||||||
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
|
import List from "@mui/material/List";
|
||||||
|
import ListItem from "@mui/material/ListItem";
|
||||||
|
import ListItemText from "@mui/material/ListItemText";
|
||||||
import Backdrop from "@mui/material/Backdrop";
|
import Backdrop from "@mui/material/Backdrop";
|
||||||
|
|
||||||
import ReactPlayer from "react-player";
|
import ReactPlayer from "react-player";
|
||||||
@@ -33,6 +37,7 @@ import { MdiFullscreenExit } from "../../components/icons/mdiFullscreenExit";
|
|||||||
import { MdiPictureInPictureBottomRight } from "../../components/icons/mdiPictureInPictureBottomRight";
|
import { MdiPictureInPictureBottomRight } from "../../components/icons/mdiPictureInPictureBottomRight";
|
||||||
import { MdiVolumeHigh } from "../../components/icons/mdiVolumeHigh";
|
import { MdiVolumeHigh } from "../../components/icons/mdiVolumeHigh";
|
||||||
import { MdiVolumeOff } from "../../components/icons/mdiVolumeOff";
|
import { MdiVolumeOff } from "../../components/icons/mdiVolumeOff";
|
||||||
|
import { MdiPlaySpeed } from "../../components/icons/mdiPlaySpeed";
|
||||||
|
|
||||||
import { endsAt } from "../../utils/date/time";
|
import { endsAt } from "../../utils/date/time";
|
||||||
|
|
||||||
@@ -40,18 +45,34 @@ import useKeyPress from "../../utils/hooks/useKeyPress";
|
|||||||
|
|
||||||
export const VideoPlayer = () => {
|
export const VideoPlayer = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [url, startPosition, itemDuration, itemId, itemName] =
|
|
||||||
usePlaybackStore((state) => [
|
const [speedMenuEl, setSpeedMenuEl] = useState(null);
|
||||||
|
const [speed, setSpeed] = useState(3);
|
||||||
|
const speedMenuState = Boolean(speedMenuEl);
|
||||||
|
const availableSpeeds = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
|
||||||
|
|
||||||
|
const [
|
||||||
|
url,
|
||||||
|
startPosition,
|
||||||
|
itemDuration,
|
||||||
|
itemId,
|
||||||
|
itemName,
|
||||||
|
subtitleTracks,
|
||||||
|
] = usePlaybackStore((state) => [
|
||||||
state.url,
|
state.url,
|
||||||
state.startPosition,
|
state.startPosition,
|
||||||
state.duration,
|
state.duration,
|
||||||
state.itemId,
|
state.itemId,
|
||||||
state.itemName,
|
state.itemName,
|
||||||
|
state.subtitleTracks,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
var mySubtitle_arr = [];
|
||||||
|
|
||||||
const [showControls, setShowControls] = useState(false);
|
const [showControls, setShowControls] = useState(false);
|
||||||
|
|
||||||
const playerRef = useRef();
|
const playerRef = useRef();
|
||||||
|
const [isSeeking, setIsSeeking] = useState(false);
|
||||||
const [isBuffering, setIsBuffering] = useState(true);
|
const [isBuffering, setIsBuffering] = useState(true);
|
||||||
const [isPlaying, setIsPlaying] = useState(true);
|
const [isPlaying, setIsPlaying] = useState(true);
|
||||||
const [isMuted, setIsMuted] = useState(false);
|
const [isMuted, setIsMuted] = useState(false);
|
||||||
@@ -75,8 +96,10 @@ export const VideoPlayer = () => {
|
|||||||
}, [isReady]);
|
}, [isReady]);
|
||||||
|
|
||||||
const onProgress = async (e) => {
|
const onProgress = async (e) => {
|
||||||
|
if (!isSeeking) {
|
||||||
setProgress(e.played);
|
setProgress(e.played);
|
||||||
setCurrentTime(secToTicks(e.playedSeconds));
|
setCurrentTime(secToTicks(e.playedSeconds));
|
||||||
|
}
|
||||||
await getPlaystateApi(window.api).reportPlaybackProgress({
|
await getPlaystateApi(window.api).reportPlaybackProgress({
|
||||||
playbackProgressInfo: {
|
playbackProgressInfo: {
|
||||||
ItemId: itemId,
|
ItemId: itemId,
|
||||||
@@ -84,6 +107,7 @@ export const VideoPlayer = () => {
|
|||||||
PositionTicks: secToTicks(e.playedSeconds),
|
PositionTicks: secToTicks(e.playedSeconds),
|
||||||
PlaybackStartTimeTicks: startPosition,
|
PlaybackStartTimeTicks: startPosition,
|
||||||
VolumeLevel: volume * 100,
|
VolumeLevel: volume * 100,
|
||||||
|
IsPaused: !isPlaying,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -136,6 +160,10 @@ export const VideoPlayer = () => {
|
|||||||
}
|
}
|
||||||
}, [showControls]);
|
}, [showControls]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log(subtitleTracks);
|
||||||
|
}, [mySubtitle_arr]);
|
||||||
|
|
||||||
const handleKeyPress = useCallback((event) => {
|
const handleKeyPress = useCallback((event) => {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "ArrowRight":
|
case "ArrowRight":
|
||||||
@@ -229,6 +257,7 @@ export const VideoPlayer = () => {
|
|||||||
step={0.01}
|
step={0.01}
|
||||||
max={itemDuration}
|
max={itemDuration}
|
||||||
onChange={(e, newVal) => {
|
onChange={(e, newVal) => {
|
||||||
|
setIsSeeking(true);
|
||||||
setCurrentTime(newVal);
|
setCurrentTime(newVal);
|
||||||
}}
|
}}
|
||||||
onChangeCommitted={(e, newVal) => {
|
onChangeCommitted={(e, newVal) => {
|
||||||
@@ -236,6 +265,7 @@ export const VideoPlayer = () => {
|
|||||||
ticksToSec(newVal),
|
ticksToSec(newVal),
|
||||||
);
|
);
|
||||||
setCurrentTime(newVal);
|
setCurrentTime(newVal);
|
||||||
|
setIsSeeking(false);
|
||||||
}}
|
}}
|
||||||
valueLabelDisplay="auto"
|
valueLabelDisplay="auto"
|
||||||
valueLabelFormat={(value) =>
|
valueLabelFormat={(value) =>
|
||||||
@@ -315,33 +345,81 @@ export const VideoPlayer = () => {
|
|||||||
alignItems="center"
|
alignItems="center"
|
||||||
justifyContent="center"
|
justifyContent="center"
|
||||||
>
|
>
|
||||||
<Stack
|
<Box>
|
||||||
direction="row"
|
<Menu
|
||||||
width="15em"
|
anchorEl={speedMenuEl}
|
||||||
alignItems="center"
|
open={speedMenuState}
|
||||||
justifyContent="center"
|
onClose={() =>
|
||||||
gap={1}
|
setSpeedMenuEl(null)
|
||||||
|
}
|
||||||
|
MenuListProps={{
|
||||||
|
"aria-labelledby":
|
||||||
|
"lock-button",
|
||||||
|
role: "listbox",
|
||||||
|
}}
|
||||||
|
anchorOrigin={{
|
||||||
|
vertical: "bottom",
|
||||||
|
horizontal: "center",
|
||||||
|
}}
|
||||||
|
transformOrigin={{
|
||||||
|
vertical: "bottom",
|
||||||
|
horizontal: "center",
|
||||||
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
transition: "250ms background",
|
mb: 20,
|
||||||
borderRadius: 20,
|
}}
|
||||||
"&:hover": {
|
>
|
||||||
background: "rgb(0 0 0/0.5)",
|
{availableSpeeds.map(
|
||||||
backdropFilter: "blur(5px)",
|
(sspeed, index) => {
|
||||||
|
return (
|
||||||
|
<MenuItem
|
||||||
|
key={sspeed}
|
||||||
|
selected={
|
||||||
|
index ===
|
||||||
|
speed
|
||||||
|
}
|
||||||
|
onClick={() => {
|
||||||
|
setSpeed(
|
||||||
|
index,
|
||||||
|
);
|
||||||
|
setSpeedMenuEl(
|
||||||
|
null,
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
sx={{
|
||||||
|
width: 160,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{sspeed}x
|
||||||
|
</MenuItem>
|
||||||
|
);
|
||||||
},
|
},
|
||||||
}}
|
)}
|
||||||
onMouseOver={() => setShowVolume(true)}
|
</Menu>
|
||||||
onMouseOut={() => setShowVolume(false)}
|
<IconButton
|
||||||
padding="0.25em 1em"
|
onClick={(e) =>
|
||||||
|
setSpeedMenuEl(
|
||||||
|
e.currentTarget,
|
||||||
|
)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<Grow
|
<MdiPlaySpeed />
|
||||||
style={{
|
</IconButton>
|
||||||
transformOrigin:
|
</Box>
|
||||||
" right center",
|
<IconButton
|
||||||
|
sx={{
|
||||||
|
ml: 0.1,
|
||||||
}}
|
}}
|
||||||
in={showVolume}
|
onClick={() => setIsMuted(!isMuted)}
|
||||||
>
|
>
|
||||||
|
{isMuted ? (
|
||||||
|
<MdiVolumeOff />
|
||||||
|
) : (
|
||||||
|
<MdiVolumeHigh />
|
||||||
|
)}
|
||||||
|
</IconButton>
|
||||||
<Slider
|
<Slider
|
||||||
value={volume * 100}
|
value={isMuted ? 0 : volume * 100}
|
||||||
step={1}
|
step={1}
|
||||||
max={100}
|
max={100}
|
||||||
onChange={(e, newVal) =>
|
onChange={(e, newVal) =>
|
||||||
@@ -352,17 +430,17 @@ export const VideoPlayer = () => {
|
|||||||
Math.floor(value)
|
Math.floor(value)
|
||||||
}
|
}
|
||||||
sx={{
|
sx={{
|
||||||
"& .MuiSlider-valueLabel":
|
mr: 1,
|
||||||
{
|
ml: 1,
|
||||||
|
width: "10em",
|
||||||
|
"& .MuiSlider-valueLabel": {
|
||||||
lineHeight: 1.2,
|
lineHeight: 1.2,
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
background:
|
background:
|
||||||
"rgb(0 0 0 / 0.5)",
|
"rgb(0 0 0 / 0.5)",
|
||||||
backdropFilter:
|
backdropFilter: "blur(5px)",
|
||||||
"blur(5px)",
|
|
||||||
padding: 1,
|
padding: 1,
|
||||||
borderRadius:
|
borderRadius: "10px",
|
||||||
"10px",
|
|
||||||
border: "1px solid rgb(255 255 255 / 0.15)",
|
border: "1px solid rgb(255 255 255 / 0.15)",
|
||||||
boxShadow:
|
boxShadow:
|
||||||
"0 0 10px rgb(0 0 0 / 0.4) ",
|
"0 0 10px rgb(0 0 0 / 0.4) ",
|
||||||
@@ -383,22 +461,7 @@ export const VideoPlayer = () => {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Grow>
|
|
||||||
<IconButton
|
|
||||||
sx={{
|
|
||||||
ml: 0.1,
|
|
||||||
}}
|
|
||||||
onClick={() =>
|
|
||||||
setIsMuted(!isMuted)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{isMuted ? (
|
|
||||||
<MdiVolumeOff />
|
|
||||||
) : (
|
|
||||||
<MdiVolumeHigh />
|
|
||||||
)}
|
|
||||||
</IconButton>
|
|
||||||
</Stack>
|
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsPIP(!isPIP);
|
setIsPIP(!isPIP);
|
||||||
@@ -439,6 +502,22 @@ export const VideoPlayer = () => {
|
|||||||
volume={volume}
|
volume={volume}
|
||||||
onBuffer={() => setIsBuffering(true)}
|
onBuffer={() => setIsBuffering(true)}
|
||||||
onBufferEnd={() => setIsBuffering(false)}
|
onBufferEnd={() => setIsBuffering(false)}
|
||||||
|
config={{
|
||||||
|
file: {
|
||||||
|
attributes: {
|
||||||
|
crossOrigin: "true",
|
||||||
|
},
|
||||||
|
tracks: [
|
||||||
|
{
|
||||||
|
kind: "subtitles",
|
||||||
|
src: `http://localhost:8096/Videos/${itemId}/${itemId}/Subtitles/0/0/Stream.vtt?api_key=${window.api.accessToken}`,
|
||||||
|
srcLang: "en",
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
playbackRate={availableSpeeds[speed]}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,3 +9,16 @@
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
video {
|
||||||
|
&::-webkit-media-text-track-display {
|
||||||
|
overflow: visible !important;
|
||||||
|
}
|
||||||
|
&::cue {
|
||||||
|
text-shadow: 0 2px 10px rgb(0 0 0 / 0.8);
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
&::cue(i) {
|
||||||
|
text-shadow: 0 2px 10px rgb(0 0 0 / 0.8);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,9 +8,22 @@ export const usePlaybackStore = create((set) => ({
|
|||||||
duration: 0,
|
duration: 0,
|
||||||
itemId: "",
|
itemId: "",
|
||||||
itemName: "",
|
itemName: "",
|
||||||
|
subtitleTracks: [],
|
||||||
setUrl: (aurl) => set((state) => ({ ...state, url: aurl })),
|
setUrl: (aurl) => set((state) => ({ ...state, url: aurl })),
|
||||||
setPosition: (apos) => set((state) => ({ ...state, startPosition: apos })),
|
setPosition: (apos) => set((state) => ({ ...state, startPosition: apos })),
|
||||||
setDuration: (adur) => set((state) => ({ ...state, duration: adur })),
|
setDuration: (adur) => set((state) => ({ ...state, duration: adur })),
|
||||||
setItemId: (aid) => set((state) => ({ ...state, itemId: aid })),
|
setItemId: (aid) => set((state) => ({ ...state, itemId: aid })),
|
||||||
setItemName: (anm) => set((state) => ({ ...state, itemName: anm })),
|
setItemName: (anm) => set((state) => ({ ...state, itemName: anm })),
|
||||||
|
setSubtitleTracks: (asub) =>
|
||||||
|
set((state) => ({
|
||||||
|
...state,
|
||||||
|
subtitleTracks: [
|
||||||
|
{
|
||||||
|
kind: "subtitles",
|
||||||
|
src: `http://localhost:8096/Videos/e2d0ae00-f458-d4d4-7e09-1768ca0f485c/e2d0ae00f458d4d47e091768ca0f485c/Subtitles/0/0/Stream.vtt?api_key=${window.api.accessToken}`,
|
||||||
|
srcLang: "en",
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})),
|
||||||
}));
|
}));
|
||||||
Reference in new issue
Block a user