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"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.10.5",
|
||||
"@emotion/react": "^11.11.1",
|
||||
"@emotion/styled": "^11.10.5",
|
||||
"@fontsource/open-sans": "^4.5.13",
|
||||
"@fontsource/open-sans": "^5.0.3",
|
||||
"@jellyfin/sdk": "^0.8.2",
|
||||
"@mdi/js": "^7.2.96",
|
||||
"@mui/lab": "^5.0.0-alpha.128",
|
||||
"@mui/material": "^5.11.16",
|
||||
"@mui/lab": "^5.0.0-alpha.134",
|
||||
"@mui/material": "^5.13.0",
|
||||
"@tanstack/react-query": "^4.26.1",
|
||||
"@tanstack/react-query-devtools": "^4.29.3",
|
||||
"@tauri-apps/api": "^1.2.0",
|
||||
"@videojs/http-streaming": "^3.0.2",
|
||||
"@tanstack/react-query-devtools": "^4.29.19",
|
||||
"@tauri-apps/api": "^1.4.0",
|
||||
"axios": "^1.4.0",
|
||||
"blurhash": "^2.0.5",
|
||||
"events": "^3.3.0",
|
||||
"framer-motion": "^10.12.4",
|
||||
"framer-motion": "^10.12.10",
|
||||
"notistack": "^3.0.1",
|
||||
"react": "^18.2.0",
|
||||
"react-blurhash": "^0.3.0",
|
||||
@@ -33,19 +32,18 @@
|
||||
"react-material-ui-carousel": "^3.4.2",
|
||||
"react-multi-carousel": "^2.8.3",
|
||||
"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",
|
||||
"uuid": "^9.0.0",
|
||||
"vite-plugin-svgr": "^3.2.0",
|
||||
"zustand": "^4.3.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^1.2.2",
|
||||
"@types/react": "^18.2.0",
|
||||
"@types/react-dom": "^18.2.1",
|
||||
"@tauri-apps/cli": "^1.3.1",
|
||||
"@types/react": "^18.2.11",
|
||||
"@types/react-dom": "^18.2.6",
|
||||
"@vitejs/plugin-react": "^4.0.0",
|
||||
"sass": "^1.62.1",
|
||||
"video.js": "^8.3.0",
|
||||
"sass": "^1.63.3",
|
||||
"vite": "^4.3.1"
|
||||
},
|
||||
"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-origin: left;
|
||||
}
|
||||
|
||||
/* 100% {
|
||||
transform: scaleX(0) translateX(-100%);
|
||||
transform-origin: left;
|
||||
} */
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
@@ -17,7 +17,7 @@ tauri-build = { version = "1.2.1", features = [] }
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
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-localhost = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
|
||||
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 */
|
||||
|
||||
import React, { useState } from "react";
|
||||
import React, { useState, useEffect } from "react";
|
||||
|
||||
import { appWindow } from "@tauri-apps/api/window";
|
||||
|
||||
import Konami from "react-konami-code";
|
||||
// @ts-ignore
|
||||
@@ -68,8 +70,8 @@ import { version as appVer } from "../package.json";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { delServer, getServer } from "./utils/storage/servers.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({
|
||||
clientInfo: {
|
||||
@@ -182,6 +184,7 @@ function App() {
|
||||
enqueueSnackbar("Unable to verfiy server address.", {
|
||||
variant: "error",
|
||||
});
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -243,13 +246,13 @@ function App() {
|
||||
if (reason && reason == "backdropClick") {
|
||||
return;
|
||||
}
|
||||
let result = await relaunch();
|
||||
await relaunch();
|
||||
};
|
||||
|
||||
const handleRemoveServer = async () => {
|
||||
await delServer();
|
||||
await delUser();
|
||||
let result = await relaunch();
|
||||
await relaunch();
|
||||
};
|
||||
const location = useLocation();
|
||||
|
||||
@@ -271,23 +274,13 @@ function App() {
|
||||
setEasterEgg(true);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
appWindow.setFullscreen(false);
|
||||
}, [location]);
|
||||
|
||||
return (
|
||||
<SnackbarProvider maxSnack={5}>
|
||||
<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>
|
||||
<Dialog
|
||||
open={easterEgg}
|
||||
@@ -404,7 +397,6 @@ function App() {
|
||||
</Routes>
|
||||
</div>
|
||||
</AnimatePresence>
|
||||
<ReactQueryDevtools />
|
||||
</ThemeProvider>
|
||||
</SnackbarProvider>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/** @format */
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { relaunch } from "@tauri-apps/api/process";
|
||||
|
||||
import MuiAppBar from "@mui/material/AppBar";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
@@ -26,6 +28,11 @@ import { MdiHeartOutline } from "../icons/mdiHeartOutline";
|
||||
import { MdiArrowLeft } from "../icons/mdiArrowLeft";
|
||||
import { MdiCog } from "../icons/mdiCog";
|
||||
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 = () => {
|
||||
const navigate = useNavigate();
|
||||
@@ -59,6 +66,12 @@ export const AppBar = () => {
|
||||
setAnchorEl(null);
|
||||
};
|
||||
|
||||
const [setDrawerOpen] = useDrawerStore((state) => [state.setOpen]);
|
||||
|
||||
const handleDrawerOpen = () => {
|
||||
setDrawerOpen(true);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
location.pathname.includes("login") ||
|
||||
@@ -87,13 +100,18 @@ export const AppBar = () => {
|
||||
return (
|
||||
<MuiAppBar
|
||||
sx={{
|
||||
width: `calc(100vw - ${theme.spacing(7)})`,
|
||||
backgroundColor: "transparent",
|
||||
paddingRight: "0 !important",
|
||||
}}
|
||||
className={trigger ? "appBar backdropVisible" : "appBar"}
|
||||
elevation={0}
|
||||
>
|
||||
<Toolbar sx={{ justifyContent: "space-between" }}>
|
||||
<Toolbar
|
||||
sx={{
|
||||
justifyContent: "space-between",
|
||||
paddingLeft: "12px !important",
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
@@ -101,6 +119,13 @@ export const AppBar = () => {
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<IconButton
|
||||
color="inherit"
|
||||
aria-label="open drawer"
|
||||
onClick={handleDrawerOpen}
|
||||
>
|
||||
<MdiMenu />
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() => navigate(-1)}
|
||||
sx={{
|
||||
@@ -109,6 +134,7 @@ export const AppBar = () => {
|
||||
? "scale(1)"
|
||||
: "scale(0)",
|
||||
transformOrigin: "left",
|
||||
ml: 2,
|
||||
}}
|
||||
>
|
||||
<MdiArrowLeft />
|
||||
@@ -175,6 +201,18 @@ export const AppBar = () => {
|
||||
</ListItemIcon>
|
||||
About
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
onClick={async () => {
|
||||
await delServer();
|
||||
await delUser();
|
||||
await relaunch();
|
||||
}}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<MdiDelete />
|
||||
</ListItemIcon>
|
||||
Remove Server
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</Box>
|
||||
</Toolbar>
|
||||
|
||||
@@ -31,19 +31,19 @@ export const CardScroller = ({
|
||||
slidesToSlide: displayCards + 1,
|
||||
},
|
||||
desktop: {
|
||||
breakpoint: { max: 3000, min: 1025 },
|
||||
breakpoint: { max: 3000, min: 625 },
|
||||
items: displayCards,
|
||||
slidesToSlide: displayCards, // optional, default to 1.
|
||||
},
|
||||
tablet: {
|
||||
breakpoint: { max: 1024, min: 464 },
|
||||
breakpoint: { max: 624, min: 464 },
|
||||
items: displayCards - 2,
|
||||
slidesToSlide: displayCards - 2, // optional, default to 1.
|
||||
},
|
||||
mobile: {
|
||||
breakpoint: { max: 464, min: 0 },
|
||||
items: displayCards - 3,
|
||||
slidesToSlide: displayCards - 3, // optional, default to 1.
|
||||
items: displayCards - 5,
|
||||
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 { 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 { MdiClockOutline } from "../../icons/mdiClockOutline";
|
||||
import { MdiHeart } from "../../icons/mdiHeart";
|
||||
import { MdiHeartOutline } from "../../icons/mdiHeartOutline";
|
||||
import { MdiAlbum } from "../../icons/mdiAlbum";
|
||||
@@ -44,12 +47,12 @@ export const ArtistAlbum = ({ user, album, boxProps }) => {
|
||||
let result;
|
||||
if (track.UserData.IsFavorite) {
|
||||
result = await getUserLibraryApi(window.api).unmarkFavoriteItem({
|
||||
userId: user.data.Id,
|
||||
userId: user.Id,
|
||||
itemId: track.Id,
|
||||
});
|
||||
} else if (!track.UserData.IsFavorite) {
|
||||
result = await getUserLibraryApi(window.api).markFavoriteItem({
|
||||
userId: user.data.Id,
|
||||
userId: user.Id,
|
||||
itemId: track.Id,
|
||||
});
|
||||
}
|
||||
|
||||
+320
-145
@@ -20,8 +20,9 @@ import ListItemButton from "@mui/material/ListItemButton";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Divider from "@mui/material/Divider";
|
||||
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 { MediaCollectionTypeIconCollection } from "../../components/utils/iconsCollection.jsx";
|
||||
@@ -31,6 +32,7 @@ import { MdiHomeVariantOutline } from "../icons/mdiHomeVariantOutline";
|
||||
import { EventEmitter as event } from "../../eventEmitter.js";
|
||||
|
||||
import "./sidemenu.module.scss";
|
||||
import { useDrawerStore } from "../../utils/store/drawer";
|
||||
|
||||
const drawerWidth = 320;
|
||||
|
||||
@@ -78,7 +80,6 @@ export const SideMenu = ({}) => {
|
||||
enabled: !!user.data,
|
||||
networkMode: "always",
|
||||
});
|
||||
const handleDrawerOpen = () => {};
|
||||
|
||||
const handleLogout = async () => {
|
||||
console.log("Logging out user...");
|
||||
@@ -102,177 +103,351 @@ export const SideMenu = ({}) => {
|
||||
}
|
||||
}, [location]);
|
||||
|
||||
const [open, setDrawerOpen] = useDrawerStore((state) => [
|
||||
state.open,
|
||||
state.setOpen,
|
||||
]);
|
||||
|
||||
if (!display) {
|
||||
return <></>;
|
||||
}
|
||||
|
||||
if (display) {
|
||||
return (
|
||||
<MiniDrawer
|
||||
variant="permanent"
|
||||
open={false}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
backgroundColor: "inherit",
|
||||
border: "none",
|
||||
width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
height: "100vh",
|
||||
// display: visible ? "block" : "none",
|
||||
},
|
||||
}}
|
||||
sx={{
|
||||
width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
background: theme.palette.background.paper,
|
||||
}}
|
||||
>
|
||||
<DrawerHeader
|
||||
className="Mui-DrawerHeader"
|
||||
<>
|
||||
<MiniDrawer
|
||||
variant="permanent"
|
||||
open={false}
|
||||
PaperProps={{
|
||||
sx: {
|
||||
backgroundColor: "inherit",
|
||||
border: "none",
|
||||
width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
height: "100vh",
|
||||
zIndex: "1",
|
||||
// display: visible ? "block" : "none",
|
||||
},
|
||||
}}
|
||||
sx={{
|
||||
justifyContent: "center",
|
||||
width: `calc(${theme.spacing(7)} + 10px)`,
|
||||
background: theme.palette.background.paper,
|
||||
}}
|
||||
>
|
||||
{/* <div>
|
||||
<Avatar src={""}/>
|
||||
<Typography variant="h3">
|
||||
{user["Name"]}
|
||||
</Typography>
|
||||
</div> */}
|
||||
<IconButton
|
||||
color="inherit"
|
||||
aria-label="open drawer"
|
||||
onClick={handleDrawerOpen}
|
||||
>
|
||||
<MdiMenu />
|
||||
</IconButton>
|
||||
</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}
|
||||
>
|
||||
<ListItem
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
<DrawerHeader
|
||||
className="Mui-DrawerHeader"
|
||||
sx={{
|
||||
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}
|
||||
>
|
||||
<ListItemButton
|
||||
component={
|
||||
NavLink
|
||||
}
|
||||
to={
|
||||
"/library/" +
|
||||
library.Id
|
||||
}
|
||||
className="sidemenu-item"
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
}}
|
||||
<ListItem
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
>
|
||||
<ListItemIcon
|
||||
<ListItemButton
|
||||
component={
|
||||
NavLink
|
||||
}
|
||||
to={
|
||||
"/library/" +
|
||||
library.Id
|
||||
}
|
||||
className="sidemenu-item"
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
display: "flex",
|
||||
flexDirection:
|
||||
"column",
|
||||
}}
|
||||
>
|
||||
{
|
||||
MediaCollectionTypeIconCollection[
|
||||
library
|
||||
.CollectionType
|
||||
]
|
||||
}
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</List>
|
||||
<List sx={{ marginTop: "auto" }}>
|
||||
<Tooltip
|
||||
title="Home"
|
||||
placement="right"
|
||||
followCursor
|
||||
arrow
|
||||
>
|
||||
<ListItem
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
<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
|
||||
>
|
||||
<ListItemButton
|
||||
component={NavLink}
|
||||
to="/home"
|
||||
className="sidemenu-item"
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent: "center",
|
||||
px: 2.5,
|
||||
}}
|
||||
<ListItem
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
>
|
||||
<ListItemIcon
|
||||
<ListItemButton
|
||||
component={NavLink}
|
||||
to="/home"
|
||||
className="sidemenu-item"
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
display: "flex",
|
||||
flexDirection:
|
||||
"column",
|
||||
}}
|
||||
>
|
||||
<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
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
}}
|
||||
>
|
||||
<MdiHomeVariantOutline />
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
<Tooltip
|
||||
title="Logout"
|
||||
placement="right"
|
||||
followCursor
|
||||
arrow
|
||||
>
|
||||
<ListItem disablePadding>
|
||||
<ListItemButton
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
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>
|
||||
</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}
|
||||
>
|
||||
<ListItem
|
||||
className="sidemenu-item-container"
|
||||
disablePadding
|
||||
>
|
||||
<ListItemButton
|
||||
component={
|
||||
NavLink
|
||||
}
|
||||
to={
|
||||
"/library/" +
|
||||
library.Id
|
||||
}
|
||||
className="sidemenu-item"
|
||||
sx={{
|
||||
minHeight: 48,
|
||||
justifyContent:
|
||||
"center",
|
||||
px: 2.5,
|
||||
}}
|
||||
>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
mr: 2,
|
||||
}}
|
||||
>
|
||||
{
|
||||
MediaCollectionTypeIconCollection[
|
||||
library
|
||||
.CollectionType
|
||||
]
|
||||
}
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
{
|
||||
library.Name
|
||||
}
|
||||
</ListItemText>
|
||||
</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,
|
||||
}}
|
||||
>
|
||||
<MdiLogoutVariant></MdiLogoutVariant>
|
||||
</ListItemIcon>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
</List>
|
||||
</>
|
||||
)}
|
||||
</MiniDrawer>
|
||||
<ListItemIcon
|
||||
sx={{
|
||||
minWidth: 0,
|
||||
justifyContent:
|
||||
"center",
|
||||
mr: 2,
|
||||
}}
|
||||
>
|
||||
<MdiHomeVariantOutline />
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
Home
|
||||
</ListItemText>
|
||||
</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",
|
||||
mr: 2,
|
||||
}}
|
||||
>
|
||||
<MdiLogoutVariant></MdiLogoutVariant>
|
||||
</ListItemIcon>
|
||||
<ListItemText>
|
||||
Logout
|
||||
</ListItemText>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</Tooltip>
|
||||
</List>
|
||||
</>
|
||||
)}
|
||||
</MuiDrawer>
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -26,4 +26,12 @@
|
||||
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
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
|
||||
@@ -9,7 +9,7 @@ export const ErrorNotice = () => {
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
|
||||
@@ -61,6 +61,8 @@ export const MediaTypeIconCollection = {
|
||||
Audio: <MdiMicrophone className="hero-carousel-background-icon" />,
|
||||
Photo: <MdiImage 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 = {
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
-webkit-line-clamp: 2;
|
||||
margin-bottom: 0.5em;
|
||||
&-logo {
|
||||
max-width: 10em;
|
||||
max-width: 12em;
|
||||
height: 2em;
|
||||
object-fit: contain;
|
||||
object-position: bottom;
|
||||
|
||||
+13
-11
@@ -96,7 +96,13 @@ const Home = () => {
|
||||
{
|
||||
userId: user.data.Id,
|
||||
fields: [ItemFields.Overview, ItemFields.ParentId],
|
||||
includeItemTypes: [
|
||||
BaseItemKind.Series,
|
||||
BaseItemKind.Movie,
|
||||
BaseItemKind.AudioBook,
|
||||
],
|
||||
enableUserData: true,
|
||||
limit: 16,
|
||||
},
|
||||
);
|
||||
return media.data;
|
||||
@@ -111,7 +117,7 @@ const Home = () => {
|
||||
const resumeItems = await getItemsApi(window.api).getResumeItems(
|
||||
{
|
||||
userId: user.data.Id,
|
||||
limit: 16,
|
||||
limit: 10,
|
||||
mediaTypes: ["Video"],
|
||||
enableUserData: true,
|
||||
},
|
||||
@@ -128,7 +134,7 @@ const Home = () => {
|
||||
const resumeItems = await getItemsApi(window.api).getResumeItems(
|
||||
{
|
||||
userId: user.data.Id,
|
||||
limit: 16,
|
||||
limit: 10,
|
||||
mediaTypes: ["Audio"],
|
||||
enableUserData: true,
|
||||
},
|
||||
@@ -144,7 +150,7 @@ const Home = () => {
|
||||
queryFn: async () => {
|
||||
const upNext = await getTvShowsApi(window.api).getNextUp({
|
||||
userId: user.data.Id,
|
||||
limit: 16,
|
||||
limit: 10,
|
||||
});
|
||||
return upNext.data;
|
||||
},
|
||||
@@ -240,7 +246,7 @@ const Home = () => {
|
||||
<CarouselSkeleton />
|
||||
) : (
|
||||
// <></>
|
||||
latestMedia.data != null &&
|
||||
latestMedia.data.length != 0 &&
|
||||
latestMedia.data.map((item, index) => {
|
||||
return (
|
||||
<Paper
|
||||
@@ -254,12 +260,8 @@ const Home = () => {
|
||||
>
|
||||
<div className="hero-carousel-background-container">
|
||||
{item.Type ==
|
||||
BaseItemKind.MusicAlbum ||
|
||||
item.Type ==
|
||||
BaseItemKind.Episode ? (
|
||||
item
|
||||
.ParentBackdropImageTags
|
||||
.length != 0 && (
|
||||
BaseItemKind.MusicAlbum ? (
|
||||
!!item.ParentBackdropItemId && (
|
||||
<>
|
||||
<Blurhash
|
||||
hash={
|
||||
@@ -339,7 +341,7 @@ const Home = () => {
|
||||
<div className="hero-carousel-background-icon-container">
|
||||
{
|
||||
MediaTypeIconCollection[
|
||||
item.MediaType
|
||||
item.Type
|
||||
]
|
||||
}
|
||||
</div>
|
||||
|
||||
+140
-86
@@ -34,6 +34,7 @@ import { useParams, useNavigate, Link as RouterLink } from "react-router-dom";
|
||||
import {
|
||||
BaseItemKind,
|
||||
ItemFields,
|
||||
LocationType,
|
||||
MediaStreamType,
|
||||
SortOrder,
|
||||
} 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 { MdiMusic } from "../../components/icons/mdiMusic";
|
||||
import { usePlaybackStore } from "../../utils/store/playback";
|
||||
import { Tooltip } from "@mui/material";
|
||||
function TabPanel(props) {
|
||||
const { children, value, index, ...other } = props;
|
||||
|
||||
@@ -168,6 +170,7 @@ const ItemDetail = () => {
|
||||
queryFn: async () => {
|
||||
const result = await getTvShowsApi(window.api).getSeasons({
|
||||
seriesId: item.data.Id,
|
||||
isSpecialSeason: false,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
@@ -200,6 +203,7 @@ const ItemDetail = () => {
|
||||
userId: user.data.Id,
|
||||
parentId: seasons.data.Items[currentSeason].Id,
|
||||
fields: [ItemFields.SeasonUserData, "Overview"],
|
||||
excludeLocationTypes: [LocationType.Virtual],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
@@ -505,20 +509,29 @@ const ItemDetail = () => {
|
||||
setAudioTracks(audios);
|
||||
setSubtitleTracks(subs);
|
||||
|
||||
setCurrentVideoTrack(videos[0].DisplayTitle);
|
||||
setCurrentAudioTrack(audios[0].DisplayTitle);
|
||||
setCurrentSubTrack(subs[0].DisplayTitle);
|
||||
setCurrentVideoTrack(videos[0]?.Index);
|
||||
setCurrentAudioTrack(audios[0]?.Index);
|
||||
setCurrentSubTrack(subs[0]?.Index);
|
||||
}
|
||||
}, [item.isSuccess]);
|
||||
|
||||
const [setUrl, setPosition, setItemId, setItemName] = usePlaybackStore(
|
||||
(state) => [
|
||||
state.setUrl,
|
||||
state.setPosition,
|
||||
state.setItemId,
|
||||
state.setItemName,
|
||||
],
|
||||
);
|
||||
const [
|
||||
setUrl,
|
||||
setPosition,
|
||||
setDuration,
|
||||
setItemId,
|
||||
setItemName,
|
||||
setSubtitleTracksStore,
|
||||
setSelectedSubtitleTrack,
|
||||
] = usePlaybackStore((state) => [
|
||||
state.setUrl,
|
||||
state.setPosition,
|
||||
state.setDuration,
|
||||
state.setItemId,
|
||||
state.setItemName,
|
||||
state.setSubtitleTracks,
|
||||
state.setSelectedSubtitleTrack,
|
||||
]);
|
||||
|
||||
const [directors, setDirectors] = useState([]);
|
||||
const [writers, setWriters] = useState([]);
|
||||
@@ -1004,82 +1017,121 @@ const ItemDetail = () => {
|
||||
"Music",
|
||||
) && (
|
||||
<>
|
||||
<Button
|
||||
variant="contained"
|
||||
size="large"
|
||||
startIcon={
|
||||
<MdiPlayOutline />
|
||||
<Tooltip
|
||||
title={
|
||||
item.data
|
||||
.Type ==
|
||||
"Series"
|
||||
? "Work in progress, meanwhile you can play individual episodes by clicking on episode card below"
|
||||
: ""
|
||||
}
|
||||
sx={{
|
||||
position:
|
||||
"relative",
|
||||
overflow:
|
||||
"hidden",
|
||||
}}
|
||||
onClick={() => {
|
||||
if (
|
||||
!!item
|
||||
.data
|
||||
.VideoType
|
||||
) {
|
||||
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}`,
|
||||
);
|
||||
setPosition(
|
||||
item
|
||||
.data
|
||||
.UserData
|
||||
.PlaybackPositionTicks,
|
||||
);
|
||||
setItemName(
|
||||
item
|
||||
.data
|
||||
.Name,
|
||||
);
|
||||
setItemId(
|
||||
item
|
||||
.data
|
||||
.Id,
|
||||
);
|
||||
}
|
||||
navigate(
|
||||
`/player`,
|
||||
);
|
||||
}}
|
||||
>
|
||||
{!!item.data
|
||||
.UserData
|
||||
.PlayedPercentage &&
|
||||
item.data.UserData
|
||||
.PlayedPercentage >
|
||||
0
|
||||
? "Resume"
|
||||
: "Play"}
|
||||
{!!item.data
|
||||
.UserData
|
||||
.PlayedPercentage && (
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={
|
||||
<span>
|
||||
<Button
|
||||
disabled={
|
||||
item
|
||||
.data
|
||||
.UserData
|
||||
.PlayedPercentage
|
||||
.Type ==
|
||||
"Series"
|
||||
? true
|
||||
: false
|
||||
}
|
||||
variant="contained"
|
||||
size="large"
|
||||
startIcon={
|
||||
<MdiPlayOutline />
|
||||
}
|
||||
color="white"
|
||||
sx={{
|
||||
position:
|
||||
"absolute",
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
background:
|
||||
"transparent",
|
||||
zIndex: "0",
|
||||
opacity: 0.2,
|
||||
"relative",
|
||||
overflow:
|
||||
"hidden",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Button>
|
||||
onClick={() => {
|
||||
if (
|
||||
!!item
|
||||
.data
|
||||
.VideoType
|
||||
) {
|
||||
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}&videoStreamIndex=${currentVideoTrack}&audioStreamIndex=${currentAudioTrack}`,
|
||||
);
|
||||
setPosition(
|
||||
item
|
||||
.data
|
||||
.UserData
|
||||
.PlaybackPositionTicks,
|
||||
);
|
||||
setItemName(
|
||||
item
|
||||
.data
|
||||
.Type ==
|
||||
"Episode"
|
||||
? `${item.data.SeriesName} S${item.data.ParentIndexNumber}:E${item.data.IndexNumber} ${item.data.Name}`
|
||||
: item
|
||||
.data
|
||||
.Name,
|
||||
);
|
||||
setItemId(
|
||||
item
|
||||
.data
|
||||
.Id,
|
||||
);
|
||||
setDuration(
|
||||
item
|
||||
.data
|
||||
.RunTimeTicks,
|
||||
);
|
||||
setSubtitleTracksStore(
|
||||
subtitleTracks,
|
||||
);
|
||||
setSelectedSubtitleTrack(
|
||||
currentSubTrack,
|
||||
);
|
||||
}
|
||||
navigate(
|
||||
`/player`,
|
||||
);
|
||||
}}
|
||||
>
|
||||
{!!item
|
||||
.data
|
||||
.UserData
|
||||
.PlayedPercentage &&
|
||||
item.data
|
||||
.UserData
|
||||
.PlayedPercentage >
|
||||
0
|
||||
? "Resume"
|
||||
: "Play"}
|
||||
{!!item
|
||||
.data
|
||||
.UserData
|
||||
.PlayedPercentage && (
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={
|
||||
item
|
||||
.data
|
||||
.UserData
|
||||
.PlayedPercentage
|
||||
}
|
||||
color="white"
|
||||
sx={{
|
||||
position:
|
||||
"absolute",
|
||||
height: "100%",
|
||||
width: "100%",
|
||||
background:
|
||||
"transparent",
|
||||
zIndex: "0",
|
||||
opacity: 0.2,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Button>
|
||||
</span>
|
||||
</Tooltip>
|
||||
|
||||
<IconButton
|
||||
onClick={
|
||||
@@ -1489,7 +1541,8 @@ const ItemDetail = () => {
|
||||
item.data.MediaStreams.length !=
|
||||
0 && (
|
||||
<>
|
||||
{videoTracks != [] && (
|
||||
{videoTracks.length !=
|
||||
0 && (
|
||||
<TableRow
|
||||
sx={{
|
||||
"& td, & th":
|
||||
@@ -1549,7 +1602,7 @@ const ItemDetail = () => {
|
||||
sindex
|
||||
}
|
||||
value={
|
||||
stream.DisplayTitle
|
||||
stream.Index
|
||||
}
|
||||
>
|
||||
{
|
||||
@@ -1563,7 +1616,8 @@ const ItemDetail = () => {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
{audioTracks != [] && (
|
||||
{audioTracks.length !=
|
||||
0 && (
|
||||
<TableRow
|
||||
sx={{
|
||||
"& td, & th":
|
||||
@@ -1619,7 +1673,7 @@ const ItemDetail = () => {
|
||||
sindex
|
||||
}
|
||||
value={
|
||||
stream.DisplayTitle
|
||||
stream.Index
|
||||
}
|
||||
>
|
||||
{
|
||||
@@ -1633,8 +1687,8 @@ const ItemDetail = () => {
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
{subtitleTracks !=
|
||||
[] && (
|
||||
{subtitleTracks.length !=
|
||||
0 && (
|
||||
<TableRow
|
||||
sx={{
|
||||
"& td, & th":
|
||||
@@ -1690,7 +1744,7 @@ const ItemDetail = () => {
|
||||
sindex
|
||||
}
|
||||
value={
|
||||
stream.DisplayTitle
|
||||
stream.Index
|
||||
}
|
||||
>
|
||||
{
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
&-title-logo {
|
||||
filter: drop-shadow(0 0 10px rgb(0 0 0 /0.2));
|
||||
height: 100%;
|
||||
max-height: 5em;
|
||||
width: 45%;
|
||||
object-fit: contain;
|
||||
object-position: bottom;
|
||||
|
||||
@@ -8,6 +8,13 @@ import Stack from "@mui/material/Stack";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Typography from "@mui/material/Typography";
|
||||
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";
|
||||
|
||||
@@ -15,8 +22,8 @@ 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";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import { useRef, useState, useCallback, useEffect } from "react";
|
||||
import { secToTicks, ticksToSec } from "../../utils/date/time";
|
||||
|
||||
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 { MdiFastForward } from "../../components/icons/mdiFastForward";
|
||||
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 = () => {
|
||||
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 [isSeeking, setIsSeeking] = useState(false);
|
||||
const [isBuffering, setIsBuffering] = useState(true);
|
||||
const [isPlaying, setIsPlaying] = useState(true);
|
||||
const [isMuted, setIsMuted] = 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 [progress, setProgress] = useState(0);
|
||||
const [currentTime, setCurrentTime] = useState(0);
|
||||
const [currentTime, setCurrentTime] = useState(startPosition);
|
||||
|
||||
const onReady = useCallback(() => {
|
||||
if (!isReady) {
|
||||
@@ -44,65 +99,146 @@ export const VideoPlayer = () => {
|
||||
playerRef.current.seekTo(timeToStart, "seconds");
|
||||
setDuration(playerRef.current.getDuration());
|
||||
setIsReady(true);
|
||||
const player = playerRef.current.getInternalPlayer();
|
||||
console.log(player.config);
|
||||
}
|
||||
}, [isReady]);
|
||||
|
||||
const startTime = new Date(0);
|
||||
|
||||
const onProgress = async (e) => {
|
||||
if (!isSeeking) {
|
||||
setProgress(e.played);
|
||||
setCurrentTime(secToTicks(e.playedSeconds));
|
||||
}
|
||||
await getPlaystateApi(window.api).reportPlaybackProgress({
|
||||
playbackProgressInfo: {
|
||||
ItemId: itemId,
|
||||
IsMuted: isMuted,
|
||||
PositionTicks: secToTicks(e.playedSeconds),
|
||||
PlaybackStartTimeTicks: startPosition,
|
||||
VolumeLevel: volume * 100,
|
||||
IsPaused: !isPlaying,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const handleSeeking = useCallback((time, offset) => {
|
||||
playerRef.current.seekTo(time / 100);
|
||||
setCurrentTime(time / 100);
|
||||
const handleDisplayCurrentTime = () => {
|
||||
let time = ticksToSec(progress * itemDuration);
|
||||
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(
|
||||
(state) => [
|
||||
state.url,
|
||||
state.startPosition,
|
||||
state.itemId,
|
||||
state.itemName,
|
||||
],
|
||||
);
|
||||
const [subs, setSubs] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
setSubs(
|
||||
subtitleTracksStore.map((sub, index) => {
|
||||
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 (
|
||||
<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);
|
||||
onMouseMove={() => {
|
||||
setShowControls(true);
|
||||
}}
|
||||
>
|
||||
<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"
|
||||
sx={{
|
||||
position: "fixed",
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
zIndex: 100000,
|
||||
justifyContent: "space-between",
|
||||
background: "transparent",
|
||||
}}
|
||||
alignItems="center"
|
||||
justifyContent="space-between"
|
||||
direction="column"
|
||||
zIndex="10000000"
|
||||
open={showControls}
|
||||
>
|
||||
<AppBar
|
||||
position="static"
|
||||
@@ -121,50 +257,287 @@ export const VideoPlayer = () => {
|
||||
</Typography>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
<Stack direction="column" padding={2} width="100%">
|
||||
<Stack width="100%">
|
||||
<Stack
|
||||
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
|
||||
value={currentTime}
|
||||
step={0.01}
|
||||
max={100}
|
||||
max={itemDuration}
|
||||
onChange={(e, newVal) => {
|
||||
playerRef.current.seekTo(
|
||||
(newVal / 100) *
|
||||
playerRef.current.getDuration(),
|
||||
);
|
||||
setIsSeeking(true);
|
||||
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 direction="row">
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
playerRef.current.seekTo(
|
||||
playerRef.current.getCurrentTime() -
|
||||
15,
|
||||
)
|
||||
}
|
||||
<Stack
|
||||
direction="row"
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
>
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={1}
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
>
|
||||
<MdiRewind />
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() => setIsPlaying(!isPlaying)}
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
playerRef.current.seekTo(
|
||||
playerRef.current.getCurrentTime() -
|
||||
15,
|
||||
)
|
||||
}
|
||||
>
|
||||
<MdiRewind />
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() => setIsPlaying(!isPlaying)}
|
||||
>
|
||||
{isPlaying ? <MdiPause /> : <MdiPlay />}
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
playerRef.current.seekTo(
|
||||
playerRef.current.getCurrentTime() +
|
||||
15,
|
||||
)
|
||||
}
|
||||
>
|
||||
<MdiFastForward />
|
||||
</IconButton>
|
||||
<Typography variant="subtitle1">
|
||||
{endsAt(itemDuration - currentTime)}
|
||||
</Typography>
|
||||
</Stack>
|
||||
<Stack
|
||||
direction="row"
|
||||
gap={1}
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
>
|
||||
{isPlaying ? <MdiPause /> : <MdiPlay />}
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={() =>
|
||||
playerRef.current.seekTo(
|
||||
playerRef.current.getCurrentTime() +
|
||||
15,
|
||||
)
|
||||
}
|
||||
>
|
||||
<MdiFastForward />
|
||||
</IconButton>
|
||||
<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>
|
||||
</Backdrop>
|
||||
<ReactPlayer
|
||||
ref={playerRef}
|
||||
width="100vw"
|
||||
@@ -174,6 +547,27 @@ export const VideoPlayer = () => {
|
||||
onProgress={onProgress}
|
||||
onReady={onReady}
|
||||
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>
|
||||
);
|
||||
|
||||
@@ -9,3 +9,16 @@
|
||||
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) => ({
|
||||
url: "",
|
||||
startPosition: 0,
|
||||
duration: 0,
|
||||
itemId: "",
|
||||
itemName: "",
|
||||
subtitleTracks: [],
|
||||
selectedSubtitleTrack: 0,
|
||||
setUrl: (aurl) => set((state) => ({ ...state, url: aurl })),
|
||||
setPosition: (apos) => set((state) => ({ ...state, startPosition: apos })),
|
||||
setDuration: (adur) => set((state) => ({ ...state, duration: adur })),
|
||||
setItemId: (aid) => set((state) => ({ ...state, itemId: aid })),
|
||||
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