mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-02-11 06:42:23 +00:00
Fix: Improves Chromecast casting experience
Fixes several issues and improves the overall Chromecast casting experience: - Implements an AbortController for fetching item data to prevent race conditions. - Syncs live progress in the mini player more accurately using elapsed real time. - Prevents event propagation in the mini player's play/pause button. - Ensures the disconnect callback in the connection menu is always called. - Retries scrolling in the episode list on failure. - Handles unmute failures gracefully in volume controls. - Clamps seek positions to prevent exceeding duration. - Fixes reporting playback start multiple times - Improves segment calculation in `useChromecastSegments` - Prevents race condition with `isPlaying` state in `Controls` component Also includes minor UI and timing adjustments for a smoother user experience.
This commit is contained in:
@@ -50,7 +50,7 @@ export const calculateEndingTime = (
|
||||
* Determine connection quality based on bitrate
|
||||
*/
|
||||
export const getConnectionQuality = (bitrate?: number): ConnectionQuality => {
|
||||
if (!bitrate) return "good";
|
||||
if (bitrate == null) return "good";
|
||||
const mbps = bitrate / 1000000;
|
||||
|
||||
if (mbps >= 15) return "excellent";
|
||||
|
||||
@@ -21,6 +21,11 @@ export const buildCastMediaInfo = ({
|
||||
streamUrl: string;
|
||||
api: Api;
|
||||
}) => {
|
||||
if (!item.Id) {
|
||||
throw new Error("Missing item.Id for media load — cannot build contentId");
|
||||
}
|
||||
|
||||
const itemId: string = item.Id;
|
||||
const streamDuration = item.RunTimeTicks
|
||||
? item.RunTimeTicks / 10000000
|
||||
: undefined;
|
||||
@@ -74,7 +79,7 @@ export const buildCastMediaInfo = ({
|
||||
};
|
||||
|
||||
return {
|
||||
contentId: item.Id,
|
||||
contentId: itemId,
|
||||
contentUrl: streamUrl,
|
||||
contentType: "video/mp4",
|
||||
streamType: MediaStreamType.BUFFERED,
|
||||
|
||||
Reference in New Issue
Block a user