import React from "react"; import { View, Text, StyleSheet, Pressable } from "react-native"; import { Pause, Play, SkipForward, List, Tv } from "lucide-react-native"; import { ThemedText } from "@/components/ThemedText"; import { MediaButton } from "@/components/MediaButton"; import usePlayerStore from "@/stores/playerStore"; interface PlayerControlsProps { showControls: boolean; } export const PlayerControlsMobile: React.FC = ({ showControls }) => { const { detail, currentEpisodeIndex, currentSourceIndex, status, isSeeking, seekPosition, progressPosition, togglePlayPause, playEpisode, setShowEpisodeModal, setShowSourceModal, } = usePlayerStore(); const videoTitle = detail?.videoInfo?.title || ""; const currentEpisode = detail?.episodes[currentEpisodeIndex]; const currentEpisodeTitle = currentEpisode?.title; const hasNextEpisode = currentEpisodeIndex < (detail?.episodes.length || 0) - 1; const formatTime = (milliseconds: number) => { if (!milliseconds) return "00:00"; const totalSeconds = Math.floor(milliseconds / 1000); const minutes = Math.floor(totalSeconds / 60); const seconds = totalSeconds % 60; return `${minutes.toString().padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`; }; const onPlayNextEpisode = () => { if (hasNextEpisode) { playEpisode(currentEpisodeIndex + 1); } }; return ( {videoTitle} {currentEpisodeTitle ? `- ${currentEpisodeTitle}` : ""} {/* This area can be used for gesture-based seeking indicators in the future */} {status?.isLoaded ? `${formatTime(status.positionMillis)} / ${formatTime(status.durationMillis || 0)}` : "00:00 / 00:00"} setShowEpisodeModal(true)}> setShowSourceModal(true)}> {status?.isLoaded && status.isPlaying ? ( ) : ( )} ); }; const styles = StyleSheet.create({ controlsOverlay: { ...StyleSheet.absoluteFillObject, backgroundColor: "rgba(0, 0, 0, 0.4)", justifyContent: "space-between", paddingHorizontal: 15, paddingVertical: 10, }, topControls: { flexDirection: "row", justifyContent: "center", }, controlTitle: { color: "white", fontSize: 14, fontWeight: "bold", textAlign: "center", }, middleControls: { flex: 1, justifyContent: "center", alignItems: "center", }, bottomControlsContainer: { width: "100%", }, timeAndActions: { flexDirection: "row", justifyContent: "space-between", alignItems: "center", marginBottom: 5, }, timeText: { color: "white", fontSize: 12, }, actions: { flexDirection: "row", gap: 15, }, progressBarContainer: { width: "100%", height: 4, position: "relative", marginVertical: 10, }, progressBarBackground: { ...StyleSheet.absoluteFillObject, backgroundColor: "rgba(255, 255, 255, 0.3)", borderRadius: 2, }, progressBarFilled: { ...StyleSheet.absoluteFillObject, backgroundColor: "#ff0000", borderRadius: 2, }, progressBarTouchable: { position: "absolute", left: 0, right: 0, height: 20, top: -8, zIndex: 10, }, mainControls: { flexDirection: "row", justifyContent: "space-around", alignItems: "center", marginTop: 5, }, placeholder: { width: 28, // to balance the skip forward button }, });