xgplayer-mp4 3.0.0-alpha.28 → 3.0.0-alpha.30

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 ADDED
@@ -0,0 +1,62 @@
1
+ # xgplayer-mp4
2
+
3
+ ## 简介
4
+
5
+ xgplayer-mp4模块基于MSE方式实现mp4的播放控制。
6
+
7
+ ### MP4播放
8
+
9
+ ```javascript
10
+ import Player from "xgplayer"
11
+ import Mp4Plugin from "xgplayer-mp4"
12
+ import "xgplayer/dist/xgplayer.min.css"
13
+
14
+
15
+
16
+ const player = new Player({
17
+ url,
18
+ id,
19
+ autoplay: true,
20
+ height: window.innerHeight,
21
+ width: window.innerWidth,
22
+ plugins: [Mp4Plugin],
23
+ mp4plugin: {
24
+ maxBufferLength: 30,
25
+ minBufferLength: 10,
26
+ reqOptions:{
27
+ mode: 'cors',
28
+ method: 'POST',
29
+ headers: { // 需要带的自定义请求头
30
+ 'x-test-header': 'rrrr'
31
+ },
32
+ }
33
+ // ... 其他配置
34
+ }
35
+ })
36
+
37
+ player.on('canplay', ()=>{
38
+ // do something
39
+ })
40
+
41
+ ```
42
+
43
+
44
+ 可配置的能力
45
+
46
+ | 配置字段 | 默认值 | 含义 |
47
+ | ------ | -------- | ----- |
48
+ | maxBufferLength | 40 | 播放的最大的buffer长度(s) |
49
+ | minBufferLength | 5 | 播放的最小的buffer长度(s)|
50
+ | disableBufferBreakCheck | false | 是否开启卡顿超时检测 |
51
+ | waitingTimeOut | 15s | 卡顿超时时间 |
52
+ | waitingInBufferTimeOut | 5s | 在buffer区间内的卡顿超时时间 |
53
+ | waitJampBufferMaxCnt | 3 | 一次播放中在buffer区间内卡顿超时最多可以seek调整几次 |
54
+ | chunkSize | 15625 | 第一次请求的数据的size长度 |
55
+ | tickInSeconds | 0.1 | 驱动下载的timer的时间间隔 |
56
+ | segmentDuration | 5s | 一次下载数据的最小视频时长|
57
+ | onProcessMinLen | 1024 | fetch每次回调数据的最小长度|
58
+ | retryCount | 2 | loader请求失败时的重试次数 |
59
+ | retryDelay | 1000 | 重试的时间间隔(ms) |
60
+ | timeout | 3000 | loader请求的超时时间(ms) |
61
+ | enableWorker | false | transmux是否使用worker|
62
+