mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-03-21 00:36:24 +00:00
feat: Enhances casting player with API data
Enriches the casting player screen by fetching item details from the Jellyfin API for a more reliable and complete user experience. The casting player now prioritizes item data fetched directly from the API, providing richer metadata and ensuring accurate information display. - Fetches full item data based on content ID. - Uses fetched data as the primary source of item information, falling back to customData or minimal info if unavailable. - Improves UI by showing connection quality and bitrate. - Enhances episode list display and scrolling. - Adds a stop casting button. - Minor UI adjustments for better readability and aesthetics. This change enhances the accuracy and reliability of displayed information, improving the overall user experience of the casting player.
This commit is contained in:
@@ -85,6 +85,16 @@ export const useCasting = (item: BaseItemDto | null) => {
|
||||
}
|
||||
}, [mediaStatus, activeProtocol]);
|
||||
|
||||
// Chromecast: Sync volume from device
|
||||
useEffect(() => {
|
||||
if (activeProtocol === "chromecast" && mediaStatus?.volume !== undefined) {
|
||||
setState((prev) => ({
|
||||
...prev,
|
||||
volume: mediaStatus.volume,
|
||||
}));
|
||||
}
|
||||
}, [mediaStatus?.volume, activeProtocol]);
|
||||
|
||||
// Progress reporting to Jellyfin (optimized to skip redundant reports)
|
||||
useEffect(() => {
|
||||
if (!isConnected || !item?.Id || !user?.Id || state.progress <= 0) return;
|
||||
@@ -209,8 +219,13 @@ export const useCasting = (item: BaseItemDto | null) => {
|
||||
}
|
||||
|
||||
volumeDebounceRef.current = setTimeout(async () => {
|
||||
if (activeProtocol === "chromecast") {
|
||||
await client?.setStreamVolume(clampedVolume).catch(console.error);
|
||||
if (activeProtocol === "chromecast" && client && isConnected) {
|
||||
await client.setStreamVolume(clampedVolume).catch((error) => {
|
||||
console.log(
|
||||
"[useCasting] Volume set failed (no session):",
|
||||
error.message,
|
||||
);
|
||||
});
|
||||
}
|
||||
// Future: Add volume control for other protocols
|
||||
}, 300);
|
||||
|
||||
Reference in New Issue
Block a user