fix playback
This commit is contained in:
parent
20aed86123
commit
ac28de56d3
6 changed files with 18 additions and 7 deletions
|
@ -82,10 +82,17 @@ export const listItemIds = query(
|
|||
}
|
||||
|
||||
return Object.fromEntries(
|
||||
data.Items?.map((item) => ([
|
||||
`${item.MediaType as any}-${item.ProviderIds!["Tmdb"]!}`,
|
||||
{ jellyfin: item.Id! },
|
||||
])) ?? []
|
||||
data.Items?.map((item) => {
|
||||
const type = {
|
||||
Movie: 'movie',
|
||||
Series: 'tv',
|
||||
}[item.Type as string] ?? 'unknown';
|
||||
|
||||
return [
|
||||
`${type}-${item.ProviderIds!["Tmdb"]!}`,
|
||||
{ jellyfin: item.Id! },
|
||||
];
|
||||
}) ?? []
|
||||
);
|
||||
},
|
||||
"jellyfin.listItemIds",
|
||||
|
|
|
@ -16,8 +16,12 @@ const lookupTable = query(async () => listItemIds(), 'content.lookupTable');
|
|||
|
||||
export const getHighlights = () => getContinueWatching(jellyfinUserId);
|
||||
export const getStream = query(async (type: Entry['type'], id: string, range: string) => {
|
||||
console.log(type, id);
|
||||
|
||||
const table = await lookupTable();
|
||||
|
||||
console.log(table, table[`${type}-${id}`].jellyfin);
|
||||
|
||||
return getItemStream(table[`${type}-${id}`].jellyfin, range);
|
||||
}, 'content.stream');
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ export const Player: Component<PlayerProps> = (props) => {
|
|||
|
||||
<video
|
||||
ref={setVideo}
|
||||
src={`/api/content/${props.entry.id}/stream`}
|
||||
src={`/api/content/${props.entry.type}/${props.entry.id}/stream`}
|
||||
// src="https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4"
|
||||
poster={props.entry.image}
|
||||
lang="en"
|
||||
|
|
|
@ -3,7 +3,7 @@ import { getStream } from "~/features/content";
|
|||
|
||||
// const CHUNK_SIZE = 1 * 1e6; // 1MB
|
||||
|
||||
export const GET = async ({ request, params }: APIEvent) => {
|
||||
export const GET = async ({ request, params: { type, id } }: APIEvent) => {
|
||||
"use server";
|
||||
|
||||
const range = request.headers.get("range");
|
||||
|
@ -12,7 +12,7 @@ export const GET = async ({ request, params }: APIEvent) => {
|
|||
return new Response("Requires Range header", { status: 400 });
|
||||
}
|
||||
|
||||
return getStream(params.id, range);
|
||||
return getStream(type, id, range);
|
||||
|
||||
// try {
|
||||
// const file = Bun.file(
|
Loading…
Add table
Add a link
Reference in a new issue