import { Ionicons } from "@expo/vector-icons"; import type { FC } from "react"; import { Platform, TouchableOpacity, View } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { Text } from "@/components/common/Text"; import { Loader } from "@/components/Loader"; import { SyncPlaySpinner } from "@/components/syncplay/SyncPlaySpinner"; import { useSyncPlay } from "@/providers/SyncPlay/SyncPlayProvider"; import { useSettings } from "@/utils/atoms/settings"; import AudioSlider from "./AudioSlider"; import BrightnessSlider from "./BrightnessSlider"; import { ICON_SIZES } from "./constants"; // SyncPlay cyan color (matches Jellyfin-web) const SYNC_PLAY_COLOR = "#00a4dc"; interface CenterControlsProps { showControls: boolean; isPlaying: boolean; isBuffering: boolean; showAudioSlider: boolean; setShowAudioSlider: (show: boolean) => void; togglePlay: () => void; handleSkipBackward: () => void; handleSkipForward: () => void; // Chapter navigation props hasChapters?: boolean; hasPreviousChapter?: boolean; hasNextChapter?: boolean; goToPreviousChapter?: () => void; goToNextChapter?: () => void; } export const CenterControls: FC = ({ showControls, isPlaying, isBuffering, showAudioSlider, setShowAudioSlider, togglePlay, handleSkipBackward, handleSkipForward, hasChapters = false, hasPreviousChapter = false, hasNextChapter = false, goToPreviousChapter, goToNextChapter, }) => { const { settings } = useSettings(); const insets = useSafeAreaInsets(); // SyncPlay state from global provider const { isEnabled: isSyncPlayEnabled, groupInfo, pendingPlaybackCommand, } = useSyncPlay(); const isSyncPlayWaiting = isSyncPlayEnabled && groupInfo?.State === "Waiting"; // Show the rotating SyncPlay icon ("schedule-play" in jellyfin-web) while a // play/pause request is in flight to the server. const isSyncPlayScheduling = isSyncPlayEnabled && pendingPlaybackCommand !== null; return ( {!settings?.hideBrightnessSlider && ( )} {!Platform.isTV && ( {settings?.rewindSkipTime} )} {!Platform.isTV && hasChapters && ( )} {isSyncPlayScheduling ? ( // SyncPlay command in flight - rotating spinner ("schedule-play") ) : isSyncPlayWaiting ? ( // SyncPlay waiting indicator - clock icon, still pressable to toggle ) : !isBuffering ? ( ) : ( )} {!Platform.isTV && hasChapters && ( )} {!Platform.isTV && ( {settings?.forwardSkipTime} )} {!settings?.hideVolumeSlider && ( )} ); };