@therealtinhtute/baroiplayer 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +384 -0
- package/dist/context/media.js +2 -0
- package/dist/context/media.js.map +1 -0
- package/dist/context/media.mjs +15 -0
- package/dist/context/media.mjs.map +1 -0
- package/dist/context/store.js +2 -0
- package/dist/context/store.js.map +1 -0
- package/dist/context/store.mjs +5 -0
- package/dist/context/store.mjs.map +1 -0
- package/dist/context-BMteAJDN.js +1140 -0
- package/dist/context-BMteAJDN.js.map +1 -0
- package/dist/context-DCJ_scmO.cjs +23 -0
- package/dist/context-DCJ_scmO.cjs.map +1 -0
- package/dist/core-events-B5W_j8yU.js +480 -0
- package/dist/core-events-B5W_j8yU.js.map +1 -0
- package/dist/core-events-CN0-Vhhq.cjs +2 -0
- package/dist/core-events-CN0-Vhhq.cjs.map +1 -0
- package/dist/core-plugins-Bq9KLany.js +696 -0
- package/dist/core-plugins-Bq9KLany.js.map +1 -0
- package/dist/core-plugins-CPDSHMiQ.cjs +2 -0
- package/dist/core-plugins-CPDSHMiQ.cjs.map +1 -0
- package/dist/core.js +37 -0
- package/dist/core.js.map +1 -0
- package/dist/core.mjs +1217 -0
- package/dist/core.mjs.map +1 -0
- package/dist/enhanced-components-DHv0MFvG.js +1073 -0
- package/dist/enhanced-components-DHv0MFvG.js.map +1 -0
- package/dist/enhanced-components-DTIObgB7.cjs +2 -0
- package/dist/enhanced-components-DTIObgB7.cjs.map +1 -0
- package/dist/hooks-C_r8wexn.cjs +4 -0
- package/dist/hooks-C_r8wexn.cjs.map +1 -0
- package/dist/hooks-Da2wVXlF.js +1630 -0
- package/dist/hooks-Da2wVXlF.js.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.js +112 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +6126 -0
- package/dist/index.mjs.map +1 -0
- package/dist/minimal-components-DSq5sQpy.js +2002 -0
- package/dist/minimal-components-DSq5sQpy.js.map +1 -0
- package/dist/minimal-components-DflWiihN.cjs +2 -0
- package/dist/minimal-components-DflWiihN.cjs.map +1 -0
- package/dist/minimal-components.css +1 -0
- package/dist/mona-loading.gif +0 -0
- package/dist/performance-monitor-CUW6f5ll.cjs +2 -0
- package/dist/performance-monitor-CUW6f5ll.cjs.map +1 -0
- package/dist/performance-monitor-rMW1RgV3.js +302 -0
- package/dist/performance-monitor-rMW1RgV3.js.map +1 -0
- package/dist/utils-BnscpYYd.js +2798 -0
- package/dist/utils-BnscpYYd.js.map +1 -0
- package/dist/utils-D_czS_0K.cjs +9 -0
- package/dist/utils-D_czS_0K.cjs.map +1 -0
- package/dist/utils.js +2 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.mjs +7 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +114 -0
- package/src/adapters/videojs-adapter.tsx +470 -0
- package/src/assets/mona-loading.gif +0 -0
- package/src/components/AnimateLoading.tsx +115 -0
- package/src/components/LoadingState.tsx +248 -0
- package/src/components/accessibility/keyboard-help-overlay.tsx +213 -0
- package/src/components/audio-player.tsx +85 -0
- package/src/components/basic/index.ts +37 -0
- package/src/components/enhanced/advanced-features.tsx +316 -0
- package/src/components/enhanced/debug-panel.tsx +422 -0
- package/src/components/enhanced/enhanced-controls.tsx +600 -0
- package/src/components/enhanced/enhanced-media-player.tsx +509 -0
- package/src/components/enhanced/error-handling.tsx +345 -0
- package/src/components/enhanced/index.ts +39 -0
- package/src/components/enhanced/media-player-enhanced.tsx +349 -0
- package/src/components/examples/basic-video-player.tsx +55 -0
- package/src/components/examples/custom-controls-example.tsx +63 -0
- package/src/components/examples/enhanced-controls-example.tsx +114 -0
- package/src/components/examples/enhanced-media-player-example.tsx +293 -0
- package/src/components/examples/loading-states-demo.tsx +142 -0
- package/src/components/examples/react-19-demo.tsx +381 -0
- package/src/components/examples/volume-orientation-demo.tsx +114 -0
- package/src/components/icon-demo.tsx +209 -0
- package/src/components/icons/index.tsx +166 -0
- package/src/components/icons/svg-icons/ArrowLeftIcon.tsx +18 -0
- package/src/components/icons/svg-icons/ArrowRightIcon.tsx +18 -0
- package/src/components/icons/svg-icons/AudioIcon.tsx +22 -0
- package/src/components/icons/svg-icons/BackwardIcon.tsx +12 -0
- package/src/components/icons/svg-icons/CameraIcon.tsx +19 -0
- package/src/components/icons/svg-icons/CheckIcon.tsx +19 -0
- package/src/components/icons/svg-icons/EnablePiPIcon.tsx +17 -0
- package/src/components/icons/svg-icons/ForwardIcon.tsx +12 -0
- package/src/components/icons/svg-icons/FullscreenEnterIcon.tsx +23 -0
- package/src/components/icons/svg-icons/FullscreenExitIcon.tsx +23 -0
- package/src/components/icons/svg-icons/LoadingIcon.tsx +32 -0
- package/src/components/icons/svg-icons/PauseIcon.tsx +23 -0
- package/src/components/icons/svg-icons/PlayIcon.tsx +21 -0
- package/src/components/icons/svg-icons/PlaybackSpeedIcon.tsx +23 -0
- package/src/components/icons/svg-icons/QualityIcon.tsx +21 -0
- package/src/components/icons/svg-icons/SettingsIcon.tsx +12 -0
- package/src/components/icons/svg-icons/SliderIcon.tsx +21 -0
- package/src/components/icons/svg-icons/SubtitleIcon.tsx +21 -0
- package/src/components/icons/svg-icons/SubtitleOffIcon.tsx +25 -0
- package/src/components/icons/svg-icons/UnPiPIcon.tsx +17 -0
- package/src/components/icons/svg-icons/VolumeMutedIcon.tsx +16 -0
- package/src/components/icons/svg-icons/VolumeOneIcon.tsx +22 -0
- package/src/components/icons/svg-icons/VolumeThreeIcon.tsx +16 -0
- package/src/components/icons/svg-icons/VolumeTwoIcon.tsx +16 -0
- package/src/components/legacy.tsx +93 -0
- package/src/components/media-metadata-display.tsx +100 -0
- package/src/components/media-player-audio.tsx +39 -0
- package/src/components/media-player-controls.tsx +226 -0
- package/src/components/media-player-error.tsx +163 -0
- package/src/components/media-player-fullscreen.tsx +109 -0
- package/src/components/media-player-hls.tsx +111 -0
- package/src/components/media-player-loading.tsx +76 -0
- package/src/components/media-player-play.tsx +75 -0
- package/src/components/media-player-root.tsx +340 -0
- package/src/components/media-player-seek.tsx +168 -0
- package/src/components/media-player-time.tsx +99 -0
- package/src/components/media-player-tooltip.tsx +58 -0
- package/src/components/media-player-video.tsx +39 -0
- package/src/components/media-player-volume.tsx +155 -0
- package/src/components/media-player.tsx +257 -0
- package/src/components/media-suspense.tsx +362 -0
- package/src/components/player-settings-form.tsx +163 -0
- package/src/components/react-player-wrapper.tsx +651 -0
- package/src/components/simple-video-player.tsx +60 -0
- package/src/components/ui/enhanced-seek-bar.tsx +235 -0
- package/src/components/ui/fullscreen-button.tsx +60 -0
- package/src/components/ui/media-resource-preloader.tsx +395 -0
- package/src/components/ui/play-button.tsx +107 -0
- package/src/components/ui/seek-bar.tsx +161 -0
- package/src/components/ui/time-display.tsx +40 -0
- package/src/components/ui/volume-control.tsx +143 -0
- package/src/components/unified/base-media-player.tsx +246 -0
- package/src/components/unified/media-player.tsx +75 -0
- package/src/components/variants/minimal/AccessibleMinimalPlayer.tsx +561 -0
- package/src/components/variants/minimal/EnhancedMinimalMediaPlayer.tsx +552 -0
- package/src/components/variants/minimal/MinimalControls.tsx +142 -0
- package/src/components/variants/minimal/MinimalLoading.tsx +32 -0
- package/src/components/variants/minimal/MinimalMediaPlayer.tsx +315 -0
- package/src/components/variants/minimal/MinimalOverlay.tsx +64 -0
- package/src/components/variants/minimal/MinimalPlayButton.tsx +65 -0
- package/src/components/variants/minimal/MinimalSeekBar.tsx +150 -0
- package/src/components/variants/minimal/MinimalVolumeControl.tsx +80 -0
- package/src/components/variants/minimal/SimpleMinimalPlayer.tsx +210 -0
- package/src/components/variants/minimal/components/CenterPlayButton.tsx +22 -0
- package/src/components/variants/minimal/components/ControlBar.tsx +146 -0
- package/src/components/variants/minimal/components/EnhancedSettingsMenu.tsx +361 -0
- package/src/components/variants/minimal/components/PlaybackControls.tsx +51 -0
- package/src/components/variants/minimal/components/RightControls.tsx +173 -0
- package/src/components/variants/minimal/components/SeekBar.tsx +131 -0
- package/src/components/variants/minimal/components/SettingsDropdown.tsx +70 -0
- package/src/components/variants/minimal/components/SubtitleDisplay.tsx +21 -0
- package/src/components/variants/minimal/components/TimeDisplay.tsx +18 -0
- package/src/components/variants/minimal/components/VideoElement.tsx +40 -0
- package/src/components/variants/minimal/components/VolumeControl.tsx +217 -0
- package/src/components/variants/minimal/index.ts +23 -0
- package/src/components/video-player.tsx +100 -0
- package/src/context/error-handling.ts +394 -0
- package/src/context/media-context.tsx +208 -0
- package/src/context/media-provider.tsx +265 -0
- package/src/context/media-store.ts +379 -0
- package/src/context/persistence.ts +453 -0
- package/src/core/events/event-system.ts +442 -0
- package/src/core/events/hooks.ts +302 -0
- package/src/core/events/index.ts +22 -0
- package/src/core/events/middleware.ts +269 -0
- package/src/core/index.ts +22 -0
- package/src/core/optimization/bundle-optimizer.tsx +308 -0
- package/src/core/performance/cicd.ts +96 -0
- package/src/core/performance/index.ts +38 -0
- package/src/core/performance/media-loading-optimizer.ts +538 -0
- package/src/core/performance/performance-budgets.ts +432 -0
- package/src/core/performance/performance-monitor.tsx +476 -0
- package/src/core/performance/performance-testing.ts +459 -0
- package/src/core/plugins/base-plugin.ts +224 -0
- package/src/core/plugins/enhanced-plugin-system.ts +411 -0
- package/src/core/plugins/examples/analytics-plugin.ts +242 -0
- package/src/core/plugins/index.ts +39 -0
- package/src/core/plugins/registry.ts +327 -0
- package/src/core/plugins/types.ts +159 -0
- package/src/core/plugins/utils.ts +316 -0
- package/src/core/progressive-loading.tsx +322 -0
- package/src/core/providers/enhanced-hls-provider.ts +339 -0
- package/src/core/providers/service-provider.tsx +168 -0
- package/src/core/utils.tsx +38 -0
- package/src/features/media-session/media-session-manager.ts +429 -0
- package/src/features/picture-in-picture/pip-manager.ts +429 -0
- package/src/features/playlist/playlist-manager.ts +606 -0
- package/src/features/subtitles/subtitle-manager.ts +441 -0
- package/src/features/subtitles/subtitle-parser.ts +280 -0
- package/src/features/thumbnails/thumbnail-generator.ts +519 -0
- package/src/hooks/accessibility/index.ts +27 -0
- package/src/hooks/accessibility/use-accessibility-preferences.ts +188 -0
- package/src/hooks/accessibility/use-focus-management.ts +176 -0
- package/src/hooks/accessibility/use-keyboard-shortcuts.ts +144 -0
- package/src/hooks/accessibility/use-screen-reader.ts +182 -0
- package/src/hooks/core/index.ts +47 -0
- package/src/hooks/legacy.ts +27 -0
- package/src/hooks/use-enhanced-media-player.ts +468 -0
- package/src/hooks/use-intelligent-preloading.ts +358 -0
- package/src/hooks/use-keyboard-controls.ts +115 -0
- package/src/hooks/use-media-actions.ts +175 -0
- package/src/hooks/use-media-metadata.ts +89 -0
- package/src/hooks/use-media-optimistic.ts +270 -0
- package/src/hooks/use-media-player.ts +312 -0
- package/src/hooks/use-media-state.ts +190 -0
- package/src/hooks/use-memory-optimization.ts +358 -0
- package/src/hooks/use-optimistic-controls.ts +92 -0
- package/src/hooks/use-optimized-media.ts +263 -0
- package/src/hooks/use-touch-gestures.ts +417 -0
- package/src/hooks/useEnhancedSubtitles.ts +258 -0
- package/src/hooks/useKeyboardShortcuts.ts +74 -0
- package/src/hooks/useMediaControls.ts +52 -0
- package/src/hooks/useScreenshot.ts +57 -0
- package/src/hooks/useSubtitles.ts +91 -0
- package/src/hooks/useVideoPlayer.ts +232 -0
- package/src/icons/components/FullscreenIcon.tsx +37 -0
- package/src/icons/components/SettingsIcon.tsx +38 -0
- package/src/icons/components/animated/LoadingIcon.tsx +43 -0
- package/src/icons/components/animated/PlayPauseIcon.tsx +50 -0
- package/src/icons/components/media/PauseIcon.tsx +39 -0
- package/src/icons/components/media/PlayIcon.tsx +38 -0
- package/src/icons/components/volume/VolumeIcon.tsx +39 -0
- package/src/icons/components/volume/VolumeOffIcon.tsx +39 -0
- package/src/icons/index.ts +56 -0
- package/src/icons/provider.tsx +64 -0
- package/src/icons/types.ts +40 -0
- package/src/index-enhanced.ts +35 -0
- package/src/index-legacy.ts +326 -0
- package/src/index.css +102 -0
- package/src/index.ts +216 -0
- package/src/lib/deprecation.ts +51 -0
- package/src/lib/format-time.ts +37 -0
- package/src/lib/index.ts +3 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles/globals.css +462 -0
- package/src/styles/minimal-player.css +589 -0
- package/src/styles/pixel-art.css +46 -0
- package/src/styles/videojs.css +100 -0
- package/src/test/setup.ts +79 -0
- package/src/types/events.ts +47 -0
- package/src/types/formats.ts +95 -0
- package/src/types/index.ts +190 -0
- package/src/types/videojs-plugins.d.ts +14 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Baroi Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
# BaroiPlayer
|
|
2
|
+
|
|
3
|
+
> A modern, accessible, and performant media player component library for React 19
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- 🎬 **Multiple Formats**: MP4, HLS/m3u8, MOV, and audio support
|
|
8
|
+
- 🎨 **Beautiful Design**: Tailwind CSS v4 with OKLCH colors and modern CSS
|
|
9
|
+
- ♿ **Accessible**: WCAG 2.1 AA compliant with keyboard navigation and screen reader support
|
|
10
|
+
- ⚡ **Performance Optimized**: Bundle splitting, lazy loading, and size monitoring
|
|
11
|
+
- 🔧 **Plugin System**: Extensible architecture with custom plugins
|
|
12
|
+
- 🎯 **React 19 Ready**: Modern concurrent features, suspense boundaries, and optimistic updates
|
|
13
|
+
- 📱 **Responsive**: Mobile-first design with touch gestures
|
|
14
|
+
- 🌙 **Dark Mode**: Built-in dark mode support
|
|
15
|
+
- 🎚️ **Rich Controls**: Volume, speed, quality, subtitles, and picture-in-picture
|
|
16
|
+
- 🎪 **Multiple Variants**: Minimal, enhanced, and custom player styles
|
|
17
|
+
|
|
18
|
+
## 📦 Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @rp/baroiplayer
|
|
22
|
+
# or
|
|
23
|
+
bun add @rp/baroiplayer
|
|
24
|
+
# or
|
|
25
|
+
yarn add @rp/baroiplayer
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 🚀 Quick Start
|
|
29
|
+
|
|
30
|
+
### Basic Usage
|
|
31
|
+
|
|
32
|
+
```jsx
|
|
33
|
+
import { SimpleMinimalPlayer } from '@rp/baroiplayer';
|
|
34
|
+
import '@rp/baroiplayer/globals.css';
|
|
35
|
+
|
|
36
|
+
function App() {
|
|
37
|
+
return (
|
|
38
|
+
<div className="aspect-video max-w-4xl mx-auto">
|
|
39
|
+
<SimpleMinimalPlayer
|
|
40
|
+
src="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
|
|
41
|
+
poster="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/images/BigBuckBunny.jpg"
|
|
42
|
+
className="w-full h-full"
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### With Subtitles
|
|
50
|
+
|
|
51
|
+
```jsx
|
|
52
|
+
import { SimpleMinimalPlayer } from '@rp/baroiplayer';
|
|
53
|
+
import '@rp/baroiplayer/globals.css';
|
|
54
|
+
|
|
55
|
+
const subtitleTracks = [
|
|
56
|
+
{
|
|
57
|
+
id: "en",
|
|
58
|
+
label: "English",
|
|
59
|
+
language: "en",
|
|
60
|
+
src: "/subtitles/sample-en.vtt"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "es",
|
|
64
|
+
label: "Spanish",
|
|
65
|
+
language: "es",
|
|
66
|
+
src: "/subtitles/sample-es.vtt"
|
|
67
|
+
}
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
function App() {
|
|
71
|
+
return (
|
|
72
|
+
<SimpleMinimalPlayer
|
|
73
|
+
src="your-video.mp4"
|
|
74
|
+
subtitleTracks={subtitleTracks}
|
|
75
|
+
crossOrigin="anonymous"
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### HLS Streaming
|
|
82
|
+
|
|
83
|
+
```jsx
|
|
84
|
+
import { SimpleMinimalPlayer } from '@rp/baroiplayer';
|
|
85
|
+
|
|
86
|
+
function App() {
|
|
87
|
+
return (
|
|
88
|
+
<SimpleMinimalPlayer
|
|
89
|
+
src="https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8"
|
|
90
|
+
config={{
|
|
91
|
+
file: {
|
|
92
|
+
attributes: {
|
|
93
|
+
crossOrigin: "anonymous"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}}
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## 🎨 Styling
|
|
103
|
+
|
|
104
|
+
### Global Styles
|
|
105
|
+
|
|
106
|
+
Import the global styles for the best out-of-box experience:
|
|
107
|
+
|
|
108
|
+
```css
|
|
109
|
+
@import '@rp/baroiplayer/globals.css';
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Minimal Player Theme
|
|
113
|
+
|
|
114
|
+
For a sleek, minimal design:
|
|
115
|
+
|
|
116
|
+
```css
|
|
117
|
+
@import '@rp/baroiplayer/minimal-player.css';
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Custom Styling
|
|
121
|
+
|
|
122
|
+
The player is built with Tailwind CSS v4 and CSS custom properties for easy customization:
|
|
123
|
+
|
|
124
|
+
```css
|
|
125
|
+
:root {
|
|
126
|
+
--media-primary: oklch(62% 0.25 240);
|
|
127
|
+
--media-bg: oklch(8% 0.02 240);
|
|
128
|
+
--media-text-primary: oklch(95% 0.005 240);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.player-container {
|
|
132
|
+
--media-primary: oklch(45% 0.20 30); /* Orange theme */
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## 🎛️ Components
|
|
137
|
+
|
|
138
|
+
### SimpleMinimalPlayer
|
|
139
|
+
|
|
140
|
+
The easiest way to get started with a beautiful, accessible player:
|
|
141
|
+
|
|
142
|
+
```jsx
|
|
143
|
+
<SimpleMinimalPlayer
|
|
144
|
+
src="video.mp4"
|
|
145
|
+
poster="poster.jpg"
|
|
146
|
+
autoPlay={false}
|
|
147
|
+
muted={false}
|
|
148
|
+
subtitleTracks={subtitleTracks}
|
|
149
|
+
crossOrigin="anonymous"
|
|
150
|
+
/>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### MediaPlayer
|
|
154
|
+
|
|
155
|
+
The main player component with full customization:
|
|
156
|
+
|
|
157
|
+
```jsx
|
|
158
|
+
import { MediaPlayer, MediaPlayerControls } from '@rp/baroiplayer';
|
|
159
|
+
|
|
160
|
+
<MediaPlayer src="video.mp4">
|
|
161
|
+
<MediaPlayerControls />
|
|
162
|
+
</MediaPlayer>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### AudioPlayer
|
|
166
|
+
|
|
167
|
+
For audio-only content:
|
|
168
|
+
|
|
169
|
+
```jsx
|
|
170
|
+
import { AudioPlayer } from '@rp/baroiplayer';
|
|
171
|
+
|
|
172
|
+
<AudioPlayer src="audio.mp3" />
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## ⚙️ Props
|
|
176
|
+
|
|
177
|
+
### Common Props
|
|
178
|
+
|
|
179
|
+
| Prop | Type | Default | Description |
|
|
180
|
+
|------|------|---------|-------------|
|
|
181
|
+
| `src` | `string` | Required | Media source URL |
|
|
182
|
+
| `poster` | `string` | - | Poster image for video |
|
|
183
|
+
| `autoPlay` | `boolean` | `false` | Auto-play media |
|
|
184
|
+
| `muted` | `boolean` | `false` | Start muted |
|
|
185
|
+
| `loop` | `boolean` | `false` | Loop media |
|
|
186
|
+
| `controls` | `boolean` | `true` | Show controls |
|
|
187
|
+
| `subtitleTracks` | `array` | `[]` | Subtitle track objects |
|
|
188
|
+
| `crossOrigin` | `string` | - | CORS setting |
|
|
189
|
+
|
|
190
|
+
### Subtitle Tracks
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
interface SubtitleTrack {
|
|
194
|
+
id: string;
|
|
195
|
+
label: string;
|
|
196
|
+
language: string;
|
|
197
|
+
src: string;
|
|
198
|
+
default?: boolean;
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## 🔧 Advanced Usage
|
|
203
|
+
|
|
204
|
+
### Custom Controls
|
|
205
|
+
|
|
206
|
+
```jsx
|
|
207
|
+
import { MediaPlayer, useMediaPlayer } from '@rp/baroiplayer';
|
|
208
|
+
|
|
209
|
+
function CustomControls() {
|
|
210
|
+
const { playing, togglePlay, seek, volume } = useMediaPlayer();
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<div className="flex items-center gap-4">
|
|
214
|
+
<button onClick={togglePlay}>
|
|
215
|
+
{playing ? 'Pause' : 'Play'}
|
|
216
|
+
</button>
|
|
217
|
+
<input
|
|
218
|
+
type="range"
|
|
219
|
+
min={0}
|
|
220
|
+
max={100}
|
|
221
|
+
value={volume * 100}
|
|
222
|
+
onChange={(e) => setVolume(e.target.value / 100)}
|
|
223
|
+
/>
|
|
224
|
+
</div>
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function App() {
|
|
229
|
+
return (
|
|
230
|
+
<MediaPlayer src="video.mp4">
|
|
231
|
+
<CustomControls />
|
|
232
|
+
</MediaPlayer>
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Plugins
|
|
238
|
+
|
|
239
|
+
```jsx
|
|
240
|
+
import { MediaPlayer, AnalyticsPlugin } from '@rp/baroiplayer';
|
|
241
|
+
|
|
242
|
+
const analytics = new AnalyticsPlugin({
|
|
243
|
+
trackingId: 'your-tracking-id'
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
<MediaPlayer src="video.mp4" plugins={[analytics]} />
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Custom Themes
|
|
250
|
+
|
|
251
|
+
```jsx
|
|
252
|
+
import { SimpleMinimalPlayer } from '@rp/baroiplayer';
|
|
253
|
+
|
|
254
|
+
<SimpleMinimalPlayer
|
|
255
|
+
src="video.mp4"
|
|
256
|
+
theme={{
|
|
257
|
+
primary: 'oklch(70% 0.15 30)', // Orange
|
|
258
|
+
bg: 'oklch(15% 0.01 30)', // Dark orange background
|
|
259
|
+
}}
|
|
260
|
+
/>
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## 🎹 Keyboard Shortcuts
|
|
264
|
+
|
|
265
|
+
| Key | Action |
|
|
266
|
+
|-----|--------|
|
|
267
|
+
| `Space` | Play/Pause |
|
|
268
|
+
| `k` | Play/Pause |
|
|
269
|
+
| `f` | Toggle fullscreen |
|
|
270
|
+
| `m` | Toggle mute |
|
|
271
|
+
| `↑` | Volume up |
|
|
272
|
+
| `↓` | Volume down |
|
|
273
|
+
| `←` | Seek backward 10s |
|
|
274
|
+
| `→` | Seek forward 10s |
|
|
275
|
+
| `j` | Seek backward 10s |
|
|
276
|
+
| `l` | Seek forward 10s |
|
|
277
|
+
| `c` | Toggle captions/subtitles |
|
|
278
|
+
| `?` | Show keyboard shortcuts |
|
|
279
|
+
|
|
280
|
+
## 📱 Responsive Design
|
|
281
|
+
|
|
282
|
+
The player is fully responsive and adapts to different screen sizes:
|
|
283
|
+
|
|
284
|
+
- **Mobile**: < 640px - Compact controls with hidden time display
|
|
285
|
+
- **Tablet**: 640px - 1024px - Standard controls
|
|
286
|
+
- **Desktop**: > 1024px - Full controls with enhanced features
|
|
287
|
+
|
|
288
|
+
## 🔧 Development
|
|
289
|
+
|
|
290
|
+
### Project Setup
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
# Clone the repository
|
|
294
|
+
git clone https://github.com/yourusername/baroiplayer.git
|
|
295
|
+
cd baroiplayer
|
|
296
|
+
|
|
297
|
+
# Install dependencies
|
|
298
|
+
bun install
|
|
299
|
+
|
|
300
|
+
# Start development
|
|
301
|
+
bun run dev
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### Available Scripts
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
# Development
|
|
308
|
+
bun run dev # Start development server
|
|
309
|
+
bun run build # Build for production
|
|
310
|
+
bun run build:analyze # Build with bundle analysis
|
|
311
|
+
|
|
312
|
+
# Testing
|
|
313
|
+
bun run test # Run tests
|
|
314
|
+
bun run test:watch # Run tests in watch mode
|
|
315
|
+
bun run test:coverage # Run tests with coverage
|
|
316
|
+
|
|
317
|
+
# Quality
|
|
318
|
+
bun run lint # Run linter
|
|
319
|
+
bun run check-types # Check TypeScript types
|
|
320
|
+
bun run size-limit # Check bundle size limits
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Building for Production
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
# Build the package
|
|
327
|
+
bun run build
|
|
328
|
+
|
|
329
|
+
# Run pre-publish checks
|
|
330
|
+
bun run prepublishOnly
|
|
331
|
+
|
|
332
|
+
# Publish to npm
|
|
333
|
+
npm publish
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## 🏗️ Architecture
|
|
337
|
+
|
|
338
|
+
### Core Components
|
|
339
|
+
|
|
340
|
+
- **MediaPlayer**: Main player component
|
|
341
|
+
- **MediaPlayerControls**: Control panel component
|
|
342
|
+
- **AudioPlayer**: Audio-specific player
|
|
343
|
+
- **SimpleMinimalPlayer**: Easy-to-use minimal player
|
|
344
|
+
|
|
345
|
+
### Features
|
|
346
|
+
|
|
347
|
+
- **Core**: Event system, plugin architecture, performance optimization
|
|
348
|
+
- **Accessibility**: Keyboard navigation, screen reader support, ARIA attributes
|
|
349
|
+
- **Styling**: Tailwind CSS integration, design tokens, responsive design
|
|
350
|
+
- **Media**: HLS support, subtitle handling, format detection
|
|
351
|
+
|
|
352
|
+
## 🤝 Contributing
|
|
353
|
+
|
|
354
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
355
|
+
|
|
356
|
+
### Development Workflow
|
|
357
|
+
|
|
358
|
+
1. Fork the repository
|
|
359
|
+
2. Create a feature branch
|
|
360
|
+
3. Make your changes
|
|
361
|
+
4. Add tests for new functionality
|
|
362
|
+
5. Run the test suite
|
|
363
|
+
6. Submit a pull request
|
|
364
|
+
|
|
365
|
+
## 📄 License
|
|
366
|
+
|
|
367
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
368
|
+
|
|
369
|
+
## 🙏 Acknowledgments
|
|
370
|
+
|
|
371
|
+
- [React Player](https://github.com/CookPete/react-player) for media playback
|
|
372
|
+
- [Tailwind CSS](https://tailwindcss.com/) for styling
|
|
373
|
+
- [Radix UI](https://www.radix-ui.com/) for accessible components
|
|
374
|
+
- [Video.js](https://videojs.com/) for advanced media features
|
|
375
|
+
|
|
376
|
+
## 📞 Support
|
|
377
|
+
|
|
378
|
+
- 📚 [Documentation](https://github.com/yourusername/baroiplayer/wiki)
|
|
379
|
+
- 🐛 [Issue Tracker](https://github.com/yourusername/baroiplayer/issues)
|
|
380
|
+
- 💬 [Discussions](https://github.com/yourusername/baroiplayer/discussions)
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
Made with ❤️ by the Baroi Team
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react");const e=require("../context-DCJ_scmO.cjs");exports.MediaActionTypes=e.MediaActionTypes;exports.MediaContext=e.MediaContext;exports.MediaStoreContext=e.MediaStoreContext;exports.initialMediaState=e.initialMediaState;exports.useMediaContext=e.useMediaContext;exports.useMediaDispatch=e.useMediaDispatch;exports.useMediaEnhancements=e.useMediaEnhancements;exports.useMediaSelector=e.useMediaSelector;exports.useMediaStore=e.useMediaStore;exports.useOptimisticMediaSelector=e.useOptimisticMediaSelector;
|
|
2
|
+
//# sourceMappingURL=media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { M as s, g as t, h as o, k as M, u as d, a as n, i as c, b as r, c as u, e as p } from "../context-BMteAJDN.js";
|
|
3
|
+
export {
|
|
4
|
+
s as MediaActionTypes,
|
|
5
|
+
t as MediaContext,
|
|
6
|
+
o as MediaStoreContext,
|
|
7
|
+
M as initialMediaState,
|
|
8
|
+
d as useMediaContext,
|
|
9
|
+
n as useMediaDispatch,
|
|
10
|
+
c as useMediaEnhancements,
|
|
11
|
+
r as useMediaSelector,
|
|
12
|
+
u as useMediaStore,
|
|
13
|
+
p as useOptimisticMediaSelector
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=media.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|