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