mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-02 12:08:37 +01:00
fix(casting): report the real PlayMethod to Jellyfin
This commit is contained in:
@@ -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,
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user