Update ItemPage ui and more...

This commit is contained in:
prayag17 committed 2023-06-06 14:04:23 +05:30
1 parent 19ff2af29b
commit e4ade5659c
19 files changed
+1347 -1209

No files matched your search

-3
View File
@@ -38,9 +38,6 @@ const About = () => {
className="scrollY"
sx={{
flexGrow: 1,
pt: 11,
px: 3,
pb: 3,
position: "relative",
}}
>
-3
View File
@@ -204,9 +204,6 @@ const Home = () => {
className="scrollY"
sx={{
flexGrow: 1,
pt: 11,
px: 3,
pb: 3,
position: "relative",
}}
>
+423 -387
View File
@@ -66,6 +66,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 { useBackdropStore } from "../../utils/store/backdrop";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -518,8 +519,12 @@ const ItemDetail = () => {
state.setDuration,
state.setItemId,
state.setItemName,
state.setItemName,
,
]);
const [setHash] = useBackdropStore((state) => [state.setHash]);
const [directors, setDirectors] = useState([]);
const [writers, setWriters] = useState([]);
useEffect(() => {
@@ -532,9 +537,31 @@ const ItemDetail = () => {
(itm) => itm.Type == "Writer",
);
setWriters(writeTp);
if (!!item.data.ParentBackdropImageTags) {
setHash(
item.data.ImageBlurHashes.Backdrop[
item.data.ParentBackdropImageTags[0]
],
);
} else if (item.data.BackdropImageTags.length != 0) {
setHash(
item.data.ImageBlurHashes.Backdrop[
item.data.BackdropImageTags[0]
],
);
} else {
setHash("LGJCbc|t1s1}1{JU|y,uAo=3,s$Q");
}
}
}, [item.isSuccess]);
const [crew, setCrew] = useState([]);
useEffect(() => {
setCrew(directors.concat(...writers));
}, [writers, directors]);
if (item.isLoading || similarItems.isLoading) {
return (
<Box
@@ -553,54 +580,12 @@ const ItemDetail = () => {
if (item.isSuccess && similarItems.isSuccess) {
return (
<>
<Box className="item-detail-backdrop">
{item.data.BackdropImageTags.length != 0 && (
<Blurhash
hash={
item.data.ImageBlurHashes.Backdrop[
item.data.BackdropImageTags[0]
]
}
width="100%"
height="100%"
resolutionX={14}
resolutionY={22}
style={{
aspectRatio: "0.666",
}}
punch={1}
className="item-detail-image-blurhash"
/>
)}
{!!item.data.ParentBackdropImageTags &&
item.data.ParentBackdropImageTags.length != 0 && (
<Blurhash
hash={
item.data.ImageBlurHashes.Backdrop[
item.data
.ParentBackdropImageTags[0]
]
}
width="100%"
height="100%"
resolutionX={14}
resolutionY={22}
style={{
aspectRatio: "0.666",
}}
punch={1}
className="item-detail-image-blurhash"
/>
)}
</Box>
<Box
recomponent="main"
className="scrollY"
sx={{
display: "flex",
pt: 11,
px: 3,
pb: 3,
display: "flex",
position: "relative",
flexFlow: "column",
}}
@@ -608,15 +593,9 @@ const ItemDetail = () => {
<Box
className="item-detail-header"
mb={2}
paddingTop={
item.data.Type.includes("Music") ||
item.data.Type === BaseItemKind.Episode ||
!!item.data.PrimaryImageAspectRatio
? 10
: 0
}
paddingTop={5}
>
<Box className="item-detail-header-backdrop">
{/* <Box className="item-detail-header-backdrop">
{item.data.Type != BaseItemKind.MusicAlbum &&
item.data.Type != BaseItemKind.Episode
? item.data.BackdropImageTags.length !=
@@ -691,7 +670,7 @@ const ItemDetail = () => {
>
{TypeIconCollectionCard[item.data.Type]}
</Box>
</Box>
</Box> */}
<Box
className="item-detail-info-container"
@@ -703,7 +682,7 @@ const ItemDetail = () => {
item.data.Type ===
BaseItemKind.Episode
? "center !important"
: "flex-end",
: "flex-start",
justifyContent: "flex-start",
width: "100%",
}}
@@ -788,351 +767,420 @@ const ItemDetail = () => {
}
</div>
</Box>
<Box
sx={{
display: "flex",
flexDirection: "column",
}}
<Stack
direction="column"
alignItems="flex-start"
gap={2}
mt={2}
>
<Box
className="item-detail-title-name"
sx={{ mb: 1 }}
>
{item.data.Type ===
BaseItemKind.Episode && (
<Link
component={RouterLink}
to={`/item/${item.data.SeriesId}`}
variant="h3"
textOverflow="ellipsis"
whiteSpace="nowrap"
width="100%"
color="inherit"
underline="hover"
mb={1}
>
{!!item.data
.ParentLogoItemId ? (
<img
className="item-detail-title-logo"
src={`${window.api.basePath}/Items/${item.data.SeriesId}/Images/Logo?cropWhitespace=True&quality=80&tag=${item.data.ParentLogoImageTag}`}
/>
) : (
item.data.SeriesName
)}
</Link>
)}
{item.data.Type ===
BaseItemKind.Episode ? (
<Typography
variant="h4"
textOverflow="ellipsis"
whiteSpace="nowrap"
width="100%"
sx={{ opacity: 0.7 }}
>
{`S${item.data.ParentIndexNumber}:E${item.data.IndexNumber} - ${item.data.Name}`}
</Typography>
) : (
<Typography
variant="h3"
textOverflow="ellipsis"
whiteSpace="nowrap"
width="100%"
>
{!!item.data.ImageTags
.Logo ? (
<img
className="item-detail-title-logo"
src={`${window.api.basePath}/Items/${item.data.Id}/Images/Logo?cropWhitespace=True&quality=80&tag=${item.data.ImageTags.Logo}`}
/>
) : (
item.data.Name
)}
</Typography>
)}
<Typography
variant="h6"
sx={{ opacity: 0.7 }}
>
{item.data.OriginalTitle}
</Typography>
{!!item.data.AlbumArtists && (
<Stack
direction="row"
gap={0.5}
divider={
<Typography variant="h6">
,
</Typography>
}
>
{item.data.AlbumArtists.map(
(
artist,
aindex,
) => {
return (
<Link
component={
RouterLink
}
variant="h6"
sx={{
opacity: 0.7,
}}
color="inherit"
key={
aindex
}
to={`/item/${artist.Id}`}
>
{
artist.Name
}
</Link>
);
},
)}
</Stack>
)}
</Box>
<Stack
direction="row"
gap={2}
divider={
<Divider
variant="middle"
flexItem
orientation="vertical"
/>
}
sx={{
alignItems: "center",
width: "100%",
display: "flex",
flexDirection: "column",
}}
>
{item.data.Type != "MusicArtist" &&
item.data.ProductionYear && (
<Typography
sx={{ flexGrow: 0 }}
variant="subtitle1"
>
{
item.data
.ProductionYear
<Box
className="item-detail-title-name"
sx={{ mb: 1 }}
>
{item.data.Type ===
BaseItemKind.Episode && (
<Link
component={
RouterLink
}
to={`/item/${item.data.SeriesId}`}
variant="h3"
textOverflow="ellipsis"
whiteSpace="nowrap"
width="100%"
color="inherit"
underline="hover"
mb={1}
>
{!!item.data
.ParentLogoItemId ? (
<img
className="item-detail-title-logo"
src={`${window.api.basePath}/Items/${item.data.SeriesId}/Images/Logo?cropWhitespace=True&quality=80&tag=${item.data.ParentLogoImageTag}`}
/>
) : (
item.data
.SeriesName
)}
</Link>
)}
{item.data.Type ===
BaseItemKind.Episode ? (
<Typography
variant="h4"
textOverflow="ellipsis"
whiteSpace="nowrap"
width="100%"
sx={{
opacity: 0.7,
}}
>
{`S${item.data.ParentIndexNumber}:E${item.data.IndexNumber} - ${item.data.Name}`}
</Typography>
) : (
<Typography
variant="h3"
textOverflow="ellipsis"
whiteSpace="nowrap"
width="100%"
>
{!!item.data
.ImageTags
.Logo ? (
<img
className="item-detail-title-logo"
src={`${window.api.basePath}/Items/${item.data.Id}/Images/Logo?cropWhitespace=True&quality=80&tag=${item.data.ImageTags.Logo}`}
/>
) : (
item.data.Name
)}
</Typography>
)}
{item.data.Type !=
"MusicArtist" && (
<Chip
variant="outlined"
label={
!!item.data
.OfficialRating
? item.data
.OfficialRating
: "Not Rated"
}
/>
)}
{item.data.Type !=
"MusicArtist" && (
<Box
<Typography
variant="h6"
sx={{
display: "flex",
gap: "0.25em",
alignItems:
"center",
opacity: 0.7,
}}
className="item-detail-info-rating"
>
{!!item.data
.CommunityRating ? (
<>
<MdiStar
sx={{
color: yellow[700],
}}
/>
<Typography variant="subtitle1">
{Math.round(
item
.data
.CommunityRating *
10,
) / 10}
{item.data.OriginalTitle}
</Typography>
{!!item.data.AlbumArtists && (
<Stack
direction="row"
gap={0.5}
divider={
<Typography variant="h6">
,
</Typography>
</>
) : (
<Typography variant="subtitle1">
No Community
Rating
}
>
{item.data.AlbumArtists.map(
(
artist,
aindex,
) => {
return (
<Link
component={
RouterLink
}
variant="h6"
sx={{
opacity: 0.7,
}}
color="inherit"
key={
aindex
}
to={`/item/${artist.Id}`}
>
{
artist.Name
}
</Link>
);
},
)}
</Stack>
)}
</Box>
<Stack
direction="row"
gap={2}
divider={
<Divider
variant="middle"
flexItem
orientation="vertical"
/>
}
sx={{
alignItems: "center",
width: "100%",
}}
>
{item.data.Type !=
"MusicArtist" &&
item.data
.ProductionYear && (
<Typography
sx={{
flexGrow: 0,
}}
variant="subtitle1"
>
{
item.data
.ProductionYear
}
</Typography>
)}
</Box>
)}
{!!item.data.RunTimeTicks && (
<Typography variant="subtitle1">
{getRuntimeFull(
item.data
.RunTimeTicks,
)}
</Typography>
)}
{!!item.data.RunTimeTicks && (
<Typography variant="subtitle1">
{endsAt(
item.data
.RunTimeTicks,
)}
</Typography>
)}
</Stack>
</Box>
<Stack
direction="row"
gap={1}
alignItems="center"
justifyContent="center"
ml="auto"
mr={2}
>
{item.data.Type != "Person" &&
!item.data.Type.includes(
"Music",
) && (
<>
<Button
variant="contained"
size="large"
startIcon={
<MdiPlayOutline />
{item.data.Type !=
"MusicArtist" && (
<Chip
variant="outlined"
label={
!!item.data
.OfficialRating
? item
.data
.OfficialRating
: "Not Rated"
}
/>
)}
{item.data.Type !=
"MusicArtist" && (
<Box
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,
);
setDuration(
item
.data
.RunTimeTicks,
);
}
navigate(
`/player`,
);
display: "flex",
gap: "0.25em",
alignItems:
"center",
}}
className="item-detail-info-rating"
>
{!!item.data
.UserData
.PlayedPercentage &&
item.data.UserData
.PlayedPercentage >
0
? "Resume"
: "Play"}
{!!item.data
.UserData
.PlayedPercentage && (
<LinearProgress
variant="determinate"
value={
item
.CommunityRating ? (
<>
<MdiStar
sx={{
color: yellow[700],
}}
/>
<Typography variant="subtitle1">
{Math.round(
item
.data
.CommunityRating *
10,
) /
10}
</Typography>
</>
) : (
<Typography variant="subtitle1">
No
Community
Rating
</Typography>
)}
</Box>
)}
{!!item.data.RunTimeTicks && (
<Typography variant="subtitle1">
{getRuntimeFull(
item.data
.RunTimeTicks,
)}
</Typography>
)}
{!!item.data.RunTimeTicks && (
<Typography variant="subtitle1">
{endsAt(
item.data
.RunTimeTicks,
)}
</Typography>
)}
</Stack>
</Box>
<Box
className="item-detail-tagline"
sx={{ width: "100%" }}
>
<Typography
variant="h5"
fontStyle="italic"
sx={{ opacity: 0.7 }}
>
{item.data.Taglines[0]}
</Typography>
</Box>
{item.data.Genres.length != 0 && (
<Stack direction="row" gap={1}>
{item.data.Genres.map(
(genre, index) => {
return (
<Chip
key={
index
}
variant="filled"
label={
genre
}
/>
);
},
)}
</Stack>
)}
{!!item.data.Overview && (
<Box>
<Typography
variant="body1"
sx={{
opacity: 0.8,
}}
mb={2}
>
{item.data.Overview}
</Typography>
</Box>
)}
<Stack
direction="row"
gap={1}
alignItems="center"
justifyContent="center"
>
{item.data.Type != "Person" &&
!item.data.Type.includes(
"Music",
) && (
<>
<Button
variant="contained"
size="large"
startIcon={
<MdiPlayOutline />
}
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,
);
setDuration(
item
.data
.RunTimeTicks,
);
if (
subtitleTracks.length !=
0
) {
// setSubtitleTracks(
// {
// 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,
// },
// );
setSubtitleTracks();
}
}
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>
<IconButton
onClick={
handleMarkPlayedOrunPlayed
}
>
<MdiCheck
sx={{
color: item
.data
.UserData
.PlayedPercentage
}
color="white"
sx={{
position:
"absolute",
height: "100%",
width: "100%",
background:
"transparent",
zIndex: "0",
opacity: 0.2,
.Played
? green[400]
: "white",
}}
/>
)}
</Button>
<IconButton
onClick={
handleMarkPlayedOrunPlayed
}
>
<MdiCheck
sx={{
color: item
.data
.UserData
.Played
? green[400]
: "white",
}}
/>
</IconButton>
</>
)}
<IconButton onClick={handleLiking}>
{item.data.UserData.IsFavorite ? (
<MdiHeart
sx={{ color: pink[700] }}
/>
) : (
<MdiHeartOutline />
)}
</IconButton>
</IconButton>
</>
)}
<IconButton onClick={handleLiking}>
{item.data.UserData
.IsFavorite ? (
<MdiHeart
sx={{
color: pink[700],
}}
/>
) : (
<MdiHeartOutline />
)}
</IconButton>
</Stack>
</Stack>
</Box>
<Box
className="item-detail-tagline"
sx={{ width: "100%" }}
>
<Typography
variant="h5"
fontStyle="italic"
sx={{ opacity: 0.8 }}
>
{item.data.Taglines[0]}
</Typography>
</Box>
</Box>
<TableContainer>
<Table>
<TableBody>
{item.data.Genres != 0 && (
{/* {item.data.Genres != 0 && (
<TableRow
sx={{
"& td, & th": {
@@ -1180,7 +1228,7 @@ const ItemDetail = () => {
</Stack>
</TableCell>
</TableRow>
)}
)} */}
{item.data.ExternalUrls.length != 0 && (
<TableRow
@@ -1716,20 +1764,6 @@ const ItemDetail = () => {
</TableBody>
</Table>
</TableContainer>
{!!item.data.Overview && (
<Box mt={3}>
<Typography variant="h5" mb={1}>
Overview
</Typography>
<Typography
variant="body1"
sx={{ opacity: 0.8 }}
mb={2}
>
{item.data.Overview}
</Typography>
</Box>
)}
{item.data.Type == BaseItemKind.MusicAlbum && (
<TableContainer
@@ -2684,7 +2718,9 @@ const ItemDetail = () => {
label={
episodes.isLoading ? (
<CircularProgress
sx={{ p: 1.5 }}
sx={{
p: 1.5,
}}
/>
) : (
episodes.data
@@ -2753,7 +2789,7 @@ const ItemDetail = () => {
duration: 0.35,
delay:
mindex *
0.1,
0.03,
}}
>
<EpisodeCard
@@ -3161,7 +3197,7 @@ const ItemDetail = () => {
variant: "h5",
fontSize: "1.8em",
}}
displayCards={8}
displayCards={12}
title="Cast"
disableDecoration
boxProps={{
+6 -6
View File
@@ -17,7 +17,7 @@
display: flex;
gap: 1em;
justify-content: flex-start;
align-items: flex-end;
align-items: flex-start;
position: relative;
flex-wrap: wrap;
&-backdrop {
@@ -30,11 +30,11 @@
left: -24px;
z-index: -2;
filter: brightness(0.6);
mask-image: linear-gradient(0deg, transparent, black 75%);
mask-image: linear-gradient(to bottom, black 75%, transparent);
-webkit-mask-image: linear-gradient(
0deg,
transparent,
black 75%
to bottom,
black 75%,
transparent
);
}
}
@@ -49,7 +49,7 @@
z-index: -1;
}
&-container {
width: 15%;
width: 20%;
flex-shrink: 0;
position: relative;
border-radius: $border-radius-default;
File diff suppressed because it is too large. Load diff
+168 -89
View File
@@ -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>
);
+13
View File
@@ -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);
}
}