release: v3.0.0
This commit is contained in:
@@ -110,11 +110,14 @@ pnpm add @source/player
|
||||
yarn add @source/player
|
||||
```
|
||||
|
||||
### 4. Ensure peer dependencies
|
||||
> **Note:** This package requires `react` (>=18) and `react-dom` (>=18) at runtime but does **not** list them as `peerDependencies` to avoid install conflicts with private registries. Make sure your project already has React installed.
|
||||
|
||||
```bash
|
||||
npm install react react-dom
|
||||
```
|
||||
> **Streaming libraries (optional):** HLS, FLV and MPEG-TS streaming libraries are loaded automatically from CDN when needed. If you prefer to bundle them locally, install them separately:
|
||||
> ```bash
|
||||
> npm install hls.js # HLS (.m3u8) streams
|
||||
> npm install flv.js # FLV/RTMP streams
|
||||
> npm install mpegts.js # MPEG-TS (.ts) streams
|
||||
> ```
|
||||
|
||||
### Local development (optional)
|
||||
|
||||
@@ -145,6 +148,21 @@ function App() {
|
||||
}
|
||||
```
|
||||
|
||||
### Error Boundary (Optional)
|
||||
|
||||
```tsx
|
||||
import { VideoPlayer, PlayerErrorBoundary } from '@source/player'
|
||||
import '@source/player/styles.css'
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<PlayerErrorBoundary>
|
||||
<VideoPlayer src="https://example.com/video.mp4" />
|
||||
</PlayerErrorBoundary>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
### With Subtitles
|
||||
|
||||
```tsx
|
||||
@@ -305,6 +323,12 @@ npm run build:lib
|
||||
|
||||
# Type check
|
||||
npx tsc --noEmit
|
||||
|
||||
# Format check
|
||||
npm run format:check
|
||||
|
||||
# Full publish validation
|
||||
npm run validate:publish
|
||||
```
|
||||
|
||||
### Project Structure
|
||||
@@ -382,6 +406,16 @@ video-player/
|
||||
| `onWaiting` | `() => void` | Fired when buffering starts |
|
||||
| `onCanPlay` | `() => void` | Fired when enough data is available to play |
|
||||
|
||||
### PlayerErrorBoundary Props
|
||||
|
||||
| Prop | Type | Description |
|
||||
|------|------|-------------|
|
||||
| `children` | `ReactNode` | Wrapped player/content tree |
|
||||
| `fallback` | `ReactNode \| (error: Error, retry: () => void) => ReactNode` | Optional custom fallback UI |
|
||||
| `onError` | `(error: Error, errorInfo: React.ErrorInfo) => void` | Called when render errors are captured |
|
||||
| `onReset` | `() => void` | Called when retry/reset is triggered |
|
||||
| `resetKeys` | `readonly unknown[]` | Resets boundary when any key changes |
|
||||
|
||||
### SubtitleTrack
|
||||
|
||||
```typescript
|
||||
@@ -418,7 +452,7 @@ interface PlayerTheme {
|
||||
- Core player CSS bundle: **~3.5KB** (gzipped)
|
||||
- HLS.js (optional, lazy-loaded): **~200KB** (only when using HLS streams)
|
||||
- MPEGTS.js (optional, lazy-loaded): **~72KB** (gzipped, only for `.ts` streams)
|
||||
- Zero runtime dependencies (React is peer dependency)
|
||||
- Zero runtime dependencies (React is a prerequisite, see installation notes)
|
||||
|
||||
## 🔧 Technical Details
|
||||
|
||||
|
||||
Reference in New Issue
Block a user