feat(player): replace native cues with custom subtitle renderer

This commit is contained in:
hibna
2026-02-12 19:56:46 +03:00
parent 83124fbd05
commit 961d9ac3b9
7 changed files with 362 additions and 189 deletions
+21
View File
@@ -157,6 +157,24 @@ function App() {
/>
```
### Subtitle Styling (Custom Renderer)
```tsx
<VideoPlayer
src="https://example.com/video.mp4"
subtitles={[{ src: '/subtitles/en.vtt', lang: 'en', label: 'English', default: true }]}
subtitlePosition="bottom"
subtitleOffset={72}
subtitleStyle={{
fontSize: 24,
fontFamily: 'Arial, sans-serif',
color: '#f8fafc',
backgroundColor: '#111827',
backgroundOpacity: 0.72,
}}
/>
```
### HLS Streaming
```tsx
@@ -333,6 +351,9 @@ video-player/
| `controlsList` | `string` | - | Passes `controlsList` attribute to the video element |
| `controls` | `boolean` | `true` | Show player controls |
| `subtitles` | `SubtitleTrack[]` | `[]` | Subtitle tracks |
| `subtitleStyle` | `SubtitleStyle` | - | Custom subtitle text/background style |
| `subtitlePosition` | `'top' \| 'center' \| 'bottom'` | `'bottom'` | Subtitle vertical placement |
| `subtitleOffset` | `number \| string` | - | Subtitle offset (`px` if number) |
| `theme` | `PlayerTheme` | - | Custom theme colors |
| `language` | `string` | `'en'` | UI language ('en' or 'tr') |
| `keyboardShortcuts` | `boolean` | `true` | Enable keyboard shortcuts |