@zezosoft/zezo-ott-react-native-video-player
Version:
Production-ready React Native OTT video player library for Android & iOS. Features: playlists, seasons, auto-next playback, subtitles (SRT/VTT), custom theming, analytics tracking, fullscreen mode, gesture controls, ads player (pre-roll/mid-roll/post-roll
30 lines (26 loc) • 611 B
text/typescript
import { useEffect } from 'react';
import { lockToLandscape, lockToPortrait } from '../platform';
interface UseOrientationLockParams {
isFocused: boolean;
mode: 'fullscreen' | 'normal';
}
/**
* Reusable hook for managing orientation locking
* Consolidates orientation logic from VideoPlayer
*/
export const useOrientationLock = ({
isFocused,
mode,
}: UseOrientationLockParams) => {
useEffect(() => {
if (!isFocused) {
lockToPortrait();
return;
}
if (mode === 'fullscreen') {
lockToLandscape();
} else {
lockToPortrait();
}
}, [isFocused, mode]);
};