From 3b7bc24c76c948b1e0ea8a328834345087eca091 Mon Sep 17 00:00:00 2001 From: tom-heidenreich Date: Tue, 21 Jan 2025 13:58:47 +0100 Subject: [PATCH] feat: get adjacent items in chromecast controls --- app/(auth)/player/google-cast-player.tsx | 85 +----------------------- 1 file changed, 2 insertions(+), 83 deletions(-) diff --git a/app/(auth)/player/google-cast-player.tsx b/app/(auth)/player/google-cast-player.tsx index b0cfd068..d1f2a11d 100644 --- a/app/(auth)/player/google-cast-player.tsx +++ b/app/(auth)/player/google-cast-player.tsx @@ -41,7 +41,6 @@ import NextEpisodeCountDownButton from "@/components/video-player/controls/NextE import { useIntroSkipper } from "@/hooks/useIntroSkipper"; import { useCreditSkipper } from "@/hooks/useCreditSkipper"; import { useAdjacentItems } from "@/hooks/useAdjacentEpisodes"; -import { useTrickplay } from "@/hooks/useTrickplay"; import { secondsToTicks } from "@/utils/secondsToTicks"; import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client"; @@ -277,7 +276,7 @@ function ChromecastControls({ const handleSliderChange = useCallback( debounce((value: number) => { // TODO check if something must be done here - calculateTrickplayUrl(secondsToTicks(value)); + const progressInSeconds = Math.floor(value); const hours = Math.floor(progressInSeconds / 3600); const minutes = Math.floor((progressInSeconds % 3600) / 60); @@ -335,24 +334,6 @@ function ChromecastControls({ }, }); - const { - trickPlayUrl, - calculateTrickplayUrl, - trickplayInfo, - prefetchAllTrickplayImages, - } = useTrickplay( - { - Id: itemId, - RunTimeTicks: secondsToTicks(progress.value), - Trickplay: item?.Trickplay, - }, - true - ); - - useEffect(() => { - prefetchAllTrickplayImages(); - }, []); - const goToNextItem = () => { console.warn("go to next item not implemented yet"); }; @@ -376,68 +357,6 @@ function ChromecastControls({ false ); - const memoizedRenderBubble = useCallback(() => { - if (!trickPlayUrl || !trickplayInfo) { - return null; - } - const { x, y, url } = trickPlayUrl; - const tileWidth = 150; - const tileHeight = 150 / trickplayInfo.aspectRatio!; - - return ( - - - - - - {`${time.hours > 0 ? `${time.hours}:` : ""}${ - time.minutes < 10 ? `0${time.minutes}` : time.minutes - }:${time.seconds < 10 ? `0${time.seconds}` : time.seconds}`} - - - ); - }, [trickPlayUrl, trickplayInfo, time]); - const blurhash = "|rF?hV%2WCj[ayj[a|j[az_NaeWBj@ayfRayfQfQM{M|azj[azf6fQfQfQIpWXofj[ayj[j[fQayWCoeoeaya}j[ayfQa{oLj?j[WVj[ayayj[fQoff7azayj[ayj[j[ayofayayayj[fQj[ayayj[ayfjj[j[ayjuayj["; @@ -537,7 +456,7 @@ function ChromecastControls({ containerStyle={{ borderRadius: 100, }} - renderBubble={() => isSliding && memoizedRenderBubble()} + renderBubble={() => isSliding} sliderHeight={10} thumbWidth={0} progress={progress}