fix: download url not correct for direct streams

This commit is contained in:
Fredrik Burmester
2024-08-29 12:58:51 +02:00
parent dc02db6463
commit 78189c8246
9 changed files with 47 additions and 34 deletions

View File

@@ -145,15 +145,13 @@ export const DownloadItem: React.FC<DownloadProps> = ({ item, ...props }) => {
item.Id
}/universal?${searchParams.toString()}`;
}
}
if (mediaSource.TranscodingUrl) {
} else if (mediaSource.TranscodingUrl) {
console.log("Using transcoded stream!");
url = `${api.basePath}${mediaSource.TranscodingUrl}`;
} else {
throw new Error("No transcoding url");
}
if (!url) throw new Error("No url");
return await startRemuxing(url);
}, [
api,

View File

@@ -36,6 +36,14 @@ export const MediaSourceSelector: React.FC<Props> = ({
if (mediaSources?.length) onChange(mediaSources[0]);
}, [mediaSources]);
const name = (name?: string | null) => {
if (name && name.length > 40)
return (
name.substring(0, 20) + " [...] " + name.substring(name.length - 20)
);
return name;
};
return (
<View
className="flex shrink"
@@ -69,7 +77,9 @@ export const MediaSourceSelector: React.FC<Props> = ({
onChange(source);
}}
>
<DropdownMenu.ItemTitle>{source.Name}</DropdownMenu.ItemTitle>
<DropdownMenu.ItemTitle>
{name(source.Name)}
</DropdownMenu.ItemTitle>
</DropdownMenu.Item>
))}
</DropdownMenu.Content>

View File

@@ -1,11 +1,9 @@
import { useImageColors } from "@/hooks/useImageColors";
import { apiAtom } from "@/providers/JellyfinProvider";
import { itemThemeColorAtom } from "@/utils/atoms/primaryColor";
import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models";
import { Image, ImageProps, ImageSource } from "expo-image";
import { useAtom } from "jotai";
import { useEffect, useMemo } from "react";
import { getColors } from "react-native-image-colors";
import { useMemo } from "react";
interface Props extends ImageProps {
item: BaseItemDto;