UNPKG

@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

65 lines (63 loc) 2.04 kB
"use strict"; import React, { memo, useCallback, useMemo } from 'react'; import { Animated, StyleSheet, TouchableOpacity, View } from 'react-native'; import { scale } from 'react-native-size-matters'; import { Play, Pause } from 'lucide-react-native'; import { useAdsPlayerStore } from "../store/adsPlayerStore.js"; import { useAdControlsAutoHide } from "../utils/useAdControlsAutoHide.js"; import RotatingLoader from "../components/RotatingLoader.js"; import globalStyles from "../../VideoPlayer/styles/globalStyles.js"; import { jsx as _jsx } from "react/jsx-runtime"; const AdMiddleControls = () => { const { isAdPaused, isAdBuffering, setIsAdPaused } = useAdsPlayerStore(); const fadeAnim = useAdControlsAutoHide(); const handlePlayPause = useCallback(() => { setIsAdPaused(!isAdPaused); }, [isAdPaused, setIsAdPaused]); // Memoize container style const containerStyle = useMemo(() => [styles.container, { opacity: fadeAnim }], [fadeAnim]); return /*#__PURE__*/_jsx(Animated.View, { style: containerStyle, pointerEvents: "box-none", children: isAdBuffering ? /*#__PURE__*/_jsx(RotatingLoader, { color: "#fff", autoRotate: isAdBuffering, size: scale(50) }) : /*#__PURE__*/_jsx(View, { pointerEvents: "auto", children: /*#__PURE__*/_jsx(TouchableOpacity, { onPress: handlePlayPause, style: styles.button, activeOpacity: 0.7, children: isAdPaused ? /*#__PURE__*/_jsx(Play, { size: scale(40), color: "#fff", fill: "#fff" }) : /*#__PURE__*/_jsx(Pause, { size: scale(40), color: "#fff", fill: "#fff" }) }) }) }); }; const styles = StyleSheet.create({ container: { ...globalStyles.absoluteFill, justifyContent: 'center', alignItems: 'center' }, button: { justifyContent: 'center', alignItems: 'center' } }); export default /*#__PURE__*/memo(AdMiddleControls); //# sourceMappingURL=AdMiddleControls.js.map