fix(casting): report the real PlayMethod to Jellyfin

This commit is contained in:
Uruk
2026-05-22 02:20:51 +02:00
parent b38064e2da
commit 0cc3a8469d
3 changed files with 29 additions and 5 deletions

View File

@@ -75,6 +75,11 @@ const attemptLoad = async (
throw new Error("getStreamUrl returned no URL");
}
const playMethod: "Transcode" | "DirectPlay" = data.mediaSource
?.TranscodingUrl
? "Transcode"
: "DirectPlay";
await client.loadMedia({
mediaInfo: buildCastMediaInfo({
item,
@@ -82,6 +87,7 @@ const attemptLoad = async (
api,
playSessionId: data.sessionId ?? undefined,
selection,
playMethod,
}),
startTime: startPositionMs / 1000,
});

View File

@@ -26,6 +26,7 @@ export const buildCastMediaInfo = ({
isLive = false,
playSessionId,
selection,
playMethod,
}: {
item: BaseItemDto;
streamUrl: string;
@@ -38,6 +39,8 @@ export const buildCastMediaInfo = ({
playSessionId?: string;
/** Active track / quality / version selection, embedded in customData. */
selection?: CastSelection;
/** "Transcode" when the stream is a server transcode, else "DirectPlay". */
playMethod?: "Transcode" | "DirectPlay";
}) => {
if (!item.Id) {
throw new Error("Missing item.Id for media load — cannot build contentId");
@@ -94,9 +97,11 @@ export const buildCastMediaInfo = ({
const slimCustomData: Partial<BaseItemDto> & {
playSessionId?: string;
selection?: CastSelection;
playMethod?: "Transcode" | "DirectPlay";
} = {
playSessionId,
selection,
playMethod,
Id: item.Id,
Name: item.Name,
Type: item.Type,