fix(chromecast): add missing MediaInfo fields
Some checks failed
🏗️ Build Apps / 🤖 Build Android APK (Phone) (push) Has been cancelled
🏗️ Build Apps / 🤖 Build Android APK (TV) (push) Has been cancelled
🏗️ Build Apps / 🍎 Build iOS IPA (Phone) (push) Has been cancelled
🔒 Lockfile Consistency Check / 🔍 Check bun.lock and package.json consistency (push) Has been cancelled
🛡️ CodeQL Analysis / 🔎 Analyze with CodeQL (actions) (push) Has been cancelled
🛡️ CodeQL Analysis / 🔎 Analyze with CodeQL (javascript-typescript) (push) Has been cancelled
🏷️🔀Merge Conflict Labeler / 🏷️ Labeling Merge Conflicts (push) Has been cancelled
🚦 Security & Quality Gate / 📝 Validate PR Title (push) Has been cancelled
🚦 Security & Quality Gate / 🔍 Vulnerable Dependencies (push) Has been cancelled
🚦 Security & Quality Gate / 🚑 Expo Doctor Check (push) Has been cancelled
🚦 Security & Quality Gate / 🔍 Lint & Test (check) (push) Has been cancelled
🚦 Security & Quality Gate / 🔍 Lint & Test (format) (push) Has been cancelled
🚦 Security & Quality Gate / 🔍 Lint & Test (lint) (push) Has been cancelled
🚦 Security & Quality Gate / 🔍 Lint & Test (typecheck) (push) Has been cancelled

This commit is contained in:
Fredrik Burmester
2026-01-10 21:32:09 +01:00
parent f1575ca48b
commit 399eb0a351
2 changed files with 23 additions and 1 deletions

View File

@@ -3,6 +3,7 @@ import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models";
import { useCallback } from "react";
import CastContext, {
CastState,
MediaStreamType,
PlayServicesState,
useCastState,
useRemoteMediaClient,
@@ -82,10 +83,18 @@ export const useMusicCast = ({ api, userId }: UseMusicCastOptions) => {
streamResult.mediaSource?.Container,
);
// Calculate stream duration in seconds from runtime ticks
const streamDurationSeconds = track.RunTimeTicks
? track.RunTimeTicks / 10000000
: undefined;
return {
mediaInfo: {
contentId: track.Id,
contentUrl: streamResult.url,
contentType,
streamType: MediaStreamType.BUFFERED,
streamDuration: streamDurationSeconds,
metadata: {
type: "musicTrack" as const,
title: track.Name || "Unknown Track",