feat(player): replace native cues with custom subtitle renderer
This commit is contained in:
@@ -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 |
|
||||
|
||||
Reference in New Issue
Block a user