refactor: unmount card image if not inView
This commit is contained in:
8 files changed
+155
-121
No files matched your search
@@ -60,6 +60,7 @@
|
|||||||
"react-dnd-html5-backend": "^16.0.1",
|
"react-dnd-html5-backend": "^16.0.1",
|
||||||
"react-dom": "18.3.1",
|
"react-dom": "18.3.1",
|
||||||
"react-error-boundary": "^4.1.2",
|
"react-error-boundary": "^4.1.2",
|
||||||
|
"react-intersection-observer": "^9.13.1",
|
||||||
"react-markdown": "^9.0.1",
|
"react-markdown": "^9.0.1",
|
||||||
"react-multi-carousel": "^2.8.5",
|
"react-multi-carousel": "^2.8.5",
|
||||||
"react-player": "^2.16.0",
|
"react-player": "^2.16.0",
|
||||||
|
|||||||
Generated
+18
@@ -149,6 +149,9 @@ importers:
|
|||||||
react-error-boundary:
|
react-error-boundary:
|
||||||
specifier: ^4.1.2
|
specifier: ^4.1.2
|
||||||
version: 4.1.2(react@18.3.1)
|
version: 4.1.2(react@18.3.1)
|
||||||
|
react-intersection-observer:
|
||||||
|
specifier: ^9.13.1
|
||||||
|
version: 9.13.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
react-markdown:
|
react-markdown:
|
||||||
specifier: ^9.0.1
|
specifier: ^9.0.1
|
||||||
version: 9.0.1(@types/react@18.3.12)(react@18.3.1)
|
version: 9.0.1(@types/react@18.3.12)(react@18.3.1)
|
||||||
@@ -2729,6 +2732,15 @@ packages:
|
|||||||
react-fast-compare@3.2.2:
|
react-fast-compare@3.2.2:
|
||||||
resolution: {integrity: sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ==}
|
resolution: {integrity: sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ==}
|
||||||
|
|
||||||
|
react-intersection-observer@9.13.1:
|
||||||
|
resolution: {integrity: sha512-tSzDaTy0qwNPLJHg8XZhlyHTgGW6drFKTtvjdL+p6um12rcnp8Z5XstE+QNBJ7c64n5o0Lj4ilUleA41bmDoMw==}
|
||||||
|
peerDependencies:
|
||||||
|
react: ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||||
|
react-dom: ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||||
|
peerDependenciesMeta:
|
||||||
|
react-dom:
|
||||||
|
optional: true
|
||||||
|
|
||||||
react-is@16.13.1:
|
react-is@16.13.1:
|
||||||
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
|
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
|
||||||
|
|
||||||
@@ -5733,6 +5745,12 @@ snapshots:
|
|||||||
|
|
||||||
react-fast-compare@3.2.2: {}
|
react-fast-compare@3.2.2: {}
|
||||||
|
|
||||||
|
react-intersection-observer@9.13.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1):
|
||||||
|
dependencies:
|
||||||
|
react: 18.3.1
|
||||||
|
optionalDependencies:
|
||||||
|
react-dom: 18.3.1(react@18.3.1)
|
||||||
|
|
||||||
react-is@16.13.1: {}
|
react-is@16.13.1: {}
|
||||||
|
|
||||||
react-is@18.3.1: {}
|
react-is@18.3.1: {}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import "./card.scss";
|
|||||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
|
|
||||||
|
import { useInView } from "react-intersection-observer";
|
||||||
|
|
||||||
const CardComponent = ({
|
const CardComponent = ({
|
||||||
item,
|
item,
|
||||||
cardTitle,
|
cardTitle,
|
||||||
@@ -80,8 +82,16 @@ const CardComponent = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const { ref, inView } = useInView({
|
||||||
|
threshold: 0,
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="card" onClick={onClick ? onClick : defaultOnClick}>
|
<div
|
||||||
|
className="card"
|
||||||
|
ref={ref}
|
||||||
|
onClick={onClick ? onClick : defaultOnClick}
|
||||||
|
>
|
||||||
<div className={`card-image-container ${cardType}`}>
|
<div className={`card-image-container ${cardType}`}>
|
||||||
<ErrorBoundary fallback>
|
<ErrorBoundary fallback>
|
||||||
<div
|
<div
|
||||||
@@ -112,73 +122,74 @@ const CardComponent = ({
|
|||||||
? getTypeIcon(overrideIcon)
|
? getTypeIcon(overrideIcon)
|
||||||
: getTypeIcon(item.Type ?? "universal")}
|
: getTypeIcon(item.Type ?? "universal")}
|
||||||
</div>
|
</div>
|
||||||
<img
|
{inView && (
|
||||||
alt={item.Name ?? "blink"}
|
<img
|
||||||
src={
|
alt={item.Name ?? "blink"}
|
||||||
api
|
src={
|
||||||
? overrideIcon === "User"
|
api
|
||||||
? `${api?.basePath}/Users/${item.Id}/Images/Primary`
|
? overrideIcon === "User"
|
||||||
: getImageUrlsApi(api).getItemImageUrlById(
|
? `${api?.basePath}/Users/${item.Id}/Images/Primary`
|
||||||
(seriesId ? item.SeriesId : (item.AlbumId ?? item.Id)) ??
|
: getImageUrlsApi(api).getItemImageUrlById(
|
||||||
"",
|
(seriesId ? item.SeriesId : (item.AlbumId ?? item.Id)) ??
|
||||||
imageType,
|
"",
|
||||||
{
|
imageType,
|
||||||
quality: 90,
|
{
|
||||||
fillWidth: cardType === "thumb" ? 560 : 280,
|
quality: 90,
|
||||||
},
|
fillWidth: cardType === "thumb" ? 560 : 280,
|
||||||
)
|
},
|
||||||
: ""
|
)
|
||||||
}
|
: ""
|
||||||
style={{
|
}
|
||||||
height: "100%",
|
style={{
|
||||||
width: "100%",
|
height: "100%",
|
||||||
opacity: 0,
|
width: "100%",
|
||||||
}}
|
opacity: 0,
|
||||||
loading="lazy"
|
}}
|
||||||
onLoad={(e) => {
|
loading="lazy"
|
||||||
e.currentTarget.style.setProperty("opacity", "1");
|
onLoad={(e) => {
|
||||||
}}
|
e.currentTarget.style.setProperty("opacity", "1");
|
||||||
onLoadStart={(e) => console.log(e)}
|
}}
|
||||||
className="card-image"
|
onLoadStart={(e) => console.log(e)}
|
||||||
/>
|
className="card-image"
|
||||||
<div className="card-overlay">
|
/>
|
||||||
{!disableOverlay && (
|
)}
|
||||||
<>
|
|
||||||
<PlayButton
|
{inView && !disableOverlay && (
|
||||||
item={item}
|
<div className="card-overlay">
|
||||||
userId={userId}
|
<PlayButton
|
||||||
itemType={item.Type ?? "Movie"}
|
item={item}
|
||||||
currentAudioTrack={0}
|
userId={userId}
|
||||||
currentSubTrack="nosub"
|
itemType={item.Type ?? "Movie"}
|
||||||
currentVideoTrack={0}
|
currentAudioTrack={0}
|
||||||
className="card-play-button"
|
currentSubTrack="nosub"
|
||||||
iconOnly
|
currentVideoTrack={0}
|
||||||
audio={
|
className="card-play-button"
|
||||||
item.Type === BaseItemKind.MusicAlbum ||
|
iconOnly
|
||||||
item.Type === BaseItemKind.Audio ||
|
audio={
|
||||||
item.Type === BaseItemKind.AudioBook ||
|
item.Type === BaseItemKind.MusicAlbum ||
|
||||||
item.Type === BaseItemKind.Playlist
|
item.Type === BaseItemKind.Audio ||
|
||||||
}
|
item.Type === BaseItemKind.AudioBook ||
|
||||||
playlistItem={item.Type === BaseItemKind.Playlist}
|
item.Type === BaseItemKind.Playlist
|
||||||
playlistItemId={item.Id}
|
}
|
||||||
/>
|
playlistItem={item.Type === BaseItemKind.Playlist}
|
||||||
<LikeButton
|
playlistItemId={item.Id}
|
||||||
itemId={item.Id}
|
/>
|
||||||
itemName={item.Name ?? ""}
|
<LikeButton
|
||||||
isFavorite={item.UserData?.IsFavorite}
|
itemId={item.Id}
|
||||||
queryKey={queryKey}
|
itemName={item.Name ?? ""}
|
||||||
userId={userId}
|
isFavorite={item.UserData?.IsFavorite}
|
||||||
/>
|
queryKey={queryKey}
|
||||||
<MarkPlayedButton
|
userId={userId}
|
||||||
itemId={item.Id}
|
/>
|
||||||
itemName={item.Name ?? ""}
|
<MarkPlayedButton
|
||||||
isPlayed={item.UserData?.Played}
|
itemId={item.Id}
|
||||||
queryKey={queryKey}
|
itemName={item.Name ?? ""}
|
||||||
userId={userId}
|
isPlayed={item.UserData?.Played}
|
||||||
/>
|
queryKey={queryKey}
|
||||||
</>
|
userId={userId}
|
||||||
)}
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
{(item.UserData?.PlaybackPositionTicks ?? -1) > 0 && (
|
{(item.UserData?.PlaybackPositionTicks ?? -1) > 0 && (
|
||||||
<div className="card-progress-container">
|
<div className="card-progress-container">
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -151,7 +151,9 @@ function ItemDetail() {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
setSelectedVideoTrack(result?.find((track) => track.IsDefault)?.Index ?? 0);
|
setSelectedVideoTrack(
|
||||||
|
result?.find((track) => track.IsDefault)?.Index ?? result?.[0].Index ?? 0,
|
||||||
|
);
|
||||||
return result ?? [];
|
return result ?? [];
|
||||||
}, [item.data?.Id]);
|
}, [item.data?.Id]);
|
||||||
const audioTracks = useMemo(() => {
|
const audioTracks = useMemo(() => {
|
||||||
@@ -161,7 +163,9 @@ function ItemDetail() {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
setSelectedAudioTrack(result?.find((track) => track.IsDefault)?.Index ?? 0);
|
setSelectedAudioTrack(
|
||||||
|
result?.find((track) => track.IsDefault)?.Index ?? result?.[0].Index ?? 0,
|
||||||
|
);
|
||||||
return result ?? [];
|
return result ?? [];
|
||||||
}, [item.data?.Id]);
|
}, [item.data?.Id]);
|
||||||
const subtitleTracks = useMemo(() => {
|
const subtitleTracks = useMemo(() => {
|
||||||
@@ -171,9 +175,7 @@ function ItemDetail() {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
setSelectedSubtitleTrack(
|
setSelectedSubtitleTrack(result?.find((track) => track.IsDefault)?.Index ?? -1);
|
||||||
result?.find((track) => track.IsDefault)?.Index ?? -1,
|
|
||||||
);
|
|
||||||
return result ?? [];
|
return result ?? [];
|
||||||
}, [item.data?.Id]);
|
}, [item.data?.Id]);
|
||||||
|
|
||||||
|
|||||||
@@ -168,7 +168,6 @@ function PersonTitlePage() {
|
|||||||
fields: ["SeasonUserData", "Overview"],
|
fields: ["SeasonUserData", "Overview"],
|
||||||
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
sortBy: ["PremiereDate", "ProductionYear", "SortName"],
|
||||||
excludeLocationTypes: [LocationType.Virtual],
|
excludeLocationTypes: [LocationType.Virtual],
|
||||||
limit: 24,
|
|
||||||
});
|
});
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
@@ -476,17 +475,6 @@ function PersonTitlePage() {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</motion.div>
|
</motion.div>
|
||||||
{tab.data.isSuccess &&
|
|
||||||
(tab.data.data?.TotalRecordCount ?? 0) > 24 && (
|
|
||||||
<Typography
|
|
||||||
variant="h6"
|
|
||||||
style={{
|
|
||||||
opacity: 0.8,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
And more...
|
|
||||||
</Typography>
|
|
||||||
)}
|
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -53,8 +53,9 @@ import useQueue, { clearQueue } from "@/utils/store/queue";
|
|||||||
import { createFileRoute, useRouter } from "@tanstack/react-router";
|
import { createFileRoute, useRouter } from "@tanstack/react-router";
|
||||||
import { toNumber } from "lodash";
|
import { toNumber } from "lodash";
|
||||||
import type { OnProgressProps } from "react-player/base";
|
import type { OnProgressProps } from "react-player/base";
|
||||||
import type { TrackProps } from "react-player/file";
|
|
||||||
|
|
||||||
|
import type subtitlePlaybackInfo from "@/utils/types/subtitlePlaybackInfo";
|
||||||
|
//@ts-ignore
|
||||||
import font from "./Noto-Sans-Indosphere.ttf?url";
|
import font from "./Noto-Sans-Indosphere.ttf?url";
|
||||||
|
|
||||||
const ticksDisplay = (ticks: number) => {
|
const ticksDisplay = (ticks: number) => {
|
||||||
@@ -85,7 +86,7 @@ const VOLUME_SCROLL_INTERVAL = 0.02;
|
|||||||
*/
|
*/
|
||||||
function addSubtitleTrackToReactPlayer(
|
function addSubtitleTrackToReactPlayer(
|
||||||
videoElem: HTMLMediaElement,
|
videoElem: HTMLMediaElement,
|
||||||
subtitleTracks,
|
subtitleTracks: subtitlePlaybackInfo,
|
||||||
baseUrl: string,
|
baseUrl: string,
|
||||||
) {
|
) {
|
||||||
if (subtitleTracks.url && subtitleTracks.allTracks) {
|
if (subtitleTracks.url && subtitleTracks.allTracks) {
|
||||||
@@ -191,7 +192,7 @@ function VideoPlayer() {
|
|||||||
const [clickTimeout, setClickTimeout] = useState<NodeJS.Timeout>(null!);
|
const [clickTimeout, setClickTimeout] = useState<NodeJS.Timeout>(null!);
|
||||||
|
|
||||||
const handleReady = async () => {
|
const handleReady = async () => {
|
||||||
if (!isReady) {
|
if (api && !isReady) {
|
||||||
player.current?.seekTo(ticksToSec(startPosition), "seconds");
|
player.current?.seekTo(ticksToSec(startPosition), "seconds");
|
||||||
setIsReady(true);
|
setIsReady(true);
|
||||||
// Report Jellyfin server: Playback has begin
|
// Report Jellyfin server: Playback has begin
|
||||||
@@ -216,6 +217,7 @@ function VideoPlayer() {
|
|||||||
|
|
||||||
const handleProgress = async (event: OnProgressProps) => {
|
const handleProgress = async (event: OnProgressProps) => {
|
||||||
setProgress(secToTicks(event.playedSeconds));
|
setProgress(secToTicks(event.playedSeconds));
|
||||||
|
if (!api) return null;
|
||||||
// Report Jellyfin server: Playback progress
|
// Report Jellyfin server: Playback progress
|
||||||
getPlaystateApi(api).reportPlaybackProgress({
|
getPlaystateApi(api).reportPlaybackProgress({
|
||||||
playbackProgressInfo: {
|
playbackProgressInfo: {
|
||||||
@@ -239,6 +241,7 @@ function VideoPlayer() {
|
|||||||
appWindow.getCurrent().setFullscreen(false);
|
appWindow.getCurrent().setFullscreen(false);
|
||||||
|
|
||||||
history.back();
|
history.back();
|
||||||
|
if (!api) return null;
|
||||||
// Report Jellyfin server: Playback has ended/stopped
|
// Report Jellyfin server: Playback has ended/stopped
|
||||||
getPlaystateApi(api).reportPlaybackStopped({
|
getPlaystateApi(api).reportPlaybackStopped({
|
||||||
playbackStopInfo: {
|
playbackStopInfo: {
|
||||||
@@ -314,6 +317,7 @@ function VideoPlayer() {
|
|||||||
};
|
};
|
||||||
}, [handleKeyPress]);
|
}, [handleKeyPress]);
|
||||||
|
|
||||||
|
const playerOSDRef = useRef<HTMLDivElement>(null);
|
||||||
// Volume control with mouse wheel
|
// Volume control with mouse wheel
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleMouseWheel = (event: WheelEvent) => {
|
const handleMouseWheel = (event: WheelEvent) => {
|
||||||
@@ -327,11 +331,11 @@ function VideoPlayer() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// attach the event listener
|
// attach the event listener
|
||||||
document.addEventListener("wheel", handleMouseWheel);
|
playerOSDRef.current?.addEventListener("wheel", handleMouseWheel);
|
||||||
|
|
||||||
// remove the event listener
|
// remove the event listener
|
||||||
return () => {
|
return () => {
|
||||||
document.removeEventListener("wheel", handleMouseWheel);
|
playerOSDRef.current?.removeEventListener("wheel", handleMouseWheel);
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -355,7 +359,7 @@ function VideoPlayer() {
|
|||||||
video: player.current?.getInternalPlayer(),
|
video: player.current?.getInternalPlayer(),
|
||||||
workerUrl,
|
workerUrl,
|
||||||
wasmUrl,
|
wasmUrl,
|
||||||
subUrl: `${api.basePath}${mediaSource.subtitle.url}`,
|
subUrl: `${api?.basePath}${mediaSource.subtitle.url}`,
|
||||||
availableFonts: { "noto sans": font },
|
availableFonts: { "noto sans": font },
|
||||||
fallbackFont: "noto sans",
|
fallbackFont: "noto sans",
|
||||||
});
|
});
|
||||||
@@ -369,7 +373,7 @@ function VideoPlayer() {
|
|||||||
addSubtitleTrackToReactPlayer(
|
addSubtitleTrackToReactPlayer(
|
||||||
player.current.getInternalPlayer() as HTMLMediaElement,
|
player.current.getInternalPlayer() as HTMLMediaElement,
|
||||||
mediaSource.subtitle,
|
mediaSource.subtitle,
|
||||||
api.basePath,
|
api?.basePath ?? "",
|
||||||
);
|
);
|
||||||
console.log(videoElem.textTracks);
|
console.log(videoElem.textTracks);
|
||||||
}
|
}
|
||||||
@@ -429,7 +433,8 @@ function VideoPlayer() {
|
|||||||
|
|
||||||
const handleSkipIntro = useCallback(() => {
|
const handleSkipIntro = useCallback(() => {
|
||||||
player.current?.seekTo(
|
player.current?.seekTo(
|
||||||
ticksToSec(introInfo?.EndTicks) ?? player.current?.getCurrentTime(),
|
ticksToSec(Number(introInfo?.EndTicks)) ??
|
||||||
|
player.current?.getCurrentTime(),
|
||||||
);
|
);
|
||||||
}, [item?.Id]);
|
}, [item?.Id]);
|
||||||
|
|
||||||
@@ -518,7 +523,7 @@ function VideoPlayer() {
|
|||||||
const backgroundOffsetY = -(imageOffsetY * trickplayResolution?.Height);
|
const backgroundOffsetY = -(imageOffsetY * trickplayResolution?.Height);
|
||||||
|
|
||||||
const imgUrlParamsObject: Record<string, string> = {
|
const imgUrlParamsObject: Record<string, string> = {
|
||||||
api_key: api.accessToken,
|
api_key: String(api?.accessToken),
|
||||||
MediaSourceId: mediaSource.id ?? "",
|
MediaSourceId: mediaSource.id ?? "",
|
||||||
};
|
};
|
||||||
const imgUrlParams = new URLSearchParams(imgUrlParamsObject).toString();
|
const imgUrlParams = new URLSearchParams(imgUrlParamsObject).toString();
|
||||||
@@ -529,7 +534,7 @@ function VideoPlayer() {
|
|||||||
<div
|
<div
|
||||||
className="video-osd-trickplayBubble"
|
className="video-osd-trickplayBubble"
|
||||||
style={{
|
style={{
|
||||||
background: `url(${api.basePath}/Videos/${item?.Id}/Trickplay/${trickplayResolution.Width}/${index}.jpg?${imgUrlParams})`,
|
background: `url(${api?.basePath}/Videos/${item?.Id}/Trickplay/${trickplayResolution.Width}/${index}.jpg?${imgUrlParams})`,
|
||||||
backgroundPositionX: `${backgroundOffsetX}px`,
|
backgroundPositionX: `${backgroundOffsetX}px`,
|
||||||
backgroundPositionY: `${backgroundOffsetY}px`,
|
backgroundPositionY: `${backgroundOffsetY}px`,
|
||||||
width: `${trickplayResolution.Width}px`,
|
width: `${trickplayResolution.Width}px`,
|
||||||
@@ -550,7 +555,7 @@ function VideoPlayer() {
|
|||||||
<div
|
<div
|
||||||
className="video-osd-trickplayBubble"
|
className="video-osd-trickplayBubble"
|
||||||
style={{
|
style={{
|
||||||
background: `url(${api.basePath}/Videos/${item?.Id}/Trickplay/${trickplayResolution.Width}/${index}.jpg?${imgUrlParams})`,
|
background: `url(${api?.basePath}/Videos/${item?.Id}/Trickplay/${trickplayResolution.Width}/${index}.jpg?${imgUrlParams})`,
|
||||||
backgroundPositionX: `${backgroundOffsetX}px`,
|
backgroundPositionX: `${backgroundOffsetX}px`,
|
||||||
backgroundPositionY: `${backgroundOffsetY}px`,
|
backgroundPositionY: `${backgroundOffsetY}px`,
|
||||||
width: `${trickplayResolution.Width}px`,
|
width: `${trickplayResolution.Width}px`,
|
||||||
@@ -595,7 +600,7 @@ function VideoPlayer() {
|
|||||||
}, [volume]);
|
}, [volume]);
|
||||||
|
|
||||||
const handlePlaybackEnded = () => {
|
const handlePlaybackEnded = () => {
|
||||||
if (queue[currentQueueItemIndex + 1].Id) {
|
if (queue?.[currentQueueItemIndex + 1].Id) {
|
||||||
playItemFromQueue("next", user?.Id, api);
|
playItemFromQueue("next", user?.Id, api);
|
||||||
} else {
|
} else {
|
||||||
handleExitPlayer(); // Exit player if playback has finished and the queue is empty
|
handleExitPlayer(); // Exit player if playback has finished and the queue is empty
|
||||||
@@ -603,17 +608,23 @@ function VideoPlayer() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const [subtitleIsChanging, startSubtitleChange] = useTransition();
|
const [subtitleIsChanging, startSubtitleChange] = useTransition();
|
||||||
const handleSubtitleChange = (
|
const handleSubtitleChange: ChangeEventHandler<
|
||||||
e: ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>,
|
HTMLInputElement | HTMLTextAreaElement
|
||||||
) => {
|
> = useCallback(
|
||||||
startSubtitleChange(() => {
|
(e) => {
|
||||||
if (mediaSource.subtitle.allTracks) {
|
startSubtitleChange(() => {
|
||||||
changeSubtitleTrack(toNumber(e.target.value), mediaSource.subtitle.allTracks);
|
if (mediaSource.subtitle.allTracks) {
|
||||||
console.log(mediaSource.subtitle);
|
changeSubtitleTrack(
|
||||||
setSettingsMenu(null);
|
toNumber(e.target.value),
|
||||||
}
|
mediaSource.subtitle.allTracks,
|
||||||
});
|
);
|
||||||
};
|
console.log(mediaSource.subtitle);
|
||||||
|
setSettingsMenu(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[mediaSource.subtitle.allTracks],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="video-player">
|
<div className="video-player">
|
||||||
@@ -687,6 +698,7 @@ function VideoPlayer() {
|
|||||||
: "video-player-osd"
|
: "video-player-osd"
|
||||||
}
|
}
|
||||||
onMouseMove={handleShowOsd}
|
onMouseMove={handleShowOsd}
|
||||||
|
ref={playerOSDRef}
|
||||||
initial={{
|
initial={{
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
}}
|
}}
|
||||||
@@ -767,10 +779,10 @@ function VideoPlayer() {
|
|||||||
{(forceShowCredits || !showUpNextCard) && (
|
{(forceShowCredits || !showUpNextCard) && (
|
||||||
<div className="video-player-osd-info">
|
<div className="video-player-osd-info">
|
||||||
<Typography variant="h4" fontWeight={500} mb={2}>
|
<Typography variant="h4" fontWeight={500} mb={2}>
|
||||||
{itemName}
|
{String(itemName)}
|
||||||
{episodeTitle && (
|
{episodeTitle && (
|
||||||
<Typography variant="h6" fontWeight={300} mt={1}>
|
<Typography variant="h6" fontWeight={300} mt={1}>
|
||||||
{episodeTitle}
|
{String(episodeTitle)}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import { save } from "@tauri-apps/plugin-dialog";
|
|||||||
import "./photos.scss";
|
import "./photos.scss";
|
||||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||||
import {
|
import {
|
||||||
Button,
|
|
||||||
CircularProgress,
|
|
||||||
IconButton,
|
IconButton,
|
||||||
ListItemIcon,
|
ListItemIcon,
|
||||||
ListItemText,
|
ListItemText,
|
||||||
@@ -48,12 +46,16 @@ function PhotosPlayer() {
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
src={
|
src={
|
||||||
item.Id
|
api
|
||||||
? getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", {
|
? getImageUrlsApi(api).getItemImageUrlById(
|
||||||
// width: 250,
|
item.Id ?? "",
|
||||||
fillWidth: 250,
|
"Primary",
|
||||||
quality: 70,
|
{
|
||||||
})
|
// width: 250,
|
||||||
|
fillWidth: 250,
|
||||||
|
quality: 70,
|
||||||
|
},
|
||||||
|
)
|
||||||
: brokenImage
|
: brokenImage
|
||||||
}
|
}
|
||||||
style={{
|
style={{
|
||||||
@@ -103,7 +105,7 @@ function PhotosPlayer() {
|
|||||||
|
|
||||||
if (pathToSave) {
|
if (pathToSave) {
|
||||||
download(
|
download(
|
||||||
`${api.basePath}/Items/${currentPhoto?.Id}/Download?api_key=${api.accessToken}`,
|
`${api?.basePath}/Items/${currentPhoto?.Id}/Download?api_key=${api?.accessToken}`,
|
||||||
pathToSave,
|
pathToSave,
|
||||||
);
|
);
|
||||||
enqueueSnackbar("Image download queued.", { variant: "info" });
|
enqueueSnackbar("Image download queued.", { variant: "info" });
|
||||||
@@ -120,7 +122,7 @@ function PhotosPlayer() {
|
|||||||
key={currentPhoto?.Id ?? "noPhoto"}
|
key={currentPhoto?.Id ?? "noPhoto"}
|
||||||
src={
|
src={
|
||||||
currentPhoto
|
currentPhoto
|
||||||
? `${api.basePath}/Items/${currentPhoto.Id}/Download?api_key=${api.accessToken}`
|
? `${api?.basePath}/Items/${currentPhoto.Id}/Download?api_key=${api?.accessToken}`
|
||||||
: brokenImage
|
: brokenImage
|
||||||
}
|
}
|
||||||
alt="Item"
|
alt="Item"
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ function SeriesTitlePage() {
|
|||||||
|
|
||||||
const [currentSeason, setCurrentSeason] = useState(() => {
|
const [currentSeason, setCurrentSeason] = useState(() => {
|
||||||
const result = sessionStorage.getItem(`season-${item.data?.Id}`);
|
const result = sessionStorage.getItem(`season-${item.data?.Id}`);
|
||||||
return result ?? 0;
|
return result ?? seasons.data?.Items?.[0].IndexNumber ?? 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
const currentSeasonItem = useQuery({
|
const currentSeasonItem = useQuery({
|
||||||
|
|||||||
Reference in new issue
Block a user