Fixed next up and previous episodes

This commit is contained in:
Alex Kim
2024-10-29 02:26:07 +11:00
parent ad43ee7585
commit 152d3a9c1c

View File

@@ -157,8 +157,19 @@ export const Controls: React.FC<Props> = ({
subtitleIndex, subtitleIndex,
}); });
if (Platform.OS === "ios") router.replace("/vlc-player"); const queryParams = new URLSearchParams({
else router.replace("/player"); 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]); }, [previousItem, settings]);
const goToNextItem = useCallback(() => { const goToNextItem = useCallback(() => {
@@ -175,8 +186,19 @@ export const Controls: React.FC<Props> = ({
subtitleIndex, subtitleIndex,
}); });
if (Platform.OS === "ios") router.replace("/vlc-player"); const queryParams = new URLSearchParams({
else router.replace("/player"); 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]); }, [nextItem, settings]);
const updateTimes = useCallback( const updateTimes = useCallback(
@@ -586,16 +608,18 @@ export const Controls: React.FC<Props> = ({
pointerEvents={showControls ? "auto" : "none"} pointerEvents={showControls ? "auto" : "none"}
className={`flex flex-row items-center space-x-2 z-10 p-4 `} className={`flex flex-row items-center space-x-2 z-10 p-4 `}
> >
<TouchableOpacity {Platform.OS !== "ios" && (
onPress={toggleIgnoreSafeAreas} <TouchableOpacity
className="aspect-square flex flex-col bg-neutral-800/90 rounded-xl items-center justify-center p-2" onPress={toggleIgnoreSafeAreas}
> className="aspect-square flex flex-col bg-neutral-800/90 rounded-xl items-center justify-center p-2"
<Ionicons >
name={ignoreSafeAreas ? "contract-outline" : "expand"} <Ionicons
size={24} name={ignoreSafeAreas ? "contract-outline" : "expand"}
color="white" size={24}
/> color="white"
</TouchableOpacity> />
</TouchableOpacity>
)}
<TouchableOpacity <TouchableOpacity
onPress={async () => { onPress={async () => {
if (stop) await stop(); if (stop) await stop();