diff --git a/app/(auth)/items/[id]/page.tsx b/app/(auth)/items/[id]/page.tsx
index 1c85f01f..91335eea 100644
--- a/app/(auth)/items/[id]/page.tsx
+++ b/app/(auth)/items/[id]/page.tsx
@@ -37,28 +37,13 @@ const page: React.FC = () => {
staleTime: Infinity,
});
- const { data: playbackURL, isLoading: l2 } = useQuery({
- queryKey: ["playbackUrl", id],
- queryFn: async () => {
- if (!api || !user?.Id) return;
- return await getStreamUrl({
- api,
- userId: user.Id,
- item,
- startTimeTicks: item?.UserData?.PlaybackPositionTicks || 0,
- });
- },
- enabled: !!id && !!api && !!user?.Id && !!item,
- staleTime: Infinity,
- });
-
useEffect(() => {
navigation.setOptions({
headerRight: () => {
;
},
});
- }, [item, playbackURL, navigation]);
+ }, [item, navigation]);
const { data: posterUrl } = useQuery({
queryKey: ["backdrop", item?.Id],
@@ -67,7 +52,7 @@ const page: React.FC = () => {
staleTime: Infinity,
});
- if (l1 || l2)
+ if (l1)
return (
@@ -75,7 +60,6 @@ const page: React.FC = () => {
);
if (!item?.Id) return null;
- if (!playbackURL) return null;
return (
@@ -109,7 +93,7 @@ const page: React.FC = () => {
- {playbackURL && }
+
diff --git a/components/DownloadItem.tsx b/components/DownloadItem.tsx
index 6ce8460b..1de0d601 100644
--- a/components/DownloadItem.tsx
+++ b/components/DownloadItem.tsx
@@ -16,7 +16,6 @@ import { ProcessItem, runningProcesses } from "@/utils/atoms/downloads";
type DownloadProps = {
item: BaseItemDto;
- url: string;
};
// const useRemuxHlsToMp4 = (inputUrl: string, item: BaseItemDto) => {
@@ -152,7 +151,7 @@ type DownloadProps = {
// return { session, startRemuxing, cancelRemuxing };
// };
-export const DownloadItem: React.FC = ({ url, item }) => {
+export const DownloadItem: React.FC = ({ item }) => {
// const { session, startRemuxing, cancelRemuxing } = useRemuxHlsToMp4(
// url,
// item
diff --git a/components/VideoPlayer.tsx b/components/VideoPlayer.tsx
index 2910b346..660fe15e 100644
--- a/components/VideoPlayer.tsx
+++ b/components/VideoPlayer.tsx
@@ -72,7 +72,17 @@ export const VideoPlayer: React.FC = ({ itemId }) => {
const [api] = useAtom(apiAtom);
const [user] = useAtom(userAtom);
- const {} = useJellyfin();
+ const { data: item } = useQuery({
+ queryKey: ["item", itemId],
+ queryFn: async () =>
+ await getUserItemData({
+ api,
+ userId: user?.Id,
+ itemId,
+ }),
+ enabled: !!itemId && !!api,
+ staleTime: 0,
+ });
const { data: sessionData } = useQuery({
queryKey: ["sessionData", itemId],
@@ -85,23 +95,11 @@ export const VideoPlayer: React.FC = ({ itemId }) => {
return playbackData.data;
},
enabled: !!itemId && !!api && !!user?.Id,
- staleTime: Infinity,
- });
-
- const { data: item } = useQuery({
- queryKey: ["item", itemId],
- queryFn: async () =>
- await getUserItemData({
- api,
- userId: user?.Id,
- itemId,
- }),
- enabled: !!itemId && !!api,
- staleTime: Infinity,
+ staleTime: 0,
});
const { data: playbackURL } = useQuery({
- queryKey: ["playbackUrl", itemId, maxBitrate, forceTranscoding],
+ queryKey: ["playbackUrl", itemId, maxBitrate],
queryFn: async () => {
if (!api || !user?.Id || !sessionData) return null;
@@ -112,14 +110,13 @@ export const VideoPlayer: React.FC = ({ itemId }) => {
startTimeTicks: item?.UserData?.PlaybackPositionTicks || 0,
maxStreamingBitrate: maxBitrate,
sessionData,
- forceTranscoding: forceTranscoding,
});
console.log("Transcode URL:", url);
return url;
},
- enabled: !!itemId && !!api && !!user?.Id && !!item && !!sessionData,
+ enabled: !!sessionData,
staleTime: 0,
});
@@ -185,11 +182,11 @@ export const VideoPlayer: React.FC = ({ itemId }) => {
return (
- {enableVideo && (
+ {playbackURL && (