Fix: Improves Chromecast casting experience

Fixes several issues and enhances the Chromecast casting experience:

- Prevents errors when loading media by slimming down the customData payload to avoid exceeding message size limits.
- Improves logic for selecting custom data from media status.
- Fixes an issue with subtitle track selection.
- Recommends stereo audio tracks for better Chromecast compatibility.
- Improves volume control and mute synchronization between the app and the Chromecast device.
- Adds error handling for `loadMedia` in `PlayButton`.
- Fixes image caching issue for season posters in mini player.
- Implements cleanup for scroll retry timeout in episode list.
- Ensures segment skipping functions are asynchronous.
- Resets `hasReportedStartRef` after stopping casting.
- Prevents seeking past the end of Outro segments.
- Reports playback progress more accurately by also taking player state changes into account.
This commit is contained in:
Uruk
2026-02-09 21:43:33 +01:00
parent 7c81c0ff33
commit 2c27186e22
11 changed files with 147 additions and 73 deletions

View File

@@ -307,6 +307,7 @@ export const useCasting = (item: BaseItemDto | null) => {
} catch (error) {
console.error("[useCasting] Error during stop:", error);
} finally {
hasReportedStartRef.current = null;
setState(DEFAULT_CAST_STATE);
stateRef.current = DEFAULT_CAST_STATE;

View File

@@ -66,7 +66,11 @@ export const useSegmentSkipper = ({
if (!currentSegment || skipMode === "none") return;
// For Outro segments, prevent seeking past the end
if (segmentType === "Outro" && totalDuration) {
if (
segmentType === "Outro" &&
totalDuration != null &&
Number.isFinite(totalDuration)
) {
const seekTime = Math.min(currentSegment.endTime, totalDuration);
seek(seekTime);
} else {