From 152d3a9c1c3eaddaaa5b42e6eaea8e3d9c51da0e Mon Sep 17 00:00:00 2001 From: Alex Kim Date: Tue, 29 Oct 2024 02:26:07 +1100 Subject: [PATCH] Fixed next up and previous episodes --- components/video-player/Controls.tsx | 52 ++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/components/video-player/Controls.tsx b/components/video-player/Controls.tsx index 01f4040f..a75163da 100644 --- a/components/video-player/Controls.tsx +++ b/components/video-player/Controls.tsx @@ -157,8 +157,19 @@ export const Controls: React.FC = ({ subtitleIndex, }); - if (Platform.OS === "ios") router.replace("/vlc-player"); - else router.replace("/player"); + const queryParams = new URLSearchParams({ + itemId: previousItem.Id ?? "", // Ensure itemId is a string + audioIndex: audioIndex?.toString() ?? "", + subtitleIndex: subtitleIndex?.toString() ?? "", + mediaSourceId: mediaSource?.Id ?? "", // Ensure mediaSourceId is a string + bitrateValue: bitrate.toString(), + }).toString(); + + if (Platform.OS === "ios") { + router.replace(`/vlc-player?${queryParams}`); + } else { + router.replace(`/player?${queryParams}`); + } }, [previousItem, settings]); const goToNextItem = useCallback(() => { @@ -175,8 +186,19 @@ export const Controls: React.FC = ({ subtitleIndex, }); - if (Platform.OS === "ios") router.replace("/vlc-player"); - else router.replace("/player"); + const queryParams = new URLSearchParams({ + itemId: nextItem.Id ?? "", // Ensure itemId is a string + audioIndex: audioIndex?.toString() ?? "", + subtitleIndex: subtitleIndex?.toString() ?? "", + mediaSourceId: mediaSource?.Id ?? "", // Ensure mediaSourceId is a string + bitrateValue: bitrate.toString(), + }).toString(); + + if (Platform.OS === "ios") { + router.replace(`/vlc-player?${queryParams}`); + } else { + router.replace(`/player?${queryParams}`); + } }, [nextItem, settings]); const updateTimes = useCallback( @@ -586,16 +608,18 @@ export const Controls: React.FC = ({ pointerEvents={showControls ? "auto" : "none"} className={`flex flex-row items-center space-x-2 z-10 p-4 `} > - - - + {Platform.OS !== "ios" && ( + + + + )} { if (stop) await stop();