Compare commits
37
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e81f4f6c56 | ||
|
|
fea68f8cab | ||
|
|
ce4b635d78 | ||
|
|
83ebd5de7e | ||
|
|
3f44e5fc96 | ||
|
|
39ad113573 | ||
|
|
9ff7482aea | ||
|
|
36e3d2a7cb | ||
|
|
691d5e0157 | ||
|
|
94986db688 | ||
|
|
9bf0b25662 | ||
|
|
42ca912ca7 | ||
|
|
6ac3383f6e | ||
|
|
922d956565 | ||
|
|
ca527548d1 | ||
|
|
e16a6c2415 | ||
|
|
c60b1e416e | ||
|
|
df7994b4b2 | ||
|
|
03e72d81da | ||
|
|
c8a7f8a632 | ||
|
|
d9644f325c | ||
|
|
38dde2a63d | ||
|
|
8aef2fc22d | ||
|
|
458890ba35 | ||
|
|
8d9d38fa39 | ||
|
|
957f9b53bb | ||
|
|
02d412a9b6 | ||
|
|
e4ade5659c | ||
|
|
19ff2af29b | ||
|
|
3c058928cb | ||
|
|
25ac859efd | ||
|
|
5b2968b5bf | ||
|
|
6cccd12a41 | ||
|
|
3ea75c8308 | ||
|
|
2ce1cd688d | ||
|
|
756d8d7f4b | ||
|
|
3738d81fab |
No files matched your search
Generated
+468
-747
File diff suppressed because it is too large.
Load diff
+12
-14
@@ -10,21 +10,20 @@
|
|||||||
"tauri": "tauri"
|
"tauri": "tauri"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.10.5",
|
"@emotion/react": "^11.11.1",
|
||||||
"@emotion/styled": "^11.10.5",
|
"@emotion/styled": "^11.10.5",
|
||||||
"@fontsource/open-sans": "^4.5.13",
|
"@fontsource/open-sans": "^5.0.3",
|
||||||
"@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.134",
|
||||||
"@mui/material": "^5.11.16",
|
"@mui/material": "^5.13.0",
|
||||||
"@tanstack/react-query": "^4.26.1",
|
"@tanstack/react-query": "^4.26.1",
|
||||||
"@tanstack/react-query-devtools": "^4.29.3",
|
"@tanstack/react-query-devtools": "^4.29.19",
|
||||||
"@tauri-apps/api": "^1.2.0",
|
"@tauri-apps/api": "^1.4.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",
|
||||||
"framer-motion": "^10.12.4",
|
"framer-motion": "^10.12.10",
|
||||||
"notistack": "^3.0.1",
|
"notistack": "^3.0.1",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-blurhash": "^0.3.0",
|
"react-blurhash": "^0.3.0",
|
||||||
@@ -33,19 +32,18 @@
|
|||||||
"react-material-ui-carousel": "^3.4.2",
|
"react-material-ui-carousel": "^3.4.2",
|
||||||
"react-multi-carousel": "^2.8.3",
|
"react-multi-carousel": "^2.8.3",
|
||||||
"react-player": "^2.12.0",
|
"react-player": "^2.12.0",
|
||||||
"react-router-dom": "^6.11.0",
|
"react-router-dom": "^6.14.0",
|
||||||
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",
|
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",
|
||||||
"uuid": "^9.0.0",
|
"uuid": "^9.0.0",
|
||||||
"vite-plugin-svgr": "^3.2.0",
|
"vite-plugin-svgr": "^3.2.0",
|
||||||
"zustand": "^4.3.8"
|
"zustand": "^4.3.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tauri-apps/cli": "^1.2.2",
|
"@tauri-apps/cli": "^1.3.1",
|
||||||
"@types/react": "^18.2.0",
|
"@types/react": "^18.2.11",
|
||||||
"@types/react-dom": "^18.2.1",
|
"@types/react-dom": "^18.2.6",
|
||||||
"@vitejs/plugin-react": "^4.0.0",
|
"@vitejs/plugin-react": "^4.0.0",
|
||||||
"sass": "^1.62.1",
|
"sass": "^1.63.3",
|
||||||
"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 |
@@ -90,11 +90,6 @@
|
|||||||
transform: scaleX(1) translateX(100%);
|
transform: scaleX(1) translateX(100%);
|
||||||
transform-origin: left;
|
transform-origin: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 100% {
|
|
||||||
transform: scaleX(0) translateX(-100%);
|
|
||||||
transform-origin: left;
|
|
||||||
} */
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ tauri-build = { version = "1.2.1", features = [] }
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
tauri = { version = "1.2.2", features = ["api-all", "devtools"] }
|
tauri = { version = "1.2.2", features = ["devtools", "http-all", "process-exit", "process-relaunch", "shell-all", "window-set-fullscreen"] }
|
||||||
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||||
tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
|
tauri-plugin-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
|
||||||
portpicker = "0.1" # used in the example to pick a random free port
|
portpicker = "0.1" # used in the example to pick a random free port
|
||||||
|
|||||||
-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;
|
|
||||||
}
|
|
||||||
+12
-20
@@ -1,6 +1,8 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
|
|
||||||
import React, { useState } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
|
|
||||||
|
import { appWindow } from "@tauri-apps/api/window";
|
||||||
|
|
||||||
import Konami from "react-konami-code";
|
import Konami from "react-konami-code";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@@ -68,8 +70,8 @@ import { version as appVer } from "../package.json";
|
|||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
import { delServer, getServer } from "./utils/storage/servers.js";
|
import { delServer, getServer } from "./utils/storage/servers.js";
|
||||||
import { delUser, getUser } from "./utils/storage/user.js";
|
import { delUser, getUser } from "./utils/storage/user.js";
|
||||||
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api.js";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import axios from "axios";
|
||||||
|
|
||||||
const jellyfin = new Jellyfin({
|
const jellyfin = new Jellyfin({
|
||||||
clientInfo: {
|
clientInfo: {
|
||||||
@@ -182,6 +184,7 @@ function App() {
|
|||||||
enqueueSnackbar("Unable to verfiy server address.", {
|
enqueueSnackbar("Unable to verfiy server address.", {
|
||||||
variant: "error",
|
variant: "error",
|
||||||
});
|
});
|
||||||
|
console.error(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -243,13 +246,13 @@ function App() {
|
|||||||
if (reason && reason == "backdropClick") {
|
if (reason && reason == "backdropClick") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let result = await relaunch();
|
await relaunch();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRemoveServer = async () => {
|
const handleRemoveServer = async () => {
|
||||||
await delServer();
|
await delServer();
|
||||||
await delUser();
|
await delUser();
|
||||||
let result = await relaunch();
|
await relaunch();
|
||||||
};
|
};
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|
||||||
@@ -271,23 +274,13 @@ function App() {
|
|||||||
setEasterEgg(true);
|
setEasterEgg(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
appWindow.setFullscreen(false);
|
||||||
|
}, [location]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SnackbarProvider maxSnack={5}>
|
<SnackbarProvider maxSnack={5}>
|
||||||
<ThemeProvider theme={theme}>
|
<ThemeProvider theme={theme}>
|
||||||
{pingServer.isLoading && (
|
|
||||||
<Box
|
|
||||||
sx={{
|
|
||||||
display: "flex",
|
|
||||||
width: "100%",
|
|
||||||
height: "100vh",
|
|
||||||
justifyContent: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<CircularProgress />
|
|
||||||
</Box>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Kon resetDelay={1000} action={sixtyNine}></Kon>
|
<Kon resetDelay={1000} action={sixtyNine}></Kon>
|
||||||
<Dialog
|
<Dialog
|
||||||
open={easterEgg}
|
open={easterEgg}
|
||||||
@@ -404,7 +397,6 @@ function App() {
|
|||||||
</Routes>
|
</Routes>
|
||||||
</div>
|
</div>
|
||||||
</AnimatePresence>
|
</AnimatePresence>
|
||||||
<ReactQueryDevtools />
|
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
</SnackbarProvider>
|
</SnackbarProvider>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
|
import { relaunch } from "@tauri-apps/api/process";
|
||||||
|
|
||||||
import MuiAppBar from "@mui/material/AppBar";
|
import MuiAppBar from "@mui/material/AppBar";
|
||||||
import TextField from "@mui/material/TextField";
|
import TextField from "@mui/material/TextField";
|
||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
@@ -26,6 +28,11 @@ import { MdiHeartOutline } from "../icons/mdiHeartOutline";
|
|||||||
import { MdiArrowLeft } from "../icons/mdiArrowLeft";
|
import { MdiArrowLeft } from "../icons/mdiArrowLeft";
|
||||||
import { MdiCog } from "../icons/mdiCog";
|
import { MdiCog } from "../icons/mdiCog";
|
||||||
import { MdiInformation } from "../icons/mdiInformation";
|
import { MdiInformation } from "../icons/mdiInformation";
|
||||||
|
import { MdiMenu } from "../icons/mdiMenu";
|
||||||
|
import { useDrawerStore } from "../../utils/store/drawer";
|
||||||
|
import { delServer } from "../../utils/storage/servers";
|
||||||
|
import { delUser } from "../../utils/storage/user";
|
||||||
|
import { MdiDelete } from "../icons/mdiDelete";
|
||||||
|
|
||||||
export const AppBar = () => {
|
export const AppBar = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -59,6 +66,12 @@ export const AppBar = () => {
|
|||||||
setAnchorEl(null);
|
setAnchorEl(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [setDrawerOpen] = useDrawerStore((state) => [state.setOpen]);
|
||||||
|
|
||||||
|
const handleDrawerOpen = () => {
|
||||||
|
setDrawerOpen(true);
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
location.pathname.includes("login") ||
|
location.pathname.includes("login") ||
|
||||||
@@ -87,13 +100,18 @@ export const AppBar = () => {
|
|||||||
return (
|
return (
|
||||||
<MuiAppBar
|
<MuiAppBar
|
||||||
sx={{
|
sx={{
|
||||||
width: `calc(100vw - ${theme.spacing(7)})`,
|
|
||||||
backgroundColor: "transparent",
|
backgroundColor: "transparent",
|
||||||
|
paddingRight: "0 !important",
|
||||||
}}
|
}}
|
||||||
className={trigger ? "appBar backdropVisible" : "appBar"}
|
className={trigger ? "appBar backdropVisible" : "appBar"}
|
||||||
elevation={0}
|
elevation={0}
|
||||||
>
|
>
|
||||||
<Toolbar sx={{ justifyContent: "space-between" }}>
|
<Toolbar
|
||||||
|
sx={{
|
||||||
|
justifyContent: "space-between",
|
||||||
|
paddingLeft: "12px !important",
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
@@ -101,6 +119,13 @@ export const AppBar = () => {
|
|||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<IconButton
|
||||||
|
color="inherit"
|
||||||
|
aria-label="open drawer"
|
||||||
|
onClick={handleDrawerOpen}
|
||||||
|
>
|
||||||
|
<MdiMenu />
|
||||||
|
</IconButton>
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => navigate(-1)}
|
onClick={() => navigate(-1)}
|
||||||
sx={{
|
sx={{
|
||||||
@@ -109,6 +134,7 @@ export const AppBar = () => {
|
|||||||
? "scale(1)"
|
? "scale(1)"
|
||||||
: "scale(0)",
|
: "scale(0)",
|
||||||
transformOrigin: "left",
|
transformOrigin: "left",
|
||||||
|
ml: 2,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<MdiArrowLeft />
|
<MdiArrowLeft />
|
||||||
@@ -175,6 +201,18 @@ export const AppBar = () => {
|
|||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
About
|
About
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem
|
||||||
|
onClick={async () => {
|
||||||
|
await delServer();
|
||||||
|
await delUser();
|
||||||
|
await relaunch();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ListItemIcon>
|
||||||
|
<MdiDelete />
|
||||||
|
</ListItemIcon>
|
||||||
|
Remove Server
|
||||||
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
</Box>
|
</Box>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
|
|||||||
@@ -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,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiBackburger } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiBackburger = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiBackburger}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiClose } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiClose = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiClose}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiDelete } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiDelete = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiDelete}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiFullscreen } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiFullscreen = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiFullscreen}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiFullscreenExit } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiFullscreenExit = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiFullscreenExit}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
/** @format */
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiPictureInPictureBottomRight } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiPictureInPictureBottomRight = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiPictureInPictureBottomRight}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -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>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiVolumeHigh } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiVolumeHigh = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiVolumeHigh}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import SvgIcon from "@mui/material/SvgIcon";
|
||||||
|
|
||||||
|
import { mdiVolumeOff } from "@mdi/js";
|
||||||
|
|
||||||
|
export const MdiVolumeOff = (props) => {
|
||||||
|
return (
|
||||||
|
<SvgIcon {...props}>
|
||||||
|
<path d={mdiVolumeOff}></path>
|
||||||
|
</SvgIcon>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -19,8 +19,11 @@ import { Link } from "react-router-dom";
|
|||||||
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||||
import { MdiClockOutline } from "../../icons/mdiClockOutline";
|
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
|
||||||
|
|
||||||
import { getRuntimeMusic } from "../../../utils/date/time";
|
import { getRuntimeMusic } from "../../../utils/date/time";
|
||||||
|
|
||||||
|
import { MdiClockOutline } from "../../icons/mdiClockOutline";
|
||||||
import { MdiHeart } from "../../icons/mdiHeart";
|
import { MdiHeart } from "../../icons/mdiHeart";
|
||||||
import { MdiHeartOutline } from "../../icons/mdiHeartOutline";
|
import { MdiHeartOutline } from "../../icons/mdiHeartOutline";
|
||||||
import { MdiAlbum } from "../../icons/mdiAlbum";
|
import { MdiAlbum } from "../../icons/mdiAlbum";
|
||||||
@@ -44,12 +47,12 @@ export const ArtistAlbum = ({ user, album, boxProps }) => {
|
|||||||
let result;
|
let result;
|
||||||
if (track.UserData.IsFavorite) {
|
if (track.UserData.IsFavorite) {
|
||||||
result = await getUserLibraryApi(window.api).unmarkFavoriteItem({
|
result = await getUserLibraryApi(window.api).unmarkFavoriteItem({
|
||||||
userId: user.data.Id,
|
userId: user.Id,
|
||||||
itemId: track.Id,
|
itemId: track.Id,
|
||||||
});
|
});
|
||||||
} else if (!track.UserData.IsFavorite) {
|
} else if (!track.UserData.IsFavorite) {
|
||||||
result = await getUserLibraryApi(window.api).markFavoriteItem({
|
result = await getUserLibraryApi(window.api).markFavoriteItem({
|
||||||
userId: user.data.Id,
|
userId: user.Id,
|
||||||
itemId: track.Id,
|
itemId: track.Id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,9 @@ import ListItemButton from "@mui/material/ListItemButton";
|
|||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import Divider from "@mui/material/Divider";
|
import Divider from "@mui/material/Divider";
|
||||||
import MuiDrawer from "@mui/material/Drawer";
|
import MuiDrawer from "@mui/material/Drawer";
|
||||||
|
import ListItemText from "@mui/material/ListItemText";
|
||||||
|
|
||||||
import { MdiMenu } from "../icons/mdiMenu";
|
import { MdiClose } from "../icons/mdiClose";
|
||||||
import { MdiLogoutVariant } from "../icons/mdiLogoutVariant";
|
import { MdiLogoutVariant } from "../icons/mdiLogoutVariant";
|
||||||
|
|
||||||
import { MediaCollectionTypeIconCollection } from "../../components/utils/iconsCollection.jsx";
|
import { MediaCollectionTypeIconCollection } from "../../components/utils/iconsCollection.jsx";
|
||||||
@@ -31,6 +32,7 @@ import { MdiHomeVariantOutline } from "../icons/mdiHomeVariantOutline";
|
|||||||
import { EventEmitter as event } from "../../eventEmitter.js";
|
import { EventEmitter as event } from "../../eventEmitter.js";
|
||||||
|
|
||||||
import "./sidemenu.module.scss";
|
import "./sidemenu.module.scss";
|
||||||
|
import { useDrawerStore } from "../../utils/store/drawer";
|
||||||
|
|
||||||
const drawerWidth = 320;
|
const drawerWidth = 320;
|
||||||
|
|
||||||
@@ -78,7 +80,6 @@ export const SideMenu = ({}) => {
|
|||||||
enabled: !!user.data,
|
enabled: !!user.data,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
const handleDrawerOpen = () => {};
|
|
||||||
|
|
||||||
const handleLogout = async () => {
|
const handleLogout = async () => {
|
||||||
console.log("Logging out user...");
|
console.log("Logging out user...");
|
||||||
@@ -102,12 +103,18 @@ export const SideMenu = ({}) => {
|
|||||||
}
|
}
|
||||||
}, [location]);
|
}, [location]);
|
||||||
|
|
||||||
|
const [open, setDrawerOpen] = useDrawerStore((state) => [
|
||||||
|
state.open,
|
||||||
|
state.setOpen,
|
||||||
|
]);
|
||||||
|
|
||||||
if (!display) {
|
if (!display) {
|
||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (display) {
|
if (display) {
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<MiniDrawer
|
<MiniDrawer
|
||||||
variant="permanent"
|
variant="permanent"
|
||||||
open={false}
|
open={false}
|
||||||
@@ -117,6 +124,7 @@ export const SideMenu = ({}) => {
|
|||||||
border: "none",
|
border: "none",
|
||||||
width: `calc(${theme.spacing(7)} + 10px)`,
|
width: `calc(${theme.spacing(7)} + 10px)`,
|
||||||
height: "100vh",
|
height: "100vh",
|
||||||
|
zIndex: "1",
|
||||||
// display: visible ? "block" : "none",
|
// display: visible ? "block" : "none",
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
@@ -130,19 +138,168 @@ export const SideMenu = ({}) => {
|
|||||||
sx={{
|
sx={{
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
}}
|
}}
|
||||||
|
></DrawerHeader>
|
||||||
|
<Divider />
|
||||||
|
{libraries.isLoading ? (
|
||||||
|
<>
|
||||||
|
<Skeleton
|
||||||
|
height="100%"
|
||||||
|
variant="rounded"
|
||||||
|
width="calc(100% - 10px )"
|
||||||
|
sx={{ margin: "5px" }}
|
||||||
|
></Skeleton>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<List sx={{ border: "none" }}>
|
||||||
|
{libraries.data.Items.map(
|
||||||
|
(library, index) => {
|
||||||
|
return (
|
||||||
|
<Tooltip
|
||||||
|
title={library.Name}
|
||||||
|
placement="right"
|
||||||
|
arrow
|
||||||
|
followCursor
|
||||||
|
key={index}
|
||||||
>
|
>
|
||||||
{/* <div>
|
<ListItem
|
||||||
<Avatar src={""}/>
|
className="sidemenu-item-container"
|
||||||
<Typography variant="h3">
|
disablePadding
|
||||||
{user["Name"]}
|
|
||||||
</Typography>
|
|
||||||
</div> */}
|
|
||||||
<IconButton
|
|
||||||
color="inherit"
|
|
||||||
aria-label="open drawer"
|
|
||||||
onClick={handleDrawerOpen}
|
|
||||||
>
|
>
|
||||||
<MdiMenu />
|
<ListItemButton
|
||||||
|
component={
|
||||||
|
NavLink
|
||||||
|
}
|
||||||
|
to={
|
||||||
|
"/library/" +
|
||||||
|
library.Id
|
||||||
|
}
|
||||||
|
className="sidemenu-item"
|
||||||
|
sx={{
|
||||||
|
minHeight: 48,
|
||||||
|
justifyContent:
|
||||||
|
"center",
|
||||||
|
px: 2.5,
|
||||||
|
display: "flex",
|
||||||
|
flexDirection:
|
||||||
|
"column",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ListItemIcon
|
||||||
|
sx={{
|
||||||
|
minWidth: 0,
|
||||||
|
justifyContent:
|
||||||
|
"center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{
|
||||||
|
MediaCollectionTypeIconCollection[
|
||||||
|
library
|
||||||
|
.CollectionType
|
||||||
|
]
|
||||||
|
}
|
||||||
|
</ListItemIcon>
|
||||||
|
</ListItemButton>
|
||||||
|
</ListItem>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
</List>
|
||||||
|
<List sx={{ marginTop: "auto" }}>
|
||||||
|
<Divider />
|
||||||
|
<Tooltip
|
||||||
|
title="Home"
|
||||||
|
placement="right"
|
||||||
|
followCursor
|
||||||
|
arrow
|
||||||
|
>
|
||||||
|
<ListItem
|
||||||
|
className="sidemenu-item-container"
|
||||||
|
disablePadding
|
||||||
|
>
|
||||||
|
<ListItemButton
|
||||||
|
component={NavLink}
|
||||||
|
to="/home"
|
||||||
|
className="sidemenu-item"
|
||||||
|
sx={{
|
||||||
|
minHeight: 48,
|
||||||
|
justifyContent:
|
||||||
|
"center",
|
||||||
|
px: 2.5,
|
||||||
|
display: "flex",
|
||||||
|
flexDirection:
|
||||||
|
"column",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ListItemIcon
|
||||||
|
sx={{
|
||||||
|
minWidth: 0,
|
||||||
|
justifyContent:
|
||||||
|
"center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MdiHomeVariantOutline />
|
||||||
|
</ListItemIcon>
|
||||||
|
</ListItemButton>
|
||||||
|
</ListItem>
|
||||||
|
</Tooltip>
|
||||||
|
<Tooltip
|
||||||
|
title="Logout"
|
||||||
|
placement="right"
|
||||||
|
followCursor
|
||||||
|
arrow
|
||||||
|
>
|
||||||
|
<ListItem disablePadding>
|
||||||
|
<ListItemButton
|
||||||
|
sx={{
|
||||||
|
minHeight: 48,
|
||||||
|
justifyContent:
|
||||||
|
"center",
|
||||||
|
px: 2.5,
|
||||||
|
}}
|
||||||
|
onClick={handleLogout}
|
||||||
|
>
|
||||||
|
<ListItemIcon
|
||||||
|
sx={{
|
||||||
|
minWidth: 0,
|
||||||
|
justifyContent:
|
||||||
|
"center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MdiLogoutVariant></MdiLogoutVariant>
|
||||||
|
</ListItemIcon>
|
||||||
|
</ListItemButton>
|
||||||
|
</ListItem>
|
||||||
|
</Tooltip>
|
||||||
|
</List>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</MiniDrawer>
|
||||||
|
|
||||||
|
<MuiDrawer
|
||||||
|
open={open}
|
||||||
|
variant="persistent"
|
||||||
|
onClose={() => setDrawerOpen(false)}
|
||||||
|
elevation={0}
|
||||||
|
PaperProps={{
|
||||||
|
sx: {
|
||||||
|
background: "rgb(0 0 0 / 0.5)",
|
||||||
|
backdropFilter: "blur(10px)",
|
||||||
|
boxShadow: "0 0 15px rgb(0 0 0 / 0.2)",
|
||||||
|
width: 260,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
className="sidemenu-open"
|
||||||
|
>
|
||||||
|
<DrawerHeader
|
||||||
|
className="Mui-DrawerHeader"
|
||||||
|
sx={{
|
||||||
|
justifyContent: "flex-start",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<IconButton onClick={() => setDrawerOpen(false)}>
|
||||||
|
<MdiClose />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</DrawerHeader>
|
</DrawerHeader>
|
||||||
<Divider />
|
<Divider />
|
||||||
@@ -193,6 +350,7 @@ export const SideMenu = ({}) => {
|
|||||||
minWidth: 0,
|
minWidth: 0,
|
||||||
justifyContent:
|
justifyContent:
|
||||||
"center",
|
"center",
|
||||||
|
mr: 2,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
@@ -202,6 +360,11 @@ export const SideMenu = ({}) => {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
|
<ListItemText>
|
||||||
|
{
|
||||||
|
library.Name
|
||||||
|
}
|
||||||
|
</ListItemText>
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@@ -210,6 +373,7 @@ export const SideMenu = ({}) => {
|
|||||||
)}
|
)}
|
||||||
</List>
|
</List>
|
||||||
<List sx={{ marginTop: "auto" }}>
|
<List sx={{ marginTop: "auto" }}>
|
||||||
|
<Divider />
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title="Home"
|
title="Home"
|
||||||
placement="right"
|
placement="right"
|
||||||
@@ -226,7 +390,8 @@ export const SideMenu = ({}) => {
|
|||||||
className="sidemenu-item"
|
className="sidemenu-item"
|
||||||
sx={{
|
sx={{
|
||||||
minHeight: 48,
|
minHeight: 48,
|
||||||
justifyContent: "center",
|
justifyContent:
|
||||||
|
"center",
|
||||||
px: 2.5,
|
px: 2.5,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -235,10 +400,14 @@ export const SideMenu = ({}) => {
|
|||||||
minWidth: 0,
|
minWidth: 0,
|
||||||
justifyContent:
|
justifyContent:
|
||||||
"center",
|
"center",
|
||||||
|
mr: 2,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<MdiHomeVariantOutline />
|
<MdiHomeVariantOutline />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
|
<ListItemText>
|
||||||
|
Home
|
||||||
|
</ListItemText>
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@@ -252,7 +421,8 @@ export const SideMenu = ({}) => {
|
|||||||
<ListItemButton
|
<ListItemButton
|
||||||
sx={{
|
sx={{
|
||||||
minHeight: 48,
|
minHeight: 48,
|
||||||
justifyContent: "center",
|
justifyContent:
|
||||||
|
"center",
|
||||||
px: 2.5,
|
px: 2.5,
|
||||||
}}
|
}}
|
||||||
onClick={handleLogout}
|
onClick={handleLogout}
|
||||||
@@ -262,17 +432,22 @@ export const SideMenu = ({}) => {
|
|||||||
minWidth: 0,
|
minWidth: 0,
|
||||||
justifyContent:
|
justifyContent:
|
||||||
"center",
|
"center",
|
||||||
|
mr: 2,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<MdiLogoutVariant></MdiLogoutVariant>
|
<MdiLogoutVariant></MdiLogoutVariant>
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
|
<ListItemText>
|
||||||
|
Logout
|
||||||
|
</ListItemText>
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</List>
|
</List>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</MiniDrawer>
|
</MuiDrawer>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -26,4 +26,12 @@
|
|||||||
transform: translateX(0);
|
transform: translateX(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&-open {
|
||||||
|
.sidemenu-item::before {
|
||||||
|
width: 100%;
|
||||||
|
inset: 0;
|
||||||
|
border-radius: 0;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,7 @@ export const EmptyNotice = () => {
|
|||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
height: "100%",
|
height: "100vh",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export const ErrorNotice = () => {
|
|||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
height: "100%",
|
height: "100vh",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ export const MediaTypeIconCollection = {
|
|||||||
Audio: <MdiMicrophone className="hero-carousel-background-icon" />,
|
Audio: <MdiMicrophone className="hero-carousel-background-icon" />,
|
||||||
Photo: <MdiImage className="hero-carousel-background-icon" />,
|
Photo: <MdiImage className="hero-carousel-background-icon" />,
|
||||||
Book: <MdiBook className="hero-carousel-background-icon" />,
|
Book: <MdiBook className="hero-carousel-background-icon" />,
|
||||||
|
MusicAlbum: <MdiAlbum className="hero-carousel-background-icon" />,
|
||||||
|
AudioBook: <MdiBookMusic className="hero-carousel-background-icon" />,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const TypeIconCollectionCard = {
|
export const TypeIconCollectionCard = {
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
-webkit-line-clamp: 2;
|
-webkit-line-clamp: 2;
|
||||||
margin-bottom: 0.5em;
|
margin-bottom: 0.5em;
|
||||||
&-logo {
|
&-logo {
|
||||||
max-width: 10em;
|
max-width: 12em;
|
||||||
height: 2em;
|
height: 2em;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
object-position: bottom;
|
object-position: bottom;
|
||||||
|
|||||||
+13
-11
@@ -96,7 +96,13 @@ const Home = () => {
|
|||||||
{
|
{
|
||||||
userId: user.data.Id,
|
userId: user.data.Id,
|
||||||
fields: [ItemFields.Overview, ItemFields.ParentId],
|
fields: [ItemFields.Overview, ItemFields.ParentId],
|
||||||
|
includeItemTypes: [
|
||||||
|
BaseItemKind.Series,
|
||||||
|
BaseItemKind.Movie,
|
||||||
|
BaseItemKind.AudioBook,
|
||||||
|
],
|
||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
|
limit: 16,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
return media.data;
|
return media.data;
|
||||||
@@ -111,7 +117,7 @@ const Home = () => {
|
|||||||
const resumeItems = await getItemsApi(window.api).getResumeItems(
|
const resumeItems = await getItemsApi(window.api).getResumeItems(
|
||||||
{
|
{
|
||||||
userId: user.data.Id,
|
userId: user.data.Id,
|
||||||
limit: 16,
|
limit: 10,
|
||||||
mediaTypes: ["Video"],
|
mediaTypes: ["Video"],
|
||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
},
|
},
|
||||||
@@ -128,7 +134,7 @@ const Home = () => {
|
|||||||
const resumeItems = await getItemsApi(window.api).getResumeItems(
|
const resumeItems = await getItemsApi(window.api).getResumeItems(
|
||||||
{
|
{
|
||||||
userId: user.data.Id,
|
userId: user.data.Id,
|
||||||
limit: 16,
|
limit: 10,
|
||||||
mediaTypes: ["Audio"],
|
mediaTypes: ["Audio"],
|
||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
},
|
},
|
||||||
@@ -144,7 +150,7 @@ const Home = () => {
|
|||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const upNext = await getTvShowsApi(window.api).getNextUp({
|
const upNext = await getTvShowsApi(window.api).getNextUp({
|
||||||
userId: user.data.Id,
|
userId: user.data.Id,
|
||||||
limit: 16,
|
limit: 10,
|
||||||
});
|
});
|
||||||
return upNext.data;
|
return upNext.data;
|
||||||
},
|
},
|
||||||
@@ -240,7 +246,7 @@ const Home = () => {
|
|||||||
<CarouselSkeleton />
|
<CarouselSkeleton />
|
||||||
) : (
|
) : (
|
||||||
// <></>
|
// <></>
|
||||||
latestMedia.data != null &&
|
latestMedia.data.length != 0 &&
|
||||||
latestMedia.data.map((item, index) => {
|
latestMedia.data.map((item, index) => {
|
||||||
return (
|
return (
|
||||||
<Paper
|
<Paper
|
||||||
@@ -254,12 +260,8 @@ const Home = () => {
|
|||||||
>
|
>
|
||||||
<div className="hero-carousel-background-container">
|
<div className="hero-carousel-background-container">
|
||||||
{item.Type ==
|
{item.Type ==
|
||||||
BaseItemKind.MusicAlbum ||
|
BaseItemKind.MusicAlbum ? (
|
||||||
item.Type ==
|
!!item.ParentBackdropItemId && (
|
||||||
BaseItemKind.Episode ? (
|
|
||||||
item
|
|
||||||
.ParentBackdropImageTags
|
|
||||||
.length != 0 && (
|
|
||||||
<>
|
<>
|
||||||
<Blurhash
|
<Blurhash
|
||||||
hash={
|
hash={
|
||||||
@@ -339,7 +341,7 @@ const Home = () => {
|
|||||||
<div className="hero-carousel-background-icon-container">
|
<div className="hero-carousel-background-icon-container">
|
||||||
{
|
{
|
||||||
MediaTypeIconCollection[
|
MediaTypeIconCollection[
|
||||||
item.MediaType
|
item.Type
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+72
-18
@@ -34,6 +34,7 @@ import { useParams, useNavigate, Link as RouterLink } from "react-router-dom";
|
|||||||
import {
|
import {
|
||||||
BaseItemKind,
|
BaseItemKind,
|
||||||
ItemFields,
|
ItemFields,
|
||||||
|
LocationType,
|
||||||
MediaStreamType,
|
MediaStreamType,
|
||||||
SortOrder,
|
SortOrder,
|
||||||
} from "@jellyfin/sdk/lib/generated-client";
|
} from "@jellyfin/sdk/lib/generated-client";
|
||||||
@@ -66,6 +67,7 @@ import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
|
|||||||
import { ArtistAlbum } from "../../components/layouts/artist/artistAlbum";
|
import { ArtistAlbum } from "../../components/layouts/artist/artistAlbum";
|
||||||
import { MdiMusic } from "../../components/icons/mdiMusic";
|
import { MdiMusic } from "../../components/icons/mdiMusic";
|
||||||
import { usePlaybackStore } from "../../utils/store/playback";
|
import { usePlaybackStore } from "../../utils/store/playback";
|
||||||
|
import { Tooltip } from "@mui/material";
|
||||||
function TabPanel(props) {
|
function TabPanel(props) {
|
||||||
const { children, value, index, ...other } = props;
|
const { children, value, index, ...other } = props;
|
||||||
|
|
||||||
@@ -168,6 +170,7 @@ const ItemDetail = () => {
|
|||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const result = await getTvShowsApi(window.api).getSeasons({
|
const result = await getTvShowsApi(window.api).getSeasons({
|
||||||
seriesId: item.data.Id,
|
seriesId: item.data.Id,
|
||||||
|
isSpecialSeason: false,
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
@@ -200,6 +203,7 @@ const ItemDetail = () => {
|
|||||||
userId: user.data.Id,
|
userId: user.data.Id,
|
||||||
parentId: seasons.data.Items[currentSeason].Id,
|
parentId: seasons.data.Items[currentSeason].Id,
|
||||||
fields: [ItemFields.SeasonUserData, "Overview"],
|
fields: [ItemFields.SeasonUserData, "Overview"],
|
||||||
|
excludeLocationTypes: [LocationType.Virtual],
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
@@ -505,20 +509,29 @@ const ItemDetail = () => {
|
|||||||
setAudioTracks(audios);
|
setAudioTracks(audios);
|
||||||
setSubtitleTracks(subs);
|
setSubtitleTracks(subs);
|
||||||
|
|
||||||
setCurrentVideoTrack(videos[0].DisplayTitle);
|
setCurrentVideoTrack(videos[0]?.Index);
|
||||||
setCurrentAudioTrack(audios[0].DisplayTitle);
|
setCurrentAudioTrack(audios[0]?.Index);
|
||||||
setCurrentSubTrack(subs[0].DisplayTitle);
|
setCurrentSubTrack(subs[0]?.Index);
|
||||||
}
|
}
|
||||||
}, [item.isSuccess]);
|
}, [item.isSuccess]);
|
||||||
|
|
||||||
const [setUrl, setPosition, setItemId, setItemName] = usePlaybackStore(
|
const [
|
||||||
(state) => [
|
setUrl,
|
||||||
|
setPosition,
|
||||||
|
setDuration,
|
||||||
|
setItemId,
|
||||||
|
setItemName,
|
||||||
|
setSubtitleTracksStore,
|
||||||
|
setSelectedSubtitleTrack,
|
||||||
|
] = usePlaybackStore((state) => [
|
||||||
state.setUrl,
|
state.setUrl,
|
||||||
state.setPosition,
|
state.setPosition,
|
||||||
|
state.setDuration,
|
||||||
state.setItemId,
|
state.setItemId,
|
||||||
state.setItemName,
|
state.setItemName,
|
||||||
],
|
state.setSubtitleTracks,
|
||||||
);
|
state.setSelectedSubtitleTrack,
|
||||||
|
]);
|
||||||
|
|
||||||
const [directors, setDirectors] = useState([]);
|
const [directors, setDirectors] = useState([]);
|
||||||
const [writers, setWriters] = useState([]);
|
const [writers, setWriters] = useState([]);
|
||||||
@@ -1004,7 +1017,25 @@ const ItemDetail = () => {
|
|||||||
"Music",
|
"Music",
|
||||||
) && (
|
) && (
|
||||||
<>
|
<>
|
||||||
|
<Tooltip
|
||||||
|
title={
|
||||||
|
item.data
|
||||||
|
.Type ==
|
||||||
|
"Series"
|
||||||
|
? "Work in progress, meanwhile you can play individual episodes by clicking on episode card below"
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<span>
|
||||||
<Button
|
<Button
|
||||||
|
disabled={
|
||||||
|
item
|
||||||
|
.data
|
||||||
|
.Type ==
|
||||||
|
"Series"
|
||||||
|
? true
|
||||||
|
: false
|
||||||
|
}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
size="large"
|
size="large"
|
||||||
startIcon={
|
startIcon={
|
||||||
@@ -1023,7 +1054,7 @@ const ItemDetail = () => {
|
|||||||
.VideoType
|
.VideoType
|
||||||
) {
|
) {
|
||||||
setUrl(
|
setUrl(
|
||||||
`${window.api.basePath}/Videos/${item.data.Id}/stream.${item.data.MediaSources[0].Container}?Static=true&mediaSourceId=${item.data.Id}&deviceId=${window.api.deviceInfo.id}&api_key=${window.api.accessToken}&Tag=${item.data.MediaSources[0].ETag}`,
|
`${window.api.basePath}/Videos/${item.data.Id}/stream.${item.data.MediaSources[0].Container}?Static=true&mediaSourceId=${item.data.Id}&deviceId=${window.api.deviceInfo.id}&api_key=${window.api.accessToken}&Tag=${item.data.MediaSources[0].ETag}&videoStreamIndex=${currentVideoTrack}&audioStreamIndex=${currentAudioTrack}`,
|
||||||
);
|
);
|
||||||
setPosition(
|
setPosition(
|
||||||
item
|
item
|
||||||
@@ -1033,6 +1064,11 @@ const ItemDetail = () => {
|
|||||||
);
|
);
|
||||||
setItemName(
|
setItemName(
|
||||||
item
|
item
|
||||||
|
.data
|
||||||
|
.Type ==
|
||||||
|
"Episode"
|
||||||
|
? `${item.data.SeriesName} S${item.data.ParentIndexNumber}:E${item.data.IndexNumber} ${item.data.Name}`
|
||||||
|
: item
|
||||||
.data
|
.data
|
||||||
.Name,
|
.Name,
|
||||||
);
|
);
|
||||||
@@ -1041,21 +1077,35 @@ const ItemDetail = () => {
|
|||||||
.data
|
.data
|
||||||
.Id,
|
.Id,
|
||||||
);
|
);
|
||||||
|
setDuration(
|
||||||
|
item
|
||||||
|
.data
|
||||||
|
.RunTimeTicks,
|
||||||
|
);
|
||||||
|
setSubtitleTracksStore(
|
||||||
|
subtitleTracks,
|
||||||
|
);
|
||||||
|
setSelectedSubtitleTrack(
|
||||||
|
currentSubTrack,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
navigate(
|
navigate(
|
||||||
`/player`,
|
`/player`,
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{!!item.data
|
{!!item
|
||||||
|
.data
|
||||||
.UserData
|
.UserData
|
||||||
.PlayedPercentage &&
|
.PlayedPercentage &&
|
||||||
item.data.UserData
|
item.data
|
||||||
|
.UserData
|
||||||
.PlayedPercentage >
|
.PlayedPercentage >
|
||||||
0
|
0
|
||||||
? "Resume"
|
? "Resume"
|
||||||
: "Play"}
|
: "Play"}
|
||||||
{!!item.data
|
{!!item
|
||||||
|
.data
|
||||||
.UserData
|
.UserData
|
||||||
.PlayedPercentage && (
|
.PlayedPercentage && (
|
||||||
<LinearProgress
|
<LinearProgress
|
||||||
@@ -1080,6 +1130,8 @@ const ItemDetail = () => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
|
</span>
|
||||||
|
</Tooltip>
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={
|
onClick={
|
||||||
@@ -1489,7 +1541,8 @@ const ItemDetail = () => {
|
|||||||
item.data.MediaStreams.length !=
|
item.data.MediaStreams.length !=
|
||||||
0 && (
|
0 && (
|
||||||
<>
|
<>
|
||||||
{videoTracks != [] && (
|
{videoTracks.length !=
|
||||||
|
0 && (
|
||||||
<TableRow
|
<TableRow
|
||||||
sx={{
|
sx={{
|
||||||
"& td, & th":
|
"& td, & th":
|
||||||
@@ -1549,7 +1602,7 @@ const ItemDetail = () => {
|
|||||||
sindex
|
sindex
|
||||||
}
|
}
|
||||||
value={
|
value={
|
||||||
stream.DisplayTitle
|
stream.Index
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
@@ -1563,7 +1616,8 @@ const ItemDetail = () => {
|
|||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
)}
|
)}
|
||||||
{audioTracks != [] && (
|
{audioTracks.length !=
|
||||||
|
0 && (
|
||||||
<TableRow
|
<TableRow
|
||||||
sx={{
|
sx={{
|
||||||
"& td, & th":
|
"& td, & th":
|
||||||
@@ -1619,7 +1673,7 @@ const ItemDetail = () => {
|
|||||||
sindex
|
sindex
|
||||||
}
|
}
|
||||||
value={
|
value={
|
||||||
stream.DisplayTitle
|
stream.Index
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
@@ -1633,8 +1687,8 @@ const ItemDetail = () => {
|
|||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
)}
|
)}
|
||||||
{subtitleTracks !=
|
{subtitleTracks.length !=
|
||||||
[] && (
|
0 && (
|
||||||
<TableRow
|
<TableRow
|
||||||
sx={{
|
sx={{
|
||||||
"& td, & th":
|
"& td, & th":
|
||||||
@@ -1690,7 +1744,7 @@ const ItemDetail = () => {
|
|||||||
sindex
|
sindex
|
||||||
}
|
}
|
||||||
value={
|
value={
|
||||||
stream.DisplayTitle
|
stream.Index
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -76,6 +76,7 @@
|
|||||||
&-title-logo {
|
&-title-logo {
|
||||||
filter: drop-shadow(0 0 10px rgb(0 0 0 /0.2));
|
filter: drop-shadow(0 0 10px rgb(0 0 0 /0.2));
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
max-height: 5em;
|
||||||
width: 45%;
|
width: 45%;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
object-position: bottom;
|
object-position: bottom;
|
||||||
|
|||||||
@@ -8,6 +8,13 @@ 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";
|
||||||
import Slider from "@mui/material/Slider";
|
import Slider from "@mui/material/Slider";
|
||||||
|
import CircularProgress from "@mui/material/CircularProgress";
|
||||||
|
import Menu from "@mui/material/Menu";
|
||||||
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
|
import TextField from "@mui/material/TextField";
|
||||||
|
import ListItem from "@mui/material/ListItem";
|
||||||
|
import ListItemText from "@mui/material/ListItemText";
|
||||||
|
import Backdrop from "@mui/material/Backdrop";
|
||||||
|
|
||||||
import ReactPlayer from "react-player";
|
import ReactPlayer from "react-player";
|
||||||
|
|
||||||
@@ -15,8 +22,8 @@ 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 { MdiPlay } from "../../components/icons/mdiPlay";
|
||||||
|
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useLocation, useNavigate } from "react-router-dom";
|
||||||
import { useRef, useState, useCallback } from "react";
|
import { useRef, useState, useCallback, useEffect } from "react";
|
||||||
import { secToTicks, ticksToSec } from "../../utils/date/time";
|
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";
|
||||||
@@ -25,18 +32,66 @@ import "./videoPlayer.module.scss";
|
|||||||
import { MdiPause } from "../../components/icons/mdiPause";
|
import { MdiPause } from "../../components/icons/mdiPause";
|
||||||
import { MdiFastForward } from "../../components/icons/mdiFastForward";
|
import { MdiFastForward } from "../../components/icons/mdiFastForward";
|
||||||
import { MdiRewind } from "../../components/icons/mdiRewind";
|
import { MdiRewind } from "../../components/icons/mdiRewind";
|
||||||
|
import { MdiFullscreen } from "../../components/icons/mdiFullscreen";
|
||||||
|
import { MdiFullscreenExit } from "../../components/icons/mdiFullscreenExit";
|
||||||
|
import { MdiPictureInPictureBottomRight } from "../../components/icons/mdiPictureInPictureBottomRight";
|
||||||
|
import { MdiVolumeHigh } from "../../components/icons/mdiVolumeHigh";
|
||||||
|
import { MdiVolumeOff } from "../../components/icons/mdiVolumeOff";
|
||||||
|
import { MdiPlaySpeed } from "../../components/icons/mdiPlaySpeed";
|
||||||
|
|
||||||
|
import { endsAt } from "../../utils/date/time";
|
||||||
|
|
||||||
|
import useKeyPress from "../../utils/hooks/useKeyPress";
|
||||||
|
import { MdiCog } from "../../components/icons/mdiCog";
|
||||||
|
|
||||||
export const VideoPlayer = () => {
|
export const VideoPlayer = () => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const [settingsMenuEl, setSettingsMenuEl] = useState(null);
|
||||||
|
const settingsMenuState = Boolean(settingsMenuEl);
|
||||||
|
|
||||||
|
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,
|
||||||
|
subtitleTracksStore,
|
||||||
|
selectedSubtitleTrack,
|
||||||
|
] = usePlaybackStore((state) => [
|
||||||
|
state.url,
|
||||||
|
state.startPosition,
|
||||||
|
state.duration,
|
||||||
|
state.itemId,
|
||||||
|
state.itemName,
|
||||||
|
state.subtitleTracks,
|
||||||
|
state.selectedSubtitleTrack,
|
||||||
|
]);
|
||||||
|
const [currentSubtrack, setCurrentSubtrack] = useState(
|
||||||
|
selectedSubtitleTrack,
|
||||||
|
);
|
||||||
|
|
||||||
|
const [showControls, setShowControls] = useState(false);
|
||||||
|
|
||||||
const playerRef = useRef();
|
const playerRef = useRef();
|
||||||
|
const [isSeeking, setIsSeeking] = useState(false);
|
||||||
|
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);
|
||||||
const [isReady, setIsReady] = useState(false);
|
const [isReady, setIsReady] = useState(false);
|
||||||
|
const [isPIP, setIsPIP] = useState(false);
|
||||||
|
const [volume, setVolume] = useState(0.8);
|
||||||
|
|
||||||
|
const [showVolume, setShowVolume] = useState(false);
|
||||||
|
|
||||||
const [duration, setDuration] = useState(0);
|
const [duration, setDuration] = useState(0);
|
||||||
const [progress, setProgress] = useState(0);
|
const [progress, setProgress] = useState(0);
|
||||||
const [currentTime, setCurrentTime] = useState(0);
|
const [currentTime, setCurrentTime] = useState(startPosition);
|
||||||
|
|
||||||
const onReady = useCallback(() => {
|
const onReady = useCallback(() => {
|
||||||
if (!isReady) {
|
if (!isReady) {
|
||||||
@@ -44,65 +99,146 @@ export const VideoPlayer = () => {
|
|||||||
playerRef.current.seekTo(timeToStart, "seconds");
|
playerRef.current.seekTo(timeToStart, "seconds");
|
||||||
setDuration(playerRef.current.getDuration());
|
setDuration(playerRef.current.getDuration());
|
||||||
setIsReady(true);
|
setIsReady(true);
|
||||||
|
const player = playerRef.current.getInternalPlayer();
|
||||||
|
console.log(player.config);
|
||||||
}
|
}
|
||||||
}, [isReady]);
|
}, [isReady]);
|
||||||
|
|
||||||
const startTime = new Date(0);
|
|
||||||
|
|
||||||
const onProgress = async (e) => {
|
const onProgress = async (e) => {
|
||||||
|
if (!isSeeking) {
|
||||||
|
setProgress(e.played);
|
||||||
|
setCurrentTime(secToTicks(e.playedSeconds));
|
||||||
|
}
|
||||||
await getPlaystateApi(window.api).reportPlaybackProgress({
|
await getPlaystateApi(window.api).reportPlaybackProgress({
|
||||||
playbackProgressInfo: {
|
playbackProgressInfo: {
|
||||||
ItemId: itemId,
|
ItemId: itemId,
|
||||||
IsMuted: isMuted,
|
IsMuted: isMuted,
|
||||||
PositionTicks: secToTicks(e.playedSeconds),
|
PositionTicks: secToTicks(e.playedSeconds),
|
||||||
PlaybackStartTimeTicks: startPosition,
|
PlaybackStartTimeTicks: startPosition,
|
||||||
|
VolumeLevel: volume * 100,
|
||||||
|
IsPaused: !isPlaying,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSeeking = useCallback((time, offset) => {
|
const handleDisplayCurrentTime = () => {
|
||||||
playerRef.current.seekTo(time / 100);
|
let time = ticksToSec(progress * itemDuration);
|
||||||
setCurrentTime(time / 100);
|
let hr = Math.floor(time / 3600);
|
||||||
|
time -= hr * 3600;
|
||||||
|
let min = Math.floor(time / 60);
|
||||||
|
time -= min * 60;
|
||||||
|
return `${hr.toLocaleString([], {
|
||||||
|
minimumIntegerDigits: 2,
|
||||||
|
maximumFractionDigits: 0,
|
||||||
|
})}:${min.toLocaleString([], {
|
||||||
|
minimumIntegerDigits: 2,
|
||||||
|
maximumFractionDigits: 0,
|
||||||
|
})}:${time.toLocaleString([], {
|
||||||
|
minimumIntegerDigits: 2,
|
||||||
|
maximumFractionDigits: 0,
|
||||||
|
})}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDisplayTime = (ticks) => {
|
||||||
|
let time = ticksToSec(ticks);
|
||||||
|
let hr = Math.floor(time / 3600);
|
||||||
|
time -= hr * 3600;
|
||||||
|
let min = Math.floor(time / 60);
|
||||||
|
time -= min * 60;
|
||||||
|
return `${hr.toLocaleString([], {
|
||||||
|
minimumIntegerDigits: 2,
|
||||||
|
maximumFractionDigits: 0,
|
||||||
|
})}:${min.toLocaleString([], {
|
||||||
|
minimumIntegerDigits: 2,
|
||||||
|
maximumFractionDigits: 0,
|
||||||
|
})}:${time.toLocaleString([], {
|
||||||
|
minimumIntegerDigits: 2,
|
||||||
|
maximumFractionDigits: 0,
|
||||||
|
})}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const [appFullscreen, setAppFullScreen] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
let timeout = null;
|
||||||
|
if (showControls) {
|
||||||
|
window.clearTimeout(timeout);
|
||||||
|
timeout = setTimeout(() => {
|
||||||
|
setShowControls(false);
|
||||||
|
}, 5000);
|
||||||
|
}
|
||||||
|
}, [showControls]);
|
||||||
|
|
||||||
|
const handleKeyPress = useCallback((event) => {
|
||||||
|
switch (event.key) {
|
||||||
|
case "ArrowRight":
|
||||||
|
playerRef.current.seekTo(
|
||||||
|
playerRef.current.getCurrentTime() + 15,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "ArrowLeft":
|
||||||
|
playerRef.current.seekTo(
|
||||||
|
playerRef.current.getCurrentTime() - 15,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "p":
|
||||||
|
setIsPlaying(!isPlaying);
|
||||||
|
default:
|
||||||
|
console.log(event.key);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const [url, startPosition, itemId, itemName] = usePlaybackStore(
|
const [subs, setSubs] = useState([]);
|
||||||
(state) => [
|
|
||||||
state.url,
|
useEffect(() => {
|
||||||
state.startPosition,
|
setSubs(
|
||||||
state.itemId,
|
subtitleTracksStore.map((sub, index) => {
|
||||||
state.itemName,
|
return {
|
||||||
],
|
kind: "subtitles",
|
||||||
|
src: `${window.api.basePath}/Videos/${itemId}/${itemId}/Subtitles/${sub.Index}/Stream.vtt?api_key=${window.api.accessToken}`,
|
||||||
|
srcLang: sub?.Language,
|
||||||
|
default: false,
|
||||||
|
mode:
|
||||||
|
sub.Index == currentSubtrack
|
||||||
|
? "showing"
|
||||||
|
: "hidden",
|
||||||
|
};
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
|
}, [subtitleTracksStore]);
|
||||||
|
|
||||||
let timer;
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
className="video"
|
className="video"
|
||||||
sx={{ background: "black" }}
|
sx={{ background: "black" }}
|
||||||
onMouseMove={(e) => {
|
onMouseMove={() => {
|
||||||
let a = "he";
|
setShowControls(true);
|
||||||
clearTimeout(timer);
|
|
||||||
e.currentTarget.classList.add("video-osd-visible");
|
|
||||||
timer = setTimeout(() => {
|
|
||||||
document
|
|
||||||
.querySelector(".video")
|
|
||||||
.classList.remove("video-osd-visible");
|
|
||||||
}, 2000);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Stack
|
<Box
|
||||||
|
sx={{
|
||||||
|
position: "absolute",
|
||||||
|
inset: 0,
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
opacity: isBuffering ? 1 : 0,
|
||||||
|
transition: "opacity 250ms",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CircularProgress />
|
||||||
|
</Box>
|
||||||
|
<Backdrop
|
||||||
className="video-osd"
|
className="video-osd"
|
||||||
sx={{
|
sx={{
|
||||||
position: "fixed",
|
display: "flex",
|
||||||
top: 0,
|
flexDirection: "column",
|
||||||
left: 0,
|
zIndex: 100000,
|
||||||
right: 0,
|
justifyContent: "space-between",
|
||||||
bottom: 0,
|
background: "transparent",
|
||||||
}}
|
}}
|
||||||
alignItems="center"
|
open={showControls}
|
||||||
justifyContent="space-between"
|
|
||||||
direction="column"
|
|
||||||
zIndex="10000000"
|
|
||||||
>
|
>
|
||||||
<AppBar
|
<AppBar
|
||||||
position="static"
|
position="static"
|
||||||
@@ -121,22 +257,83 @@ export const VideoPlayer = () => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
</AppBar>
|
</AppBar>
|
||||||
<Stack direction="column" padding={2} width="100%">
|
<Stack
|
||||||
<Stack width="100%">
|
direction="column"
|
||||||
|
padding={2}
|
||||||
|
width="100%"
|
||||||
|
sx={{
|
||||||
|
background:
|
||||||
|
"linear-gradient(to top, rgb(0 0 0 / 0.75), transparent)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Stack
|
||||||
|
width="100%"
|
||||||
|
direction="row"
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="center"
|
||||||
|
gap={2}
|
||||||
|
>
|
||||||
|
<Typography variant="h6">
|
||||||
|
{handleDisplayCurrentTime()}
|
||||||
|
</Typography>
|
||||||
<Slider
|
<Slider
|
||||||
value={currentTime}
|
value={currentTime}
|
||||||
step={0.01}
|
step={0.01}
|
||||||
max={100}
|
max={itemDuration}
|
||||||
onChange={(e, newVal) => {
|
onChange={(e, newVal) => {
|
||||||
playerRef.current.seekTo(
|
setIsSeeking(true);
|
||||||
(newVal / 100) *
|
|
||||||
playerRef.current.getDuration(),
|
|
||||||
);
|
|
||||||
setCurrentTime(newVal);
|
setCurrentTime(newVal);
|
||||||
}}
|
}}
|
||||||
|
onChangeCommitted={(e, newVal) => {
|
||||||
|
playerRef.current.seekTo(
|
||||||
|
ticksToSec(newVal),
|
||||||
|
);
|
||||||
|
setCurrentTime(newVal);
|
||||||
|
setIsSeeking(false);
|
||||||
|
}}
|
||||||
|
valueLabelDisplay="auto"
|
||||||
|
valueLabelFormat={(value) =>
|
||||||
|
handleDisplayTime(value)
|
||||||
|
}
|
||||||
|
sx={{
|
||||||
|
"& .MuiSlider-valueLabel": {
|
||||||
|
lineHeight: 1.2,
|
||||||
|
fontSize: 24,
|
||||||
|
background: "rgb(0 0 0 / 0.5)",
|
||||||
|
backdropFilter: "blur(5px)",
|
||||||
|
padding: 1,
|
||||||
|
borderRadius: "10px",
|
||||||
|
border: "1px solid rgb(255 255 255 / 0.15)",
|
||||||
|
boxShadow:
|
||||||
|
"0 0 10px rgb(0 0 0 / 0.4) ",
|
||||||
|
transform:
|
||||||
|
"translatey(-120%) scale(0)",
|
||||||
|
"&:before": { display: "none" },
|
||||||
|
"&.MuiSlider-valueLabelOpen": {
|
||||||
|
transform:
|
||||||
|
"translateY(-120%) scale(1)",
|
||||||
|
},
|
||||||
|
"& > *": {
|
||||||
|
transform: "rotate(0deg)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
<Typography variant="h6">
|
||||||
|
{handleDisplayTime(itemDuration)}
|
||||||
|
</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
<Stack direction="row">
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
justifyContent="space-between"
|
||||||
|
alignItems="center"
|
||||||
|
>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
gap={1}
|
||||||
|
justifyContent="center"
|
||||||
|
alignItems="center"
|
||||||
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
playerRef.current.seekTo(
|
playerRef.current.seekTo(
|
||||||
@@ -162,9 +359,185 @@ export const VideoPlayer = () => {
|
|||||||
>
|
>
|
||||||
<MdiFastForward />
|
<MdiFastForward />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
<Typography variant="subtitle1">
|
||||||
|
{endsAt(itemDuration - currentTime)}
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
gap={1}
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="center"
|
||||||
|
>
|
||||||
|
<Box>
|
||||||
|
<Menu
|
||||||
|
anchorEl={speedMenuEl}
|
||||||
|
open={speedMenuState}
|
||||||
|
onClose={() =>
|
||||||
|
setSpeedMenuEl(null)
|
||||||
|
}
|
||||||
|
MenuListProps={{
|
||||||
|
"aria-labelledby":
|
||||||
|
"lock-button",
|
||||||
|
role: "listbox",
|
||||||
|
}}
|
||||||
|
anchorOrigin={{
|
||||||
|
vertical: "bottom",
|
||||||
|
horizontal: "center",
|
||||||
|
}}
|
||||||
|
transformOrigin={{
|
||||||
|
vertical: "bottom",
|
||||||
|
horizontal: "center",
|
||||||
|
}}
|
||||||
|
sx={{
|
||||||
|
mb: 20,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{availableSpeeds.map(
|
||||||
|
(sspeed, index) => {
|
||||||
|
return (
|
||||||
|
<MenuItem
|
||||||
|
key={sspeed}
|
||||||
|
selected={
|
||||||
|
index ===
|
||||||
|
speed
|
||||||
|
}
|
||||||
|
onClick={() => {
|
||||||
|
setSpeed(
|
||||||
|
index,
|
||||||
|
);
|
||||||
|
setSpeedMenuEl(
|
||||||
|
null,
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
sx={{
|
||||||
|
width: 160,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{sspeed}x
|
||||||
|
</MenuItem>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
</Menu>
|
||||||
|
<IconButton
|
||||||
|
onClick={(e) =>
|
||||||
|
setSpeedMenuEl(
|
||||||
|
e.currentTarget,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<MdiPlaySpeed />
|
||||||
|
</IconButton>
|
||||||
|
</Box>
|
||||||
|
<IconButton
|
||||||
|
sx={{
|
||||||
|
ml: 0.1,
|
||||||
|
}}
|
||||||
|
onClick={() => setIsMuted(!isMuted)}
|
||||||
|
>
|
||||||
|
{isMuted ? (
|
||||||
|
<MdiVolumeOff />
|
||||||
|
) : (
|
||||||
|
<MdiVolumeHigh />
|
||||||
|
)}
|
||||||
|
</IconButton>
|
||||||
|
<Slider
|
||||||
|
value={isMuted ? 0 : volume * 100}
|
||||||
|
step={1}
|
||||||
|
max={100}
|
||||||
|
onChange={(e, newVal) =>
|
||||||
|
setVolume(newVal / 100)
|
||||||
|
}
|
||||||
|
valueLabelDisplay="auto"
|
||||||
|
valueLabelFormat={(value) =>
|
||||||
|
Math.floor(value)
|
||||||
|
}
|
||||||
|
sx={{
|
||||||
|
mr: 1,
|
||||||
|
ml: 1,
|
||||||
|
width: "10em",
|
||||||
|
"& .MuiSlider-valueLabel": {
|
||||||
|
lineHeight: 1.2,
|
||||||
|
fontSize: 24,
|
||||||
|
background:
|
||||||
|
"rgb(0 0 0 / 0.5)",
|
||||||
|
backdropFilter: "blur(5px)",
|
||||||
|
padding: 1,
|
||||||
|
borderRadius: "10px",
|
||||||
|
border: "1px solid rgb(255 255 255 / 0.15)",
|
||||||
|
boxShadow:
|
||||||
|
"0 0 10px rgb(0 0 0 / 0.4) ",
|
||||||
|
transform:
|
||||||
|
"translatey(-120%) scale(0)",
|
||||||
|
"&:before": {
|
||||||
|
display: "none",
|
||||||
|
},
|
||||||
|
"&.MuiSlider-valueLabelOpen":
|
||||||
|
{
|
||||||
|
transform:
|
||||||
|
"translateY(-120%) scale(1)",
|
||||||
|
},
|
||||||
|
"& > *": {
|
||||||
|
transform:
|
||||||
|
"rotate(0deg)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Box>
|
||||||
|
<Menu
|
||||||
|
anchorEl={settingsMenuEl}
|
||||||
|
onClose={() => {
|
||||||
|
setSettingsMenuEl(null);
|
||||||
|
}}
|
||||||
|
open={settingsMenuState}
|
||||||
|
sx={{ padding: 2 }}
|
||||||
|
>
|
||||||
|
<Stack direction="row">
|
||||||
|
<Typography variant="h6">
|
||||||
|
Subtitle
|
||||||
|
</Typography>
|
||||||
|
</Stack>
|
||||||
|
</Menu>
|
||||||
|
<IconButton
|
||||||
|
onClick={(e) =>
|
||||||
|
setSettingsMenuEl(
|
||||||
|
e.currentTarget,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
disabled
|
||||||
|
>
|
||||||
|
<MdiCog />
|
||||||
|
</IconButton>
|
||||||
|
</Box>
|
||||||
|
<IconButton
|
||||||
|
onClick={() => {
|
||||||
|
setIsPIP(!isPIP);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<MdiPictureInPictureBottomRight />
|
||||||
|
</IconButton>
|
||||||
|
<IconButton
|
||||||
|
onClick={async () => {
|
||||||
|
let fstate =
|
||||||
|
await appWindow.isFullscreen();
|
||||||
|
setAppFullScreen(!fstate);
|
||||||
|
await appWindow.setFullscreen(
|
||||||
|
!fstate,
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{appFullscreen ? (
|
||||||
|
<MdiFullscreenExit />
|
||||||
|
) : (
|
||||||
|
<MdiFullscreen />
|
||||||
|
)}
|
||||||
|
</IconButton>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
</Backdrop>
|
||||||
<ReactPlayer
|
<ReactPlayer
|
||||||
ref={playerRef}
|
ref={playerRef}
|
||||||
width="100vw"
|
width="100vw"
|
||||||
@@ -174,6 +547,27 @@ export const VideoPlayer = () => {
|
|||||||
onProgress={onProgress}
|
onProgress={onProgress}
|
||||||
onReady={onReady}
|
onReady={onReady}
|
||||||
muted={isMuted}
|
muted={isMuted}
|
||||||
|
pip={isPIP}
|
||||||
|
volume={volume}
|
||||||
|
onBuffer={() => setIsBuffering(true)}
|
||||||
|
onBufferEnd={() => setIsBuffering(false)}
|
||||||
|
config={{
|
||||||
|
file: {
|
||||||
|
attributes: {
|
||||||
|
crossOrigin: "true",
|
||||||
|
},
|
||||||
|
tracks: [
|
||||||
|
{
|
||||||
|
kind: "subtitles",
|
||||||
|
src: `${window.api.basePath}/Videos/${itemId}/${itemId}/Subtitles/${currentSubtrack}/Stream.vtt?api_key=${window.api.accessToken}`,
|
||||||
|
srcLang: "",
|
||||||
|
default: true,
|
||||||
|
mode: "showing",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/** @format */
|
||||||
|
import { useState, useEffect } from "react";
|
||||||
|
|
||||||
|
const useKeyPress = (targetKey) => {
|
||||||
|
// State for keeping track of whether key is pressed
|
||||||
|
const [keyPressed, setKeyPressed] = useState(false);
|
||||||
|
// If pressed key is our target key then set to true
|
||||||
|
function downHandler({ key }) {
|
||||||
|
if (key === targetKey) {
|
||||||
|
setKeyPressed(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If released key is our target key then set to false
|
||||||
|
const upHandler = ({ key }) => {
|
||||||
|
if (key === targetKey) {
|
||||||
|
setKeyPressed(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// Add event listeners
|
||||||
|
useEffect(() => {
|
||||||
|
window.addEventListener("keydown", downHandler);
|
||||||
|
window.addEventListener("keyup", upHandler);
|
||||||
|
// Remove event listeners on cleanup
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener("keydown", downHandler);
|
||||||
|
window.removeEventListener("keyup", upHandler);
|
||||||
|
};
|
||||||
|
}, []); // Empty array ensures that effect is only run on mount and unmount
|
||||||
|
return keyPressed;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default useKeyPress;
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
/** @format */
|
||||||
|
|
||||||
|
import { create } from "zustand";
|
||||||
|
|
||||||
|
export const useDrawerStore = create((set) => ({
|
||||||
|
open: false,
|
||||||
|
setOpen: (sopen) => set((state) => ({ ...state, open: sopen })),
|
||||||
|
}));
|
||||||
@@ -5,10 +5,21 @@ import { create } from "zustand";
|
|||||||
export const usePlaybackStore = create((set) => ({
|
export const usePlaybackStore = create((set) => ({
|
||||||
url: "",
|
url: "",
|
||||||
startPosition: 0,
|
startPosition: 0,
|
||||||
|
duration: 0,
|
||||||
itemId: "",
|
itemId: "",
|
||||||
itemName: "",
|
itemName: "",
|
||||||
|
subtitleTracks: [],
|
||||||
|
selectedSubtitleTrack: 0,
|
||||||
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 })),
|
||||||
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: asub,
|
||||||
|
})),
|
||||||
|
setSelectedSubtitleTrack: (asub) =>
|
||||||
|
set((state) => ({ ...state, selectedSubtitleTrack: asub })),
|
||||||
}));
|
}));
|
||||||
Reference in new issue
Block a user