diff --git a/src/components/buttons/playButton.tsx b/src/components/buttons/playButton.tsx
index fa17e56..3c1d98d 100644
--- a/src/components/buttons/playButton.tsx
+++ b/src/components/buttons/playButton.tsx
@@ -108,9 +108,14 @@ const PlayButton = ({
case BaseItemKind.Episode:
result = await getTvShowsApi(api).getEpisodes({
seriesId: item.SeriesId,
- fields: [ItemFields.MediaSources, ItemFields.MediaStreams],
+ fields: [
+ ItemFields.MediaSources,
+ ItemFields.MediaStreams,
+ ItemFields.Overview,
+ ],
enableUserData: true,
userId: userId,
+ seasonId: item.SeasonId,
// startItemId: item.Id,
});
mediaSource = await getMediaInfoApi(api).getPostedPlaybackInfo({
@@ -142,11 +147,29 @@ const PlayButton = ({
} catch (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;
case BaseItemKind.Series:
result = await getTvShowsApi(api).getEpisodes({
seriesId: itemId,
- fields: [ItemFields.MediaSources, ItemFields.MediaStreams],
+ fields: [
+ ItemFields.MediaSources,
+ ItemFields.MediaStreams,
+ ItemFields.Overview,
+ ],
enableUserData: true,
userId: userId,
});
@@ -166,7 +189,7 @@ const PlayButton = ({
try {
introInfo = (
await axiosClient.get(
- `${api.basePath}/Episode/${result.data.Items?.[0]?.Id}/IntroTimestamps`,
+ `${api.basePath}/Episode/${result.data.Items?.[0]?.Id}/IntroSkipperSegments`,
{
headers: {
Authorization: `MediaBrowser Token=${api.accessToken}`,
@@ -251,7 +274,7 @@ const PlayButton = ({
api_key: api?.accessToken,
};
const urlParams = new URLSearchParams(urlOptions).toString();
-
+
const playbackUrl = `${api.basePath}/Audio/${result?.item.Items[0].Id}/universal?${urlParams}`;
playAudio(playbackUrl, result?.item.Items[0], undefined);
setQueue(result?.item.Items ?? [], 0);
@@ -272,7 +295,6 @@ const PlayButton = ({
currentSubTrack,
result?.mediaSource.MediaSources?.[0].MediaStreams,
);
- console.log(subtitle);
// URL generation
const urlOptions = {
Static: true,
diff --git a/src/components/carousel/index.tsx b/src/components/carousel/index.tsx
index 154ce46..47cfaf3 100644
--- a/src/components/carousel/index.tsx
+++ b/src/components/carousel/index.tsx
@@ -126,7 +126,7 @@ const Carousel = ({
setCurrentSlide(index);
}}
>
- {item.ImageTags?.Primary ? (
+ {item.ImageTags?.Thumb ? (
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 (
+
+
Up Next
+
+ {item?.ImageTags?.Primary ? (
+

+ ) : (
+
+ {getTypeIcon(item?.Type)}
+
+ )}
+
+ {item.Name}
+
+
+ {item.Overview}
+
+
+
+ }
+ >
+ Play Now
+
+
+
+
+
+ );
+};
+
+export default OutroCard;
\ No newline at end of file
diff --git a/src/components/outroCard/outroCard.scss b/src/components/outroCard/outroCard.scss
new file mode 100644
index 0000000..36d12f8
--- /dev/null
+++ b/src/components/outroCard/outroCard.scss
@@ -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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/routes/_api/boxset/$id.tsx b/src/routes/_api/boxset/$id.tsx
index bc461be..9fb49c8 100644
--- a/src/routes/_api/boxset/$id.tsx
+++ b/src/routes/_api/boxset/$id.tsx
@@ -38,6 +38,7 @@ import heroBg from "@/assets/herobg.png";
import "./boxset.scss";
import IconLink from "@/components/iconLink";
+import { getTypeIcon } from "@/components/utils/iconsCollection";
import { createFileRoute } from "@tanstack/react-router";
function TabPanel(props) {
diff --git a/src/routes/_api/player/index.tsx b/src/routes/_api/player/index.tsx
index 91c2165..59cabff 100644
--- a/src/routes/_api/player/index.tsx
+++ b/src/routes/_api/player/index.tsx
@@ -39,6 +39,7 @@ import wasmUrl from "jassub/dist/jassub-worker.wasm?url";
import PlayNextButton from "@/components/buttons/playNextButton";
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
import QueueButton from "@/components/buttons/queueButton";
+import OutroCard from "@/components/outroCard";
import { createFileRoute, useRouter } from "@tanstack/react-router";
import type { OnProgressProps } from "react-player/base";
import subtitleFont from "./Noto-Sans-Indosphere.ttf";
@@ -64,7 +65,7 @@ const ticksDisplay = (ticks: number) => {
})}`;
return formatedTime;
};
-const VOLUME_SCROLL_INTERVAL = 0.05
+const VOLUME_SCROLL_INTERVAL = 0.05;
export const Route = createFileRoute("/_api/player/")({
component: VideoPlayer,
@@ -116,8 +117,8 @@ function VideoPlayer() {
useEffect(() => setBackdrop("", ""), []);
- const [clickTimeout, setClickTimeout] = useState(null)
-
+ const [clickTimeout, setClickTimeout] = useState(null);
+
const showSubtitles = useMemo(
() => mediaSource.subtitle.enable,
[mediaSource.subtitle],
@@ -164,14 +165,14 @@ function VideoPlayer() {
PlaybackStartTimeTicks: startPosition,
PositionTicks: secToTicks(event.playedSeconds),
RepeatMode: RepeatMode.RepeatNone,
- VolumeLevel: volume * 100,
+ VolumeLevel: Math.floor(volume * 100),
},
});
};
const handleExitPlayer = async () => {
appWindow.getCurrent().setFullscreen(false);
-
+
history.back();
// Report Jellyfin server: Playback has ended/stopped
getPlaystateApi(api).reportPlaybackStopped({
@@ -246,28 +247,27 @@ function VideoPlayer() {
};
}, [handleKeyPress]);
- useEffect(() => {
- const handleMouseWheel = (event: WheelEvent) => {
- console.log(event.deltaY);
-
- if (event.deltaY < 0) {
- // increase volume
- setVolume((state) => Math.min(1, state + VOLUME_SCROLL_INTERVAL))
- } else if (event.deltaY > 0) {
- // decrease volume
- setVolume((state) => Math.max(0, state - VOLUME_SCROLL_INTERVAL))
- }
- }
+ useEffect(() => {
+ const handleMouseWheel = (event: WheelEvent) => {
+ console.log(event.deltaY);
+
+ if (event.deltaY < 0) {
+ // increase volume
+ setVolume((state) => Math.min(1, state + VOLUME_SCROLL_INTERVAL));
+ } else if (event.deltaY > 0) {
+ // decrease volume
+ setVolume((state) => Math.max(0, state - VOLUME_SCROLL_INTERVAL));
+ }
+ };
// attach the event listener
- document.addEventListener("wheel", handleMouseWheel);
+ document.addEventListener("wheel", handleMouseWheel);
// remove the event listener
- return () => {
- document.removeEventListener("wheel", handleMouseWheel);
- }
- }, [])
-
+ return () => {
+ document.removeEventListener("wheel", handleMouseWheel);
+ };
+ }, []);
useLayoutEffect(() => {
setPlaying(true);
@@ -321,17 +321,43 @@ function VideoPlayer() {
const showSkipIntroButton = useMemo(() => {
if (
- ticksToSec(progress) >= introInfo?.ShowSkipPromptAt &&
- ticksToSec(progress) < introInfo?.HideSkipPromptAt
+ ticksToSec(progress) >=
+ (introInfo?.Introduction?.ShowSkipPromptAt ?? 0) &&
+ ticksToSec(progress) < (introInfo?.Introduction?.HideSkipPromptAt ?? 0)
)
return true;
return false;
}, [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(() => {
- player.current?.seekTo(introInfo?.IntroEnd);
+ player.current?.seekTo(
+ introInfo?.Introduction.IntroEnd ?? player.current?.getCurrentTime(),
+ );
}, [item?.Id]);
+ const [forceShowCredits, setForceShowCredits] = useState(false);
+ const handleShowCredits = useCallback(() => {
+ setForceShowCredits(true);
+ }, []);
+ useEffect(() => setForceShowCredits(false), [item?.Id]);
+
return (
@@ -374,6 +400,9 @@ function VideoPlayer() {
Skip Intro
)}
+ {!forceShowCredits && showUpNextCard && (
+
+ )}
{
- if (event.currentTarget !== event.target) {
- return
- }
+ onClick={(event) => {
+ if (event.currentTarget !== event.target) {
+ return;
+ }
- if (event.detail === 1) {
- setClickTimeout(
- setTimeout(() => {
- setPlaying((state) => !state);
- }, 200))
- } else if (event.detail === 2){
- clearTimeout(clickTimeout)
- setAppFullscreen((state) => {
- appWindow.getCurrent().setFullscreen(!state);
- return !state
- });
- }
- }}
+ if (event.detail === 1) {
+ setClickTimeout(
+ setTimeout(() => {
+ setPlaying((state) => !state);
+ }, 200),
+ );
+ } else if (event.detail === 2) {
+ clearTimeout(clickTimeout);
+ setAppFullscreen((state) => {
+ appWindow.getCurrent().setFullscreen(!state);
+ return !state;
+ });
+ }
+ }}
>
@@ -459,172 +489,177 @@ function VideoPlayer() {
-
-
- {itemName}
- {episodeTitle && (
-
- {episodeTitle}
-
- )}
-
-
-
-
{
- setIsSeeking(true);
- setSliderProgress(newValue);
- }}
- onChangeCommitted={(e, newValue) => {
- setIsSeeking(false);
- setProgress(newValue);
- player.current.seekTo(ticksToSec(newValue), "seconds");
- }}
- sx={{
- "& .MuiSlider-thumb": {
- width: 14,
- height: 14,
- transition: "0.1s ease-in-out",
- opacity: 0,
- "&.Mui-active": {
- width: 20,
- height: 20,
+ {(forceShowCredits || !showUpNextCard) && (
+
+
+ {itemName}
+ {episodeTitle && (
+
+ {episodeTitle}
+
+ )}
+
+
+
+
{
+ setIsSeeking(true);
+ setSliderProgress(newValue);
+ }}
+ onChangeCommitted={(e, newValue) => {
+ setIsSeeking(false);
+ setProgress(newValue);
+ player.current?.seekTo(ticksToSec(newValue), "seconds");
+ }}
+ sx={{
+ "& .MuiSlider-thumb": {
+ width: 14,
+ height: 14,
+ transition: "0.1s ease-in-out",
+ opacity: 0,
+ "&.Mui-active": {
+ width: 20,
+ height: 20,
+ opacity: 1,
+ },
+ },
+ "&:hover .MuiSlider-thumb": {
opacity: 1,
},
- },
- "&:hover .MuiSlider-thumb": {
- opacity: 1,
- },
- "& .MuiSlider-rail": {
- opacity: 0.28,
- background: "white",
- },
- }}
- />
-
-
- {ticksDisplay(isSeeking ? sliderProgress : progress)}
-
- {ticksDisplay(itemDuration)}
-
-
-
-
-
-
- player.current.seekTo(player.current.getCurrentTime() - 15)
- }
- >
-
- fast_rewind
-
-
-
setPlaying((state) => !state)}>
-
- {playing ? "pause" : "play_arrow"}
-
-
-
- player.current.seekTo(player.current.getCurrentTime() + 15)
- }
- >
-
- fast_forward
-
-
-
-
- {isSeeking
- ? endsAt(itemDuration - sliderProgress)
- : endsAt(itemDuration - progress)}
-
-
-
-
setShowVolumeControl(false)}
- >
-
- {muted ? 0 : Math.round(volume * 100)}
+ />
+
+
+ {ticksDisplay(isSeeking ? sliderProgress : progress)}
- {
- setVolume(newVal);
- if (newVal === 0) setMuted(true);
- else setMuted(false);
+ {ticksDisplay(itemDuration)}
+
+
+
+
+
+
+ player.current.seekTo(
+ player.current.getCurrentTime() - 15,
+ )
+ }
+ >
+
+ fast_rewind
+
+
+
setPlaying((state) => !state)}>
+
+ {playing ? "pause" : "play_arrow"}
+
+
+
+ player.current.seekTo(
+ player.current.getCurrentTime() + 15,
+ )
+ }
+ >
+
+ fast_forward
+
+
+
+
+ {isSeeking
+ ? endsAt(itemDuration - sliderProgress)
+ : endsAt(itemDuration - progress)}
+
+
+
+
-
- setMuted((state) => !state)}
- onMouseMoveCapture={() => {
- setShowVolumeControl(true);
- }}
- >
-
- {muted
- ? "volume_off"
- : volume < 0.4
- ? "volume_down"
- : "volume_up"}
-
-
-
-
-
- {mediaSource.subtitle.enable
- ? "closed_caption"
- : "closed_caption_disabled"}
-
-
- {
- setAppFullscreen((state) => {
- appWindow.getCurrent().setFullscreen(!state);
- return !state;
- });
- }}
- >
-
- {appFullscreen ? "fullscreen_exit" : "fullscreen"}
-
-
+ animate={{
+ opacity: showVolumeControl ? 1 : 0,
+ }}
+ whileHover={{
+ opacity: 1,
+ }}
+ onMouseLeave={() => setShowVolumeControl(false)}
+ >
+
+ {muted ? 0 : Math.round(volume * 100)}
+
+ {
+ setVolume(newVal);
+ if (newVal === 0) setMuted(true);
+ else setMuted(false);
+ }}
+ />
+
+ setMuted((state) => !state)}
+ onMouseMoveCapture={() => {
+ setShowVolumeControl(true);
+ }}
+ >
+
+ {muted
+ ? "volume_off"
+ : volume < 0.4
+ ? "volume_down"
+ : "volume_up"}
+
+
+
+
+
+ {mediaSource.subtitle.enable
+ ? "closed_caption"
+ : "closed_caption_disabled"}
+
+
+ {
+ setAppFullscreen((state) => {
+ appWindow.getCurrent().setFullscreen(!state);
+ return !state;
+ });
+ }}
+ >
+
+ {appFullscreen ? "fullscreen_exit" : "fullscreen"}
+
+
+
-
+ )}
- {/* */}