Package Exports
- baroiplayer
- baroiplayer/styles/minimal-player.css
- baroiplayer/styles/pixel-art.css
- baroiplayer/styles/videojs.css
Readme
baroiplayer
A customizable, feature-rich media player component library for React applications.
Features
- 🎥 Video & Audio Support: Play various media formats including HLS streaming
- 🎬 Doodstream-Style Minimal UI: Clean, unobtrusive interface with auto-hiding controls
- 🎛️ Customizable Controls: Build your own player interface or use pre-built variants
- 🎨 Custom Icon System: Beautiful SVG icons matching Doodstream aesthetic
- ⌨️ Keyboard Controls: Standard media keyboard shortcuts
- 📱 Responsive Design: Container queries for adaptive layouts
- 🌙 Multiple Themes: Dark, Light, and Transparent themes
- 🚀 React 19 Optimized: Using latest React features for best performance
- ⚡ Advanced Features: Quality selector, playback speed, preview thumbnails
- 🔧 TypeScript: Full type safety and IntelliSense
- ♿ Accessible: ARIA compliant controls
- 🎭 HLS Support: Built-in support for HLS streaming via react-player
Installation
# Using npm
npm install baroiplayer
# Using bun
bun add baroiplayer
# Using yarn
yarn add baroiplayer
# Using pnpm
pnpm add baroiplayerPeer Dependencies
Make sure you have the following peer dependencies installed:
{
"react": ">=18.0.0",
"react-dom": ">=18.0.0"
}Quick Start
Basic Video Player
import { VideoPlayer } from 'baroiplayer';
function App() {
return (
<VideoPlayer
src="https://example.com/video.mp4"
poster="https://example.com/poster.jpg"
width="100%"
height="auto"
/>
);
}Basic Audio Player
import { AudioPlayer } from 'baroiplayer';
function App() {
return (
<AudioPlayer
src="https://example.com/audio.mp3"
/>
);
}Minimal Doodstream-Style Player
import { MinimalMediaPlayer } from 'baroiplayer';
function DoodstreamPlayer() {
return (
<MinimalMediaPlayer
src="https://example.com/video.mp4"
poster="https://example.com/poster.jpg"
theme="dark" // or "light", "transparent"
autoHideControls={true}
hideDelay={2500}
showCenterPlayButton={true}
qualities={[
{ src: "video_1080p.mp4", quality: "1080p", default: true },
{ src: "video_720p.mp4", quality: "720p" },
{ src: "video_480p.mp4", quality: "480p" },
]}
showQualitySelector={true}
showSpeedControl={true}
watermark={{
src: "/logo.png",
position: "top-right",
opacity: 0.5,
size: "small"
}}
/>
);
}Custom Controls
import {
MediaPlayer,
PlayButton,
VolumeControl,
SeekBar,
TimeDisplay
} from 'baroiplayer';
function CustomPlayer() {
return (
<MediaPlayer src="https://example.com/video.mp4" customControls>
{({ state, controls }) => (
<div className="custom-controls">
<PlayButton
isPlaying={state.isPlaying}
onToggle={controls.toggle}
/>
<SeekBar
currentTime={state.currentTime}
duration={state.duration}
onSeek={controls.seek}
/>
<TimeDisplay
currentTime={state.currentTime}
duration={state.duration}
/>
<VolumeControl
volume={state.volume}
isMuted={state.isMuted}
onVolumeChange={controls.setVolume}
onToggleMute={controls.toggleMute}
/>
</div>
)}
</MediaPlayer>
);
}API Reference
Core Components
MediaPlayer- Core media player componentVideoPlayer- Video-specific player with aspect ratio supportAudioPlayer- Audio-specific playerPlayButton- Play/pause toggle buttonVolumeControl- Volume slider and mute buttonSeekBar- Progress bar with seeking capabilityTimeDisplay- Current time and duration displayFullscreenButton- Fullscreen toggle button
Minimal (Doodstream-style) Components
MinimalMediaPlayer- Complete minimal player with auto-hiding controlsMinimalControls- Minimal control bar with smooth transitionsMinimalPlayButton- Custom play/pause button with minimal designMinimalSeekBar- Sleek seek bar with hover effectsMinimalVolumeControl- Expandable volume controlMinimalOverlay- Overlay container for controlsMinimalLoading- Minimal loading spinner
Advanced Components
QualitySelector- Video quality selection dropdownPlaybackSpeedSelector- Playback speed controlChaptersPanel- Chapter navigation panelSubtitleSelector- Subtitle track selectorPictureInPictureButton- PiP mode toggle
Custom Icons
MinimalPlayIcon- Custom play iconMinimalPauseIcon- Custom pause iconMinimalVolumeIcon- Custom volume iconMinimalFullscreenIcon- Custom fullscreen iconMinimalSettingsIcon- Custom settings icon- And more...
Hooks
useMediaPlayer- Core media player logicuseMediaState- Media state managementuseKeyboardControls- Keyboard shortcut handling
Utilities
formatTime- Format seconds to MM:SS or HH:MM:SScn- Utility for conditional class names
Supported Formats
Video
- MP4 (H.264, H.265)
- WebM (VP8, VP9, AV1)
- OGV (Theora)
Audio
- MP3
- AAC
- OGG (Vorbis)
- WAV
- FLAC (where supported)
Keyboard Controls
When keyboardControls is enabled (default):
Space/K- Play/pauseM- Toggle muteF- Toggle fullscreen←/→- Seek backward/forward 10 seconds↑/↓- Volume up/down0-9- Seek to percentage (0% to 90%)
Styling
The components use Tailwind CSS classes and can be customized via the className prop. Default styles follow a modern, accessible design pattern.
Styling
CSS Import
Import the required CSS files in your app:
// For minimal player styles (Doodstream-like UI)
import 'baroiplayer/styles/minimal-player.css';
// For VideoJS player styles (if using VideoJS adapter)
import 'baroiplayer/styles/videojs.css';
// For pixel art themed UI (optional)
import 'baroiplayer/styles/pixel-art.css';Development
# Install dependencies
bun install
# Build the library
bun run build
# Watch mode for development
bun run dev
# Run type checking
bun run check-types
# Run linting
bun run lint
# Run tests
bun run testPublishing
# Build and prepare for publishing
bun run build
# Publish to npm
npm publishContributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
MIT © [Your Name]
See LICENSE file for details.