@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
41 lines (34 loc) • 1.31 kB
text/typescript
import { StatusBar } from 'react-native';
import Orientation from 'react-native-orientation-locker';
import SystemNavigationBar from 'react-native-system-navigation-bar';
import PlatformSelector from './PlatformSelector';
export const lockToPortrait = () => {
try {
// Lock orientation immediately for fast response
Orientation.lockToPortrait();
// Update UI instantly without fade animation for smooth, fast rotation
StatusBar.setHidden(false, 'none');
if (PlatformSelector.isAndroid()) {
// Execute Android-specific updates synchronously for maximum speed
SystemNavigationBar.fullScreen(false);
SystemNavigationBar.navigationShow();
}
} catch (error) {
console.warn('Error locking to portrait:', error);
}
};
export const lockToLandscape = () => {
try {
// Lock orientation immediately for fast response
Orientation.lockToLandscape();
// Update UI instantly without fade animation for smooth, fast rotation
StatusBar.setHidden(true, 'none');
if (PlatformSelector.isAndroid()) {
// Execute Android-specific updates synchronously for maximum speed
SystemNavigationBar.fullScreen(true);
SystemNavigationBar.stickyImmersive();
}
} catch (error) {
console.warn('Error locking to landscape:', error);
}
};