From 090e0cb17029f6f3762e7114501f7a7226e37fd2 Mon Sep 17 00:00:00 2001 From: Emre Sanden <40148297+KindCoder-no@users.noreply.github.com> Date: Sat, 3 Jan 2026 17:52:45 +0100 Subject: [PATCH] feat: add button to toggle video orientation in player (#743) Co-authored-by: Gauvain <68083474+Gauvino@users.noreply.github.com> Co-authored-by: Fredrik Burmester --- .../video-player/controls/HeaderControls.tsx | 46 ++++++++++++++++++- utils/jellyseerr | 2 +- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/components/video-player/controls/HeaderControls.tsx b/components/video-player/controls/HeaderControls.tsx index aed0a851..47fde671 100644 --- a/components/video-player/controls/HeaderControls.tsx +++ b/components/video-player/controls/HeaderControls.tsx @@ -4,7 +4,7 @@ import type { MediaSourceInfo, } from "@jellyfin/sdk/lib/generated-client"; import { useRouter } from "expo-router"; -import type { FC } from "react"; +import { type FC, useCallback, useState } from "react"; import { Platform, TouchableOpacity, @@ -13,6 +13,8 @@ import { } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { useHaptic } from "@/hooks/useHaptic"; +import { useOrientation } from "@/hooks/useOrientation"; +import { OrientationLock } from "@/packages/expo-screen-orientation"; import { useSettings, VideoPlayerIOS } from "@/utils/atoms/settings"; import { ICON_SIZES } from "./constants"; import DropdownView from "./dropdown/DropdownView"; @@ -57,12 +59,38 @@ export const HeaderControls: FC = ({ const insets = useSafeAreaInsets(); const { width: _screenWidth } = useWindowDimensions(); const lightHapticFeedback = useHaptic("light"); + const { orientation, lockOrientation } = useOrientation(); + const [isTogglingOrientation, setIsTogglingOrientation] = useState(false); const onClose = async () => { lightHapticFeedback(); router.back(); }; + const toggleOrientation = useCallback(async () => { + if (isTogglingOrientation) return; + + setIsTogglingOrientation(true); + lightHapticFeedback(); + + try { + const isPortrait = + orientation === OrientationLock.PORTRAIT_UP || + orientation === OrientationLock.PORTRAIT_DOWN; + + await lockOrientation( + isPortrait ? OrientationLock.LANDSCAPE : OrientationLock.PORTRAIT_UP, + ); + } finally { + setIsTogglingOrientation(false); + } + }, [ + orientation, + lockOrientation, + isTogglingOrientation, + lightHapticFeedback, + ]); + return ( = ({ + {!Platform.isTV && ( + + + + )} {!Platform.isTV && startPictureInPicture && settings?.videoPlayerIOS !== VideoPlayerIOS.VLC && ( diff --git a/utils/jellyseerr b/utils/jellyseerr index fc6a9e95..4401b164 160000 --- a/utils/jellyseerr +++ b/utils/jellyseerr @@ -1 +1 @@ -Subproject commit fc6a9e952ca524fcc2252d4a6eb4f08bb767a9a3 +Subproject commit 4401b16414af604a7372dacac326c38b18ad8555