From 595120229f6591b5b51a54a557c266169d06de8c Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Sun, 15 Sep 2024 21:44:40 +0200 Subject: [PATCH] feat: see forward cached video length --- components/CurrentlyPlayingBar.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/CurrentlyPlayingBar.tsx b/components/CurrentlyPlayingBar.tsx index 07ba98a9..810b851f 100644 --- a/components/CurrentlyPlayingBar.tsx +++ b/components/CurrentlyPlayingBar.tsx @@ -74,6 +74,7 @@ export const CurrentlyPlayingBar: React.FC = () => { const max = useSharedValue(currentlyPlaying?.item.RunTimeTicks || 0); const sliding = useRef(false); const localIsBuffering = useSharedValue(false); + const cacheProgress = useSharedValue(0); const toggleIgnoreSafeArea = () => { setIgnoreSafeArea((prev) => !prev); @@ -333,7 +334,8 @@ export const CurrentlyPlayingBar: React.FC = () => { if (sliding.current === true) return; onProgress(e); - progress.value = e.currentTime * 10000000; + progress.value = secondsToTicks(e.currentTime); + cacheProgress.value = secondsToTicks(e.playableDuration); }} subtitleStyle={{ fontSize: 16, @@ -482,11 +484,12 @@ export const CurrentlyPlayingBar: React.FC = () => { theme={{ maximumTrackTintColor: "rgba(255,255,255,0.2)", minimumTrackTintColor: "#fff", - cacheTrackTintColor: "#333", + cacheTrackTintColor: "rgba(255,255,255,0.3)", bubbleBackgroundColor: "#fff", bubbleTextColor: "#000", heartbeatColor: "#999", }} + cache={cacheProgress} onSlidingStart={() => { if (!isVisible) return; sliding.current = true;