feat: show upNext card for episode items in player
This commit is contained in:
8 files changed
+414
-212
No files matched your search
@@ -108,9 +108,14 @@ const PlayButton = ({
|
|||||||
case BaseItemKind.Episode:
|
case BaseItemKind.Episode:
|
||||||
result = await getTvShowsApi(api).getEpisodes({
|
result = await getTvShowsApi(api).getEpisodes({
|
||||||
seriesId: item.SeriesId,
|
seriesId: item.SeriesId,
|
||||||
fields: [ItemFields.MediaSources, ItemFields.MediaStreams],
|
fields: [
|
||||||
|
ItemFields.MediaSources,
|
||||||
|
ItemFields.MediaStreams,
|
||||||
|
ItemFields.Overview,
|
||||||
|
],
|
||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
|
seasonId: item.SeasonId,
|
||||||
// startItemId: item.Id,
|
// startItemId: item.Id,
|
||||||
});
|
});
|
||||||
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
|
||||||
@@ -142,11 +147,29 @@ const PlayButton = ({
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
introInfo = (
|
||||||
|
await axiosClient.get(
|
||||||
|
`${api.basePath}/Episode/${result.data.Items?.[0]?.Id}/IntroSkipperSegments`,
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
Authorization: `MediaBrowser Token=${api.accessToken}`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
)?.data;
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case BaseItemKind.Series:
|
case BaseItemKind.Series:
|
||||||
result = await getTvShowsApi(api).getEpisodes({
|
result = await getTvShowsApi(api).getEpisodes({
|
||||||
seriesId: itemId,
|
seriesId: itemId,
|
||||||
fields: [ItemFields.MediaSources, ItemFields.MediaStreams],
|
fields: [
|
||||||
|
ItemFields.MediaSources,
|
||||||
|
ItemFields.MediaStreams,
|
||||||
|
ItemFields.Overview,
|
||||||
|
],
|
||||||
enableUserData: true,
|
enableUserData: true,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
});
|
});
|
||||||
@@ -166,7 +189,7 @@ const PlayButton = ({
|
|||||||
try {
|
try {
|
||||||
introInfo = (
|
introInfo = (
|
||||||
await axiosClient.get(
|
await axiosClient.get(
|
||||||
`${api.basePath}/Episode/${result.data.Items?.[0]?.Id}/IntroTimestamps`,
|
`${api.basePath}/Episode/${result.data.Items?.[0]?.Id}/IntroSkipperSegments`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `MediaBrowser Token=${api.accessToken}`,
|
Authorization: `MediaBrowser Token=${api.accessToken}`,
|
||||||
@@ -251,7 +274,7 @@ const PlayButton = ({
|
|||||||
api_key: api?.accessToken,
|
api_key: api?.accessToken,
|
||||||
};
|
};
|
||||||
const urlParams = new URLSearchParams(urlOptions).toString();
|
const urlParams = new URLSearchParams(urlOptions).toString();
|
||||||
|
|
||||||
const playbackUrl = `${api.basePath}/Audio/${result?.item.Items[0].Id}/universal?${urlParams}`;
|
const playbackUrl = `${api.basePath}/Audio/${result?.item.Items[0].Id}/universal?${urlParams}`;
|
||||||
playAudio(playbackUrl, result?.item.Items[0], undefined);
|
playAudio(playbackUrl, result?.item.Items[0], undefined);
|
||||||
setQueue(result?.item.Items ?? [], 0);
|
setQueue(result?.item.Items ?? [], 0);
|
||||||
@@ -272,7 +295,6 @@ const PlayButton = ({
|
|||||||
currentSubTrack,
|
currentSubTrack,
|
||||||
result?.mediaSource.MediaSources?.[0].MediaStreams,
|
result?.mediaSource.MediaSources?.[0].MediaStreams,
|
||||||
);
|
);
|
||||||
console.log(subtitle);
|
|
||||||
// URL generation
|
// URL generation
|
||||||
const urlOptions = {
|
const urlOptions = {
|
||||||
Static: true,
|
Static: true,
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ const Carousel = ({
|
|||||||
setCurrentSlide(index);
|
setCurrentSlide(index);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{item.ImageTags?.Primary ? (
|
{item.ImageTags?.Thumb ? (
|
||||||
<img
|
<img
|
||||||
src={api.getItemImageUrl(item.Id, "Thumb", {
|
src={api.getItemImageUrl(item.Id, "Thumb", {
|
||||||
tag: item.ImageTags.Primary,
|
tag: item.ImageTags.Primary,
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
import { playItemFromQueue, usePlaybackStore } from "@/utils/store/playback";
|
||||||
|
import useQueue from "@/utils/store/queue";
|
||||||
|
import { Button, Typography } from "@mui/material";
|
||||||
|
import React from "react";
|
||||||
|
import { getTypeIcon } from "../utils/iconsCollection";
|
||||||
|
|
||||||
|
import "./outroCard.scss";
|
||||||
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
|
const OutroCard = (props: { handleShowCredits: () => void }) => {
|
||||||
|
const api = useApiInContext((s) => s.api);
|
||||||
|
const [nextItemIndex, queueItems] = useQueue((s) => [
|
||||||
|
s.currentItemIndex,
|
||||||
|
s.tracks,
|
||||||
|
]);
|
||||||
|
const item = queueItems[nextItemIndex + 1];
|
||||||
|
const user = useQuery({
|
||||||
|
queryKey: ["user"],
|
||||||
|
queryFn: async () => {
|
||||||
|
const result = await getUserApi(api).getCurrentUser();
|
||||||
|
return result.data;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const handlePlayNext = useMutation({
|
||||||
|
mutationKey: ["playNextButton"],
|
||||||
|
mutationFn: () => playItemFromQueue("next", user.data?.Id, api),
|
||||||
|
onError: (error) => [console.error(error)],
|
||||||
|
});
|
||||||
|
return (
|
||||||
|
<div className="outro-card">
|
||||||
|
<Typography variant="h4">Up Next</Typography>
|
||||||
|
<div className="outro-card-content">
|
||||||
|
{item?.ImageTags?.Primary ? (
|
||||||
|
<img
|
||||||
|
className="outro-card-content-image"
|
||||||
|
alt={item.Name ?? "Cover"}
|
||||||
|
src={api.getItemImageUrl(item.Id, "Primary", {
|
||||||
|
tag: item.ImageTags.Primary,
|
||||||
|
quality: 80,
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<div className="outro-card-content-image icon">
|
||||||
|
{getTypeIcon(item?.Type)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<Typography variant="h5" className="outro-card-content-title">
|
||||||
|
{item.Name}
|
||||||
|
</Typography>
|
||||||
|
<Typography variant="subtitle2" className="outro-card-content-overview">
|
||||||
|
{item.Overview}
|
||||||
|
</Typography>
|
||||||
|
<div className="outro-card-content-buttons">
|
||||||
|
<Button
|
||||||
|
onClick={handlePlayNext.mutate}
|
||||||
|
color="white"
|
||||||
|
variant="contained"
|
||||||
|
startIcon={
|
||||||
|
<div
|
||||||
|
className="material-symbols-rounded fill"
|
||||||
|
style={{
|
||||||
|
zIndex: 1,
|
||||||
|
fontSize: "2em",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
play_arrow
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Play Now
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
onClick={props.handleShowCredits}
|
||||||
|
color="white"
|
||||||
|
variant="outlined"
|
||||||
|
>
|
||||||
|
Watch Credits
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default OutroCard;
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
.outro-card {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 0 5vw 2em 5vw;
|
||||||
|
gap: 1.2em;
|
||||||
|
background: linear-gradient(to top, rgb(10 10 10), rgb(10 10 10 / 0.7) 50%, transparent);
|
||||||
|
padding-top: 25vh;
|
||||||
|
|
||||||
|
&-content {
|
||||||
|
display: grid;
|
||||||
|
grid-template-areas: "img title"
|
||||||
|
"img info"
|
||||||
|
"img buttons";
|
||||||
|
grid-template-columns: 20em 1fr;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1em;
|
||||||
|
|
||||||
|
&-image {
|
||||||
|
grid-area: img;
|
||||||
|
max-height: 14em;
|
||||||
|
width: 20em;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: $border-radius-default;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-title {
|
||||||
|
grid-area: title;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-overview {
|
||||||
|
grid-area: info;
|
||||||
|
display: -webkit-box;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
-webkit-line-clamp: 3;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-buttons {
|
||||||
|
grid-area: buttons;
|
||||||
|
display: flex;
|
||||||
|
gap: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -38,6 +38,7 @@ import heroBg from "@/assets/herobg.png";
|
|||||||
import "./boxset.scss";
|
import "./boxset.scss";
|
||||||
|
|
||||||
import IconLink from "@/components/iconLink";
|
import IconLink from "@/components/iconLink";
|
||||||
|
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||||
import { createFileRoute } from "@tanstack/react-router";
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
function TabPanel(props) {
|
function TabPanel(props) {
|
||||||
|
|||||||
+235
-200
@@ -39,6 +39,7 @@ import wasmUrl from "jassub/dist/jassub-worker.wasm?url";
|
|||||||
import PlayNextButton from "@/components/buttons/playNextButton";
|
import PlayNextButton from "@/components/buttons/playNextButton";
|
||||||
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
|
||||||
import QueueButton from "@/components/buttons/queueButton";
|
import QueueButton from "@/components/buttons/queueButton";
|
||||||
|
import OutroCard from "@/components/outroCard";
|
||||||
import { createFileRoute, useRouter } from "@tanstack/react-router";
|
import { createFileRoute, useRouter } from "@tanstack/react-router";
|
||||||
import type { OnProgressProps } from "react-player/base";
|
import type { OnProgressProps } from "react-player/base";
|
||||||
import subtitleFont from "./Noto-Sans-Indosphere.ttf";
|
import subtitleFont from "./Noto-Sans-Indosphere.ttf";
|
||||||
@@ -64,7 +65,7 @@ const ticksDisplay = (ticks: number) => {
|
|||||||
})}`;
|
})}`;
|
||||||
return formatedTime;
|
return formatedTime;
|
||||||
};
|
};
|
||||||
const VOLUME_SCROLL_INTERVAL = 0.05
|
const VOLUME_SCROLL_INTERVAL = 0.05;
|
||||||
|
|
||||||
export const Route = createFileRoute("/_api/player/")({
|
export const Route = createFileRoute("/_api/player/")({
|
||||||
component: VideoPlayer,
|
component: VideoPlayer,
|
||||||
@@ -116,8 +117,8 @@ function VideoPlayer() {
|
|||||||
|
|
||||||
useEffect(() => setBackdrop("", ""), []);
|
useEffect(() => setBackdrop("", ""), []);
|
||||||
|
|
||||||
const [clickTimeout, setClickTimeout] = useState<NodeJS.Timeout>(null)
|
const [clickTimeout, setClickTimeout] = useState<NodeJS.Timeout>(null);
|
||||||
|
|
||||||
const showSubtitles = useMemo(
|
const showSubtitles = useMemo(
|
||||||
() => mediaSource.subtitle.enable,
|
() => mediaSource.subtitle.enable,
|
||||||
[mediaSource.subtitle],
|
[mediaSource.subtitle],
|
||||||
@@ -164,14 +165,14 @@ function VideoPlayer() {
|
|||||||
PlaybackStartTimeTicks: startPosition,
|
PlaybackStartTimeTicks: startPosition,
|
||||||
PositionTicks: secToTicks(event.playedSeconds),
|
PositionTicks: secToTicks(event.playedSeconds),
|
||||||
RepeatMode: RepeatMode.RepeatNone,
|
RepeatMode: RepeatMode.RepeatNone,
|
||||||
VolumeLevel: volume * 100,
|
VolumeLevel: Math.floor(volume * 100),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleExitPlayer = async () => {
|
const handleExitPlayer = async () => {
|
||||||
appWindow.getCurrent().setFullscreen(false);
|
appWindow.getCurrent().setFullscreen(false);
|
||||||
|
|
||||||
history.back();
|
history.back();
|
||||||
// Report Jellyfin server: Playback has ended/stopped
|
// Report Jellyfin server: Playback has ended/stopped
|
||||||
getPlaystateApi(api).reportPlaybackStopped({
|
getPlaystateApi(api).reportPlaybackStopped({
|
||||||
@@ -246,28 +247,27 @@ function VideoPlayer() {
|
|||||||
};
|
};
|
||||||
}, [handleKeyPress]);
|
}, [handleKeyPress]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleMouseWheel = (event: WheelEvent) => {
|
const handleMouseWheel = (event: WheelEvent) => {
|
||||||
console.log(event.deltaY);
|
console.log(event.deltaY);
|
||||||
|
|
||||||
if (event.deltaY < 0) {
|
if (event.deltaY < 0) {
|
||||||
// increase volume
|
// increase volume
|
||||||
setVolume((state) => Math.min(1, state + VOLUME_SCROLL_INTERVAL))
|
setVolume((state) => Math.min(1, state + VOLUME_SCROLL_INTERVAL));
|
||||||
} else if (event.deltaY > 0) {
|
} else if (event.deltaY > 0) {
|
||||||
// decrease volume
|
// decrease volume
|
||||||
setVolume((state) => Math.max(0, state - VOLUME_SCROLL_INTERVAL))
|
setVolume((state) => Math.max(0, state - VOLUME_SCROLL_INTERVAL));
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// attach the event listener
|
// attach the event listener
|
||||||
document.addEventListener("wheel", handleMouseWheel);
|
document.addEventListener("wheel", handleMouseWheel);
|
||||||
|
|
||||||
// remove the event listener
|
// remove the event listener
|
||||||
return () => {
|
return () => {
|
||||||
document.removeEventListener("wheel", handleMouseWheel);
|
document.removeEventListener("wheel", handleMouseWheel);
|
||||||
}
|
};
|
||||||
}, [])
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
setPlaying(true);
|
setPlaying(true);
|
||||||
@@ -321,17 +321,43 @@ function VideoPlayer() {
|
|||||||
|
|
||||||
const showSkipIntroButton = useMemo(() => {
|
const showSkipIntroButton = useMemo(() => {
|
||||||
if (
|
if (
|
||||||
ticksToSec(progress) >= introInfo?.ShowSkipPromptAt &&
|
ticksToSec(progress) >=
|
||||||
ticksToSec(progress) < introInfo?.HideSkipPromptAt
|
(introInfo?.Introduction?.ShowSkipPromptAt ?? 0) &&
|
||||||
|
ticksToSec(progress) < (introInfo?.Introduction?.HideSkipPromptAt ?? 0)
|
||||||
)
|
)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}, [progress]);
|
}, [progress]);
|
||||||
|
|
||||||
|
const showUpNextCard = useMemo(() => {
|
||||||
|
if (introInfo?.Credits) {
|
||||||
|
if (
|
||||||
|
ticksToSec(progress) >= introInfo?.Credits.ShowSkipPromptAt &&
|
||||||
|
ticksToSec(progress) < introInfo?.Credits.HideSkipPromptAt
|
||||||
|
)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
Math.ceil(ticksToSec(itemDuration) - ticksToSec(progress)) <= 30 &&
|
||||||
|
Math.ceil(ticksToSec(itemDuration) - ticksToSec(progress)) > 0
|
||||||
|
) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}, [progress, item?.Id]);
|
||||||
|
|
||||||
const handleSkipIntro = useCallback(() => {
|
const handleSkipIntro = useCallback(() => {
|
||||||
player.current?.seekTo(introInfo?.IntroEnd);
|
player.current?.seekTo(
|
||||||
|
introInfo?.Introduction.IntroEnd ?? player.current?.getCurrentTime(),
|
||||||
|
);
|
||||||
}, [item?.Id]);
|
}, [item?.Id]);
|
||||||
|
|
||||||
|
const [forceShowCredits, setForceShowCredits] = useState(false);
|
||||||
|
const handleShowCredits = useCallback(() => {
|
||||||
|
setForceShowCredits(true);
|
||||||
|
}, []);
|
||||||
|
useEffect(() => setForceShowCredits(false), [item?.Id]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="video-player">
|
<div className="video-player">
|
||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
@@ -374,6 +400,9 @@ function VideoPlayer() {
|
|||||||
Skip Intro
|
Skip Intro
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
{!forceShowCredits && showUpNextCard && (
|
||||||
|
<OutroCard handleShowCredits={handleShowCredits} />
|
||||||
|
)}
|
||||||
<motion.div
|
<motion.div
|
||||||
className={
|
className={
|
||||||
hoveringOsd || !playing || isSeeking
|
hoveringOsd || !playing || isSeeking
|
||||||
@@ -390,24 +419,25 @@ function VideoPlayer() {
|
|||||||
style={{
|
style={{
|
||||||
zIndex: 2,
|
zIndex: 2,
|
||||||
}}
|
}}
|
||||||
onClick={(event) => {
|
onClick={(event) => {
|
||||||
if (event.currentTarget !== event.target) {
|
if (event.currentTarget !== event.target) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.detail === 1) {
|
if (event.detail === 1) {
|
||||||
setClickTimeout(
|
setClickTimeout(
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setPlaying((state) => !state);
|
setPlaying((state) => !state);
|
||||||
}, 200))
|
}, 200),
|
||||||
} else if (event.detail === 2){
|
);
|
||||||
clearTimeout(clickTimeout)
|
} else if (event.detail === 2) {
|
||||||
setAppFullscreen((state) => {
|
clearTimeout(clickTimeout);
|
||||||
appWindow.getCurrent().setFullscreen(!state);
|
setAppFullscreen((state) => {
|
||||||
return !state
|
appWindow.getCurrent().setFullscreen(!state);
|
||||||
});
|
return !state;
|
||||||
}
|
});
|
||||||
}}
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<div className="video-player-osd-header flex flex-justify-spaced-between flex-align-center">
|
<div className="video-player-osd-header flex flex-justify-spaced-between flex-align-center">
|
||||||
<IconButton onClick={handleExitPlayer}>
|
<IconButton onClick={handleExitPlayer}>
|
||||||
@@ -459,172 +489,177 @@ function VideoPlayer() {
|
|||||||
</TextField>
|
</TextField>
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
<div className="video-player-osd-info">
|
{(forceShowCredits || !showUpNextCard) && (
|
||||||
<Typography variant="h4" fontWeight={500} mb={2}>
|
<div className="video-player-osd-info">
|
||||||
{itemName}
|
<Typography variant="h4" fontWeight={500} mb={2}>
|
||||||
{episodeTitle && (
|
{itemName}
|
||||||
<Typography variant="h6" fontWeight={300} mt={1}>
|
{episodeTitle && (
|
||||||
{episodeTitle}
|
<Typography variant="h6" fontWeight={300} mt={1}>
|
||||||
</Typography>
|
{episodeTitle}
|
||||||
)}
|
</Typography>
|
||||||
</Typography>
|
)}
|
||||||
<div className="video-player-osd-controls">
|
</Typography>
|
||||||
<div className="video-player-osd-controls-progress">
|
<div className="video-player-osd-controls">
|
||||||
<Slider
|
<div className="video-player-osd-controls-progress">
|
||||||
value={isSeeking ? sliderProgress : progress}
|
<Slider
|
||||||
max={itemDuration}
|
value={isSeeking ? sliderProgress : progress}
|
||||||
step={secToTicks(1)}
|
max={itemDuration}
|
||||||
onChange={(e, newValue) => {
|
step={secToTicks(10)}
|
||||||
setIsSeeking(true);
|
onChange={(e, newValue) => {
|
||||||
setSliderProgress(newValue);
|
setIsSeeking(true);
|
||||||
}}
|
setSliderProgress(newValue);
|
||||||
onChangeCommitted={(e, newValue) => {
|
}}
|
||||||
setIsSeeking(false);
|
onChangeCommitted={(e, newValue) => {
|
||||||
setProgress(newValue);
|
setIsSeeking(false);
|
||||||
player.current.seekTo(ticksToSec(newValue), "seconds");
|
setProgress(newValue);
|
||||||
}}
|
player.current?.seekTo(ticksToSec(newValue), "seconds");
|
||||||
sx={{
|
}}
|
||||||
"& .MuiSlider-thumb": {
|
sx={{
|
||||||
width: 14,
|
"& .MuiSlider-thumb": {
|
||||||
height: 14,
|
width: 14,
|
||||||
transition: "0.1s ease-in-out",
|
height: 14,
|
||||||
opacity: 0,
|
transition: "0.1s ease-in-out",
|
||||||
"&.Mui-active": {
|
opacity: 0,
|
||||||
width: 20,
|
"&.Mui-active": {
|
||||||
height: 20,
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
opacity: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"&:hover .MuiSlider-thumb": {
|
||||||
opacity: 1,
|
opacity: 1,
|
||||||
},
|
},
|
||||||
},
|
"& .MuiSlider-rail": {
|
||||||
"&:hover .MuiSlider-thumb": {
|
opacity: 0.28,
|
||||||
opacity: 1,
|
background: "white",
|
||||||
},
|
},
|
||||||
"& .MuiSlider-rail": {
|
|
||||||
opacity: 0.28,
|
|
||||||
background: "white",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<div className="video-player-osd-controls-progress-text">
|
|
||||||
<Typography>
|
|
||||||
{ticksDisplay(isSeeking ? sliderProgress : progress)}
|
|
||||||
</Typography>
|
|
||||||
<Typography>{ticksDisplay(itemDuration)}</Typography>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="flex flex-row flex-justify-spaced-between">
|
|
||||||
<div className="video-player-osd-controls-buttons">
|
|
||||||
<PlayPreviousButton />
|
|
||||||
<IconButton
|
|
||||||
onClick={() =>
|
|
||||||
player.current.seekTo(player.current.getCurrentTime() - 15)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded fill">
|
|
||||||
fast_rewind
|
|
||||||
</span>
|
|
||||||
</IconButton>
|
|
||||||
<IconButton onClick={() => setPlaying((state) => !state)}>
|
|
||||||
<span className="material-symbols-rounded fill">
|
|
||||||
{playing ? "pause" : "play_arrow"}
|
|
||||||
</span>
|
|
||||||
</IconButton>
|
|
||||||
<IconButton
|
|
||||||
onClick={() =>
|
|
||||||
player.current.seekTo(player.current.getCurrentTime() + 15)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<span className="material-symbols-rounded fill">
|
|
||||||
fast_forward
|
|
||||||
</span>
|
|
||||||
</IconButton>
|
|
||||||
<PlayNextButton />
|
|
||||||
<Typography variant="subtitle1">
|
|
||||||
{isSeeking
|
|
||||||
? endsAt(itemDuration - sliderProgress)
|
|
||||||
: endsAt(itemDuration - progress)}
|
|
||||||
</Typography>
|
|
||||||
</div>
|
|
||||||
<div className="video-player-osd-controls-buttons">
|
|
||||||
<motion.div
|
|
||||||
style={{
|
|
||||||
width: "13em",
|
|
||||||
padding: "0.5em 1.5em",
|
|
||||||
paddingLeft: "0.8em",
|
|
||||||
gap: "0.4em",
|
|
||||||
background: "black",
|
|
||||||
borderRadius: "100px",
|
|
||||||
display: "grid",
|
|
||||||
justifyContent: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
gridTemplateColumns: "2em 1fr",
|
|
||||||
opacity: 0,
|
|
||||||
}}
|
}}
|
||||||
animate={{
|
/>
|
||||||
opacity: showVolumeControl ? 1 : 0,
|
<div className="video-player-osd-controls-progress-text">
|
||||||
}}
|
<Typography>
|
||||||
whileHover={{
|
{ticksDisplay(isSeeking ? sliderProgress : progress)}
|
||||||
opacity: 1,
|
|
||||||
}}
|
|
||||||
onMouseLeave={() => setShowVolumeControl(false)}
|
|
||||||
>
|
|
||||||
<Typography textAlign="center">
|
|
||||||
{muted ? 0 : Math.round(volume * 100)}
|
|
||||||
</Typography>
|
</Typography>
|
||||||
<Slider
|
<Typography>{ticksDisplay(itemDuration)}</Typography>
|
||||||
step={0.01}
|
</div>
|
||||||
max={1}
|
</div>
|
||||||
size="small"
|
<div className="flex flex-row flex-justify-spaced-between">
|
||||||
value={muted ? 0 : volume}
|
<div className="video-player-osd-controls-buttons">
|
||||||
onChange={(e, newVal) => {
|
<PlayPreviousButton />
|
||||||
setVolume(newVal);
|
<IconButton
|
||||||
if (newVal === 0) setMuted(true);
|
onClick={() =>
|
||||||
else setMuted(false);
|
player.current.seekTo(
|
||||||
|
player.current.getCurrentTime() - 15,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded fill">
|
||||||
|
fast_rewind
|
||||||
|
</span>
|
||||||
|
</IconButton>
|
||||||
|
<IconButton onClick={() => setPlaying((state) => !state)}>
|
||||||
|
<span className="material-symbols-rounded fill">
|
||||||
|
{playing ? "pause" : "play_arrow"}
|
||||||
|
</span>
|
||||||
|
</IconButton>
|
||||||
|
<IconButton
|
||||||
|
onClick={() =>
|
||||||
|
player.current.seekTo(
|
||||||
|
player.current.getCurrentTime() + 15,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded fill">
|
||||||
|
fast_forward
|
||||||
|
</span>
|
||||||
|
</IconButton>
|
||||||
|
<PlayNextButton />
|
||||||
|
<Typography variant="subtitle1">
|
||||||
|
{isSeeking
|
||||||
|
? endsAt(itemDuration - sliderProgress)
|
||||||
|
: endsAt(itemDuration - progress)}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
<div className="video-player-osd-controls-buttons">
|
||||||
|
<motion.div
|
||||||
|
style={{
|
||||||
|
width: "13em",
|
||||||
|
padding: "0.5em 1.5em",
|
||||||
|
paddingLeft: "0.8em",
|
||||||
|
gap: "0.4em",
|
||||||
|
background: "black",
|
||||||
|
borderRadius: "100px",
|
||||||
|
display: "grid",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
gridTemplateColumns: "2em 1fr",
|
||||||
|
opacity: 0,
|
||||||
}}
|
}}
|
||||||
/>
|
animate={{
|
||||||
</motion.div>
|
opacity: showVolumeControl ? 1 : 0,
|
||||||
<IconButton
|
}}
|
||||||
onClick={() => setMuted((state) => !state)}
|
whileHover={{
|
||||||
onMouseMoveCapture={() => {
|
opacity: 1,
|
||||||
setShowVolumeControl(true);
|
}}
|
||||||
}}
|
onMouseLeave={() => setShowVolumeControl(false)}
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded">
|
<Typography textAlign="center">
|
||||||
{muted
|
{muted ? 0 : Math.round(volume * 100)}
|
||||||
? "volume_off"
|
</Typography>
|
||||||
: volume < 0.4
|
<Slider
|
||||||
? "volume_down"
|
step={0.01}
|
||||||
: "volume_up"}
|
max={1}
|
||||||
</span>
|
size="small"
|
||||||
</IconButton>
|
value={muted ? 0 : volume}
|
||||||
<QueueButton />
|
onChange={(e, newVal) => {
|
||||||
<IconButton
|
setVolume(newVal);
|
||||||
disabled={mediaSource.subtitle.track === -2}
|
if (newVal === 0) setMuted(true);
|
||||||
onClick={toggleSubtitleTrack}
|
else setMuted(false);
|
||||||
>
|
}}
|
||||||
<span className={"material-symbols-rounded"}>
|
/>
|
||||||
{mediaSource.subtitle.enable
|
</motion.div>
|
||||||
? "closed_caption"
|
<IconButton
|
||||||
: "closed_caption_disabled"}
|
onClick={() => setMuted((state) => !state)}
|
||||||
</span>
|
onMouseMoveCapture={() => {
|
||||||
</IconButton>
|
setShowVolumeControl(true);
|
||||||
<IconButton
|
}}
|
||||||
onClick={async () => {
|
>
|
||||||
setAppFullscreen((state) => {
|
<span className="material-symbols-rounded">
|
||||||
appWindow.getCurrent().setFullscreen(!state);
|
{muted
|
||||||
return !state;
|
? "volume_off"
|
||||||
});
|
: volume < 0.4
|
||||||
}}
|
? "volume_down"
|
||||||
>
|
: "volume_up"}
|
||||||
<span className="material-symbols-rounded fill">
|
</span>
|
||||||
{appFullscreen ? "fullscreen_exit" : "fullscreen"}
|
</IconButton>
|
||||||
</span>
|
<QueueButton />
|
||||||
</IconButton>
|
<IconButton
|
||||||
|
disabled={mediaSource.subtitle.track === -2}
|
||||||
|
onClick={toggleSubtitleTrack}
|
||||||
|
>
|
||||||
|
<span className={"material-symbols-rounded"}>
|
||||||
|
{mediaSource.subtitle.enable
|
||||||
|
? "closed_caption"
|
||||||
|
: "closed_caption_disabled"}
|
||||||
|
</span>
|
||||||
|
</IconButton>
|
||||||
|
<IconButton
|
||||||
|
onClick={async () => {
|
||||||
|
setAppFullscreen((state) => {
|
||||||
|
appWindow.getCurrent().setFullscreen(!state);
|
||||||
|
return !state;
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span className="material-symbols-rounded fill">
|
||||||
|
{appFullscreen ? "fullscreen_exit" : "fullscreen"}
|
||||||
|
</span>
|
||||||
|
</IconButton>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)}
|
||||||
</motion.div>
|
</motion.div>
|
||||||
{/* <video src={hlsStream}></video> */}
|
|
||||||
<ReactPlayer
|
<ReactPlayer
|
||||||
key={item?.Id}
|
key={item?.Id}
|
||||||
playing={playing}
|
playing={playing}
|
||||||
|
|||||||
@@ -130,6 +130,9 @@ export const playItemFromQueue = async (
|
|||||||
: index === "previous"
|
: index === "previous"
|
||||||
? currentItemIndex - 1
|
? currentItemIndex - 1
|
||||||
: index;
|
: index;
|
||||||
|
const prevItem = queueItems[currentItemIndex];
|
||||||
|
const prevPlaySessionId = usePlaybackStore.getState().playsessionId;
|
||||||
|
const prevMediaSourceId = usePlaybackStore.getState().mediaSource.id;
|
||||||
const item = queueItems[requestedItemIndex];
|
const item = queueItems[requestedItemIndex];
|
||||||
if (item.Type === "Audio") {
|
if (item.Type === "Audio") {
|
||||||
const urlOptions = {
|
const urlOptions = {
|
||||||
@@ -157,7 +160,6 @@ export const playItemFromQueue = async (
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
).data;
|
).data;
|
||||||
console.log(mediaSource);
|
|
||||||
let itemName = item.Name;
|
let itemName = item.Name;
|
||||||
let episodeTitle = "";
|
let episodeTitle = "";
|
||||||
if (item.SeriesId) {
|
if (item.SeriesId) {
|
||||||
@@ -197,7 +199,7 @@ export const playItemFromQueue = async (
|
|||||||
try {
|
try {
|
||||||
introInfo = (
|
introInfo = (
|
||||||
await axiosClient.get(
|
await axiosClient.get(
|
||||||
`${api.basePath}/Episode/${item.Id}/IntroTimestamps`,
|
`${api.basePath}/Episode/${item.Id}/IntroSkipperSegments`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `MediaBrowser Token=${api.accessToken}`,
|
Authorization: `MediaBrowser Token=${api.accessToken}`,
|
||||||
@@ -213,9 +215,9 @@ export const playItemFromQueue = async (
|
|||||||
getPlaystateApi(api).reportPlaybackStopped({
|
getPlaystateApi(api).reportPlaybackStopped({
|
||||||
playbackStopInfo: {
|
playbackStopInfo: {
|
||||||
Failed: false,
|
Failed: false,
|
||||||
ItemId: item?.Id,
|
ItemId: prevItem?.Id,
|
||||||
MediaSourceId: mediaSource.MediaSources?.[0].Id,
|
MediaSourceId: prevMediaSourceId,
|
||||||
PlaySessionId: mediaSource.PlaySessionId,
|
PlaySessionId: prevPlaySessionId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
type IntroMediaInfo = {
|
type introSkipperResult = {
|
||||||
EpisodeId: string;
|
EpisodeId: string;
|
||||||
Valid: true;
|
Valid: true;
|
||||||
IntroStart: number;
|
IntroStart: number;
|
||||||
@@ -7,4 +7,9 @@ type IntroMediaInfo = {
|
|||||||
HideSkipPromptAt: number;
|
HideSkipPromptAt: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type IntroMediaInfo = {
|
||||||
|
Introduction: introSkipperResult;
|
||||||
|
Credits: introSkipperResult;
|
||||||
|
};
|
||||||
|
|
||||||
export default IntroMediaInfo
|
export default IntroMediaInfo
|
||||||
Reference in new issue
Block a user