Files
KVideo/components/player/CustomVideoPlayer.tsx
T
kuekhaoyang a7480fb47a feat: add MobileVideoPlayer component with advanced controls and hooks
- Implemented MobileVideoPlayer component for mobile video playback.
- Added features such as play/pause, skip forward/backward, volume control, and fullscreen support.
- Integrated double-tap gesture handling for skipping video.
- Included hooks for screen orientation management and mobile detection.
- Enhanced user experience with loading indicators and playback speed options.
2025-11-18 12:40:50 +08:00

27 lines
817 B
TypeScript

'use client';
import { useIsMobile } from '@/lib/hooks/useMobilePlayer';
import { DesktopVideoPlayer } from './DesktopVideoPlayer';
import { MobileVideoPlayer } from './MobileVideoPlayer';
interface CustomVideoPlayerProps {
src: string;
poster?: string;
onError?: (error: string) => void;
onTimeUpdate?: (currentTime: number, duration: number) => void;
initialTime?: number;
}
/**
* Smart Video Player that renders different versions based on device
* - Mobile/Tablet: Optimized touch controls, double-tap gestures, orientation lock
* - Desktop: Full-featured player with hover interactions
*/
export function CustomVideoPlayer(props: CustomVideoPlayerProps) {
const isMobile = useIsMobile();
return isMobile
? <MobileVideoPlayer {...props} />
: <DesktopVideoPlayer {...props} />;
}