@nikelroot/video-player 0.2.5 → 0.2.6
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/README.md +24 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,7 +37,30 @@ export function Example() {
|
|
|
37
37
|
}
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
When `active` is `true`, pressing `F` toggles fullscreen.
|
|
40
|
+
When `active` is `true`, pressing `F` toggles fullscreen.
|
|
41
|
+
|
|
42
|
+
## Multiple MP4 players
|
|
43
|
+
|
|
44
|
+
Use `active` when rendering several video players on the same page and only one of them should be ready for playback.
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
<VideoPlayer
|
|
48
|
+
videoSrc="https://cdn.example.com/video-a.mp4"
|
|
49
|
+
sourceType="native"
|
|
50
|
+
active={isSelected}
|
|
51
|
+
preload="metadata"
|
|
52
|
+
/>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This solves a switching problem where previous MP4 players can keep large browser media requests open after another player starts. In Chrome DevTools this often appears as new video requests staying in a long `Pending` state, even when CDN, disk, and network throughput are healthy.
|
|
56
|
+
|
|
57
|
+
For native MP4 sources:
|
|
58
|
+
|
|
59
|
+
- `active={true}` allows playback and fullscreen.
|
|
60
|
+
- `active={false}` releases playback loading so inactive players do not keep competing media requests open.
|
|
61
|
+
- `preload="metadata"` still loads metadata for inactive native videos, so duration and basic media information can be available without starting playback loading.
|
|
62
|
+
|
|
63
|
+
By default `exclusivePlayback` is enabled. When a player starts playback, the previous active native MP4 player is paused and its media source is released, freeing the browser media request before the next video loads.
|
|
41
64
|
|
|
42
65
|
For public CDN-hosted videos, prefer non-credentialed requests unless the CDN is explicitly configured for cookies:
|
|
43
66
|
|
|
@@ -56,4 +79,3 @@ Build before publishing:
|
|
|
56
79
|
```bash
|
|
57
80
|
npm run build
|
|
58
81
|
```
|
|
59
|
-
# video-player
|