A modern, feature-rich video player built with Next.js, TypeScript, and HLS.js. This player provides a professional streaming experience with comprehensive controls and customizable options.
- HLS Streaming Support: Native HLS (.m3u8) stream playback
- MP4 Support: Standard video format compatibility
- Auto-detection: Automatically detects video format (HLS/MP4)
- Responsive Design: Works seamlessly across all device sizes
- Playback Controls: Play/Pause, Skip Forward (10s), Skip Backward (10s)
- Volume Control: Mute/Unmute with adjustable volume slider
- Progress Bar: Seek through video with visual progress indicator
- Fullscreen: Toggle fullscreen mode with proper browser API support
- Auto-hide: Controls automatically hide during playback for immersive viewing
- Hover Activation: Controls appear instantly on mouse hover
- Touch-friendly: Optimized for both desktop and mobile interactions
- Keyboard Accessible: Full keyboard navigation support
- Quality Selection: Choose from multiple quality options (Auto, 1080p, 720p, 480p, 360p)
- Playback Speed: Adjust playback speed (0.5x to 2.0x)
- Loop Mode: Enable/disable video looping
- Caption Support: Toggle captions on/off with advanced settings
- Video Sources: Switch between different video sources
- Picture-in-Picture: Pop-out video player for multitasking
- Watch Party: Ready for social viewing experiences
- Chromecast Support: Cast to compatible devices
- Video Switching: Easy switching between sample videos
- Node.js 18.0 or later
- npm, yarn, pnpm, or bun
-
Clone the repository
git clone https://github.com/friday2su/Niro-Player.git cd Niro-Player -
Install dependencies
npm install # or yarn install # or pnpm install # or bun install
-
Run the development server
npm run dev # or yarn dev # or pnpm dev # or bun dev
-
Open your browser Navigate to http://localhost:3000 to see the player in action.
import VideoPlayer from '@/components/VideoPlayer';
export default function HomePage() {
return (
<div className="w-full h-screen">
<VideoPlayer
src="https://example.com/video.m3u8"
type="hls"
poster="/poster.jpg"
/>
</div>
);
}| Prop | Type | Default | Description |
|---|---|---|---|
src |
string |
Required | Video source URL (HLS or MP4) |
type |
'hls' | 'mp4' | 'auto' |
'auto' |
Video format (auto-detects if not specified) |
poster |
string |
undefined |
Poster image URL for video thumbnail |
className |
string |
'' |
Additional CSS classes |
onVideoChange |
(url: string) => void |
undefined |
Callback when video source changes |
- โฎ๏ธ Backward: Skip 10 seconds backward
โถ๏ธ /โธ๏ธ Play/Pause: Toggle video playback- โญ๏ธ Forward: Skip 10 seconds forward
- ๐ Volume: Mute/unmute with volume slider
- ๐ Duration: Shows total video duration
- ๐ฌ Captions: Toggle captions and access caption settings
- ๐บ PiP: Enable picture-in-picture mode
- โ๏ธ Settings: Access comprehensive settings menu
- โถ Fullscreen: Toggle fullscreen mode
- Quality: Auto, 1080p, 720p, 480p, 360p
- Video Sources: Switch between available video streams
- Watch Party: Start collaborative viewing session
- Chromecast: Cast to Chromecast-enabled devices
- Captions: Enable/disable with advanced configuration
- Playback: Speed control and loop settings
- Next.js 14+: React framework with App Router
- TypeScript: Type-safe development
- Tailwind CSS: Utility-first styling
- HLS.js: HLS streaming support
- Lucide Icons: Modern icon library
src/
โโโ components/
โ โโโ VideoPlayer.tsx # Main player component
โ โโโ VideoControls.tsx # Control interface
โ โโโ types.ts # TypeScript definitions
โ โโโ utils.ts # Helper functions
โโโ app/
โ โโโ page.tsx # Main page
โ โโโ layout.tsx # App layout
โ โโโ globals.css # Global styles
- HLS Support: Uses HLS.js for seamless streaming
- State Management: React hooks for player state
- Event Handling: Proper video event listeners
- Accessibility: ARIA labels and keyboard support
- Performance: Optimized rendering and memory management
The player uses Tailwind CSS for styling. Customize colors, sizes, and animations by modifying the component classes.
Add more sample videos in VideoPlayer.tsx:
const sampleVideos = [
{
name: 'Your Video',
url: 'https://your-video-url.com/stream.m3u8',
type: 'hls' as const
}
];Extend the settings menu by adding new options to the settings panel in VideoControls.tsx.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- HLS.js for HLS streaming support
- Next.js for the amazing React framework
- Tailwind CSS for utility-first styling
- Lucide Icons for beautiful icons
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Provide browser console logs if applicable
Made with โค๏ธ for the streaming community
