mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-03-22 09:16:38 +00:00
fix(chromecast): resolve TypeScript errors and improve type safety
- Fix deviceName property to use friendlyName - Update disconnect to use stop() instead of endSession() - Fix null handling in getPosterUrl and useTrickplay - Remove unused variables and imports - Add proper null checks in segment skipping - Disable auto-skip until settings are available
This commit is contained in:
@@ -55,7 +55,7 @@ export const useChromecastPlayer = () => {
|
||||
setPlayerState((prev) => ({
|
||||
...prev,
|
||||
isConnected: !!castDevice,
|
||||
deviceName: castDevice?.deviceName || null,
|
||||
deviceName: castDevice?.friendlyName || castDevice?.deviceId || null,
|
||||
isPlaying: mediaStatus.playerState === "playing",
|
||||
isPaused: mediaStatus.playerState === "paused",
|
||||
isStopped: mediaStatus.playerState === "idle",
|
||||
@@ -179,7 +179,7 @@ export const useChromecastPlayer = () => {
|
||||
}, [playerState.progress, seek, settings?.rewindSkipTime]);
|
||||
|
||||
const disconnect = useCallback(async () => {
|
||||
await client?.endSession(true);
|
||||
await client?.stop();
|
||||
setPlayerState(DEFAULT_CHROMECAST_STATE);
|
||||
}, [client]);
|
||||
|
||||
@@ -188,7 +188,7 @@ export const useChromecastPlayer = () => {
|
||||
const remainingTime = formatTime(playerState.duration - playerState.progress);
|
||||
const endingTime = calculateEndingTime(
|
||||
playerState.duration - playerState.progress,
|
||||
settings?.use24HourFormat ?? true,
|
||||
true, // TODO: Add use24HourFormat setting
|
||||
);
|
||||
|
||||
// Next episode countdown
|
||||
|
||||
@@ -127,7 +127,7 @@ export const useChromecastSegments = (
|
||||
|
||||
const skipSegment = useCallback(
|
||||
(seekFn: (positionMs: number) => Promise<void>) => {
|
||||
if (currentSegment) {
|
||||
if (currentSegment?.segment) {
|
||||
return seekFn(currentSegment.segment.end * 1000);
|
||||
}
|
||||
},
|
||||
@@ -140,9 +140,11 @@ export const useChromecastSegments = (
|
||||
|
||||
switch (currentSegment.type) {
|
||||
case "intro":
|
||||
return settings?.autoSkipIntro ?? false;
|
||||
// TODO: Add autoSkipIntroEnabled setting
|
||||
return false;
|
||||
case "credits":
|
||||
return settings?.autoSkipCredits ?? false;
|
||||
// TODO: Add autoSkipCreditsEnabled setting
|
||||
return false;
|
||||
case "recap":
|
||||
case "commercial":
|
||||
case "preview":
|
||||
@@ -151,7 +153,7 @@ export const useChromecastSegments = (
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}, [currentSegment, settings]);
|
||||
}, [currentSegment]);
|
||||
|
||||
return {
|
||||
segments,
|
||||
|
||||
Reference in New Issue
Block a user