mirror of
https://github.com/KuekHaoYang/KVideo.git
synced 2026-08-15 00:33:44 +08:00
- 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.
27 lines
817 B
TypeScript
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} />;
|
|
}
|