Revert UI changes in @e4ade56
This commit is contained in:
11 files changed
+493
-754
No files matched your search
@@ -5,7 +5,6 @@
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/icon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<script src="http://localhost:8097"></script>
|
||||
<title>Jellyplayer</title>
|
||||
</head>
|
||||
|
||||
|
||||
Generated
+281
-616
File diff suppressed because it is too large.
Load diff
+1
-3
@@ -12,7 +12,7 @@
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.10.5",
|
||||
"@emotion/styled": "^11.10.5",
|
||||
"@fontsource/open-sans": "^4.5.13",
|
||||
"@fontsource/open-sans": "^5.0.2",
|
||||
"@jellyfin/sdk": "^0.8.2",
|
||||
"@mdi/js": "^7.2.96",
|
||||
"@mui/lab": "^5.0.0-alpha.128",
|
||||
@@ -20,7 +20,6 @@
|
||||
"@tanstack/react-query": "^4.26.1",
|
||||
"@tanstack/react-query-devtools": "^4.29.7",
|
||||
"@tauri-apps/api": "^1.2.0",
|
||||
"@videojs/http-streaming": "^3.0.2",
|
||||
"axios": "^1.4.0",
|
||||
"blurhash": "^2.0.5",
|
||||
"events": "^3.3.0",
|
||||
@@ -45,7 +44,6 @@
|
||||
"@types/react-dom": "^18.2.1",
|
||||
"@vitejs/plugin-react": "^4.0.0",
|
||||
"sass": "^1.62.1",
|
||||
"video.js": "^8.3.0",
|
||||
"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 |
-41
@@ -1,41 +0,0 @@
|
||||
#root {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 6em;
|
||||
padding: 1.5em;
|
||||
will-change: filter;
|
||||
}
|
||||
.logo:hover {
|
||||
filter: drop-shadow(0 0 2em #646cffaa);
|
||||
}
|
||||
.logo.react:hover {
|
||||
filter: drop-shadow(0 0 2em #61dafbaa);
|
||||
}
|
||||
|
||||
@keyframes logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
a:nth-of-type(2) .logo {
|
||||
animation: logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
.read-the-docs {
|
||||
color: #888;
|
||||
}
|
||||
@@ -31,19 +31,19 @@ export const CardScroller = ({
|
||||
slidesToSlide: displayCards + 1,
|
||||
},
|
||||
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,13 @@
|
||||
/** @format */
|
||||
|
||||
import SvgIcon from "@mui/material/SvgIcon";
|
||||
|
||||
import { mdiPlaySpeed } from "@mdi/js";
|
||||
|
||||
export const MdiPlaySpeed = (props) => {
|
||||
return (
|
||||
<SvgIcon {...props}>
|
||||
<path d={mdiPlaySpeed}></path>
|
||||
</SvgIcon>
|
||||
);
|
||||
};
|
||||
@@ -9,7 +9,11 @@ import IconButton from "@mui/material/IconButton";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Slider from "@mui/material/Slider";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Grow from "@mui/material/Grow";
|
||||
import Menu from "@mui/material/Menu";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import List from "@mui/material/List";
|
||||
import ListItem from "@mui/material/ListItem";
|
||||
import ListItemText from "@mui/material/ListItemText";
|
||||
import Backdrop from "@mui/material/Backdrop";
|
||||
|
||||
import ReactPlayer from "react-player";
|
||||
@@ -33,6 +37,7 @@ 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";
|
||||
|
||||
@@ -40,18 +45,34 @@ import useKeyPress from "../../utils/hooks/useKeyPress";
|
||||
|
||||
export const VideoPlayer = () => {
|
||||
const navigate = useNavigate();
|
||||
const [url, startPosition, itemDuration, itemId, itemName] =
|
||||
usePlaybackStore((state) => [
|
||||
state.url,
|
||||
state.startPosition,
|
||||
state.duration,
|
||||
state.itemId,
|
||||
state.itemName,
|
||||
]);
|
||||
|
||||
const [speedMenuEl, setSpeedMenuEl] = useState(null);
|
||||
const [speed, setSpeed] = useState(3);
|
||||
const speedMenuState = Boolean(speedMenuEl);
|
||||
const availableSpeeds = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
|
||||
|
||||
const [
|
||||
url,
|
||||
startPosition,
|
||||
itemDuration,
|
||||
itemId,
|
||||
itemName,
|
||||
subtitleTracks,
|
||||
] = usePlaybackStore((state) => [
|
||||
state.url,
|
||||
state.startPosition,
|
||||
state.duration,
|
||||
state.itemId,
|
||||
state.itemName,
|
||||
state.subtitleTracks,
|
||||
]);
|
||||
|
||||
var mySubtitle_arr = [];
|
||||
|
||||
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);
|
||||
@@ -75,8 +96,10 @@ export const VideoPlayer = () => {
|
||||
}, [isReady]);
|
||||
|
||||
const onProgress = async (e) => {
|
||||
setProgress(e.played);
|
||||
setCurrentTime(secToTicks(e.playedSeconds));
|
||||
if (!isSeeking) {
|
||||
setProgress(e.played);
|
||||
setCurrentTime(secToTicks(e.playedSeconds));
|
||||
}
|
||||
await getPlaystateApi(window.api).reportPlaybackProgress({
|
||||
playbackProgressInfo: {
|
||||
ItemId: itemId,
|
||||
@@ -84,6 +107,7 @@ export const VideoPlayer = () => {
|
||||
PositionTicks: secToTicks(e.playedSeconds),
|
||||
PlaybackStartTimeTicks: startPosition,
|
||||
VolumeLevel: volume * 100,
|
||||
IsPaused: !isPlaying,
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -136,6 +160,10 @@ export const VideoPlayer = () => {
|
||||
}
|
||||
}, [showControls]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log(subtitleTracks);
|
||||
}, [mySubtitle_arr]);
|
||||
|
||||
const handleKeyPress = useCallback((event) => {
|
||||
switch (event.key) {
|
||||
case "ArrowRight":
|
||||
@@ -229,6 +257,7 @@ export const VideoPlayer = () => {
|
||||
step={0.01}
|
||||
max={itemDuration}
|
||||
onChange={(e, newVal) => {
|
||||
setIsSeeking(true);
|
||||
setCurrentTime(newVal);
|
||||
}}
|
||||
onChangeCommitted={(e, newVal) => {
|
||||
@@ -236,6 +265,7 @@ export const VideoPlayer = () => {
|
||||
ticksToSec(newVal),
|
||||
);
|
||||
setCurrentTime(newVal);
|
||||
setIsSeeking(false);
|
||||
}}
|
||||
valueLabelDisplay="auto"
|
||||
valueLabelFormat={(value) =>
|
||||
@@ -315,90 +345,123 @@ export const VideoPlayer = () => {
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
>
|
||||
<Stack
|
||||
direction="row"
|
||||
width="15em"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
gap={1}
|
||||
sx={{
|
||||
transition: "250ms background",
|
||||
borderRadius: 20,
|
||||
"&:hover": {
|
||||
background: "rgb(0 0 0/0.5)",
|
||||
backdropFilter: "blur(5px)",
|
||||
},
|
||||
}}
|
||||
onMouseOver={() => setShowVolume(true)}
|
||||
onMouseOut={() => setShowVolume(false)}
|
||||
padding="0.25em 1em"
|
||||
>
|
||||
<Grow
|
||||
style={{
|
||||
transformOrigin:
|
||||
" right 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",
|
||||
}}
|
||||
in={showVolume}
|
||||
>
|
||||
<Slider
|
||||
value={volume * 100}
|
||||
step={1}
|
||||
max={100}
|
||||
onChange={(e, newVal) =>
|
||||
setVolume(newVal / 100)
|
||||
}
|
||||
valueLabelDisplay="auto"
|
||||
valueLabelFormat={(value) =>
|
||||
Math.floor(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)",
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</Grow>
|
||||
<IconButton
|
||||
sx={{
|
||||
ml: 0.1,
|
||||
mb: 20,
|
||||
}}
|
||||
onClick={() =>
|
||||
setIsMuted(!isMuted)
|
||||
>
|
||||
{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,
|
||||
)
|
||||
}
|
||||
>
|
||||
{isMuted ? (
|
||||
<MdiVolumeOff />
|
||||
) : (
|
||||
<MdiVolumeHigh />
|
||||
)}
|
||||
<MdiPlaySpeed />
|
||||
</IconButton>
|
||||
</Stack>
|
||||
</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)",
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>
|
||||
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
setIsPIP(!isPIP);
|
||||
@@ -439,6 +502,22 @@ export const VideoPlayer = () => {
|
||||
volume={volume}
|
||||
onBuffer={() => setIsBuffering(true)}
|
||||
onBufferEnd={() => setIsBuffering(false)}
|
||||
config={{
|
||||
file: {
|
||||
attributes: {
|
||||
crossOrigin: "true",
|
||||
},
|
||||
tracks: [
|
||||
{
|
||||
kind: "subtitles",
|
||||
src: `http://localhost:8096/Videos/${itemId}/${itemId}/Subtitles/0/0/Stream.vtt?api_key=${window.api.accessToken}`,
|
||||
srcLang: "en",
|
||||
default: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
}}
|
||||
playbackRate={availableSpeeds[speed]}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,22 @@ export const usePlaybackStore = create((set) => ({
|
||||
duration: 0,
|
||||
itemId: "",
|
||||
itemName: "",
|
||||
subtitleTracks: [],
|
||||
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: [
|
||||
{
|
||||
kind: "subtitles",
|
||||
src: `http://localhost:8096/Videos/e2d0ae00-f458-d4d4-7e09-1768ca0f485c/e2d0ae00f458d4d47e091768ca0f485c/Subtitles/0/0/Stream.vtt?api_key=${window.api.accessToken}`,
|
||||
srcLang: "en",
|
||||
default: true,
|
||||
},
|
||||
],
|
||||
})),
|
||||
}));
|
||||
Reference in new issue
Block a user