xgplayer-mp4 3.0.0-next.3 → 3.0.0-next.4

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.
Files changed (165) hide show
  1. package/README.md +62 -0
  2. package/dist/index.min.js +1 -1
  3. package/dist/index.min.js.map +1 -1
  4. package/es/_virtual/_rollupPluginBabelHelpers.js +481 -1
  5. package/es/error.d.ts +40 -4
  6. package/es/error.js +77 -8
  7. package/es/index.d.ts +1 -2
  8. package/es/index.js +0 -1
  9. package/es/mp4.d.ts +103 -68
  10. package/es/mp4.js +874 -525
  11. package/es/mp4Plugin.d.ts +100 -39
  12. package/es/mp4Plugin.js +869 -290
  13. package/es/util/index.d.ts +2 -43
  14. package/es/util/index.js +54 -166
  15. package/es/util/logger.d.ts +5 -0
  16. package/es/util/logger.js +53 -0
  17. package/es/util/timer.d.ts +8 -0
  18. package/es/util/timer.js +50 -0
  19. package/es/version.d.ts +2 -0
  20. package/es/version.js +2 -0
  21. package/es/worker/index.d.ts +10 -0
  22. package/es/worker/index.js +63 -0
  23. package/es/worker/transmuxerworker.js +21 -0
  24. package/package.json +7 -3
  25. package/es/fmp4/buffer.d.ts +0 -6
  26. package/es/fmp4/buffer.js +0 -23
  27. package/es/fmp4/m4a.d.ts +0 -42
  28. package/es/fmp4/m4a.js +0 -928
  29. package/es/fmp4/mp4.d.ts +0 -42
  30. package/es/fmp4/mp4.js +0 -948
  31. package/es/m4a.d.ts +0 -61
  32. package/es/m4a.js +0 -583
  33. package/es/m4aPlugin.d.ts +0 -48
  34. package/es/m4aPlugin.js +0 -385
  35. package/es/media/mse.d.ts +0 -17
  36. package/es/media/mse.js +0 -75
  37. package/es/media/task.d.ts +0 -19
  38. package/es/media/task.js +0 -103
  39. package/es/parse/box.d.ts +0 -17
  40. package/es/parse/box.js +0 -69
  41. package/es/parse/boxParse/MP4DecConfigDescrTag.d.ts +0 -2
  42. package/es/parse/boxParse/MP4DecConfigDescrTag.js +0 -25
  43. package/es/parse/boxParse/MP4DecSpecificDescrTag.d.ts +0 -2
  44. package/es/parse/boxParse/MP4DecSpecificDescrTag.js +0 -25
  45. package/es/parse/boxParse/MP4ESDescrTag.d.ts +0 -2
  46. package/es/parse/boxParse/MP4ESDescrTag.js +0 -23
  47. package/es/parse/boxParse/SLConfigDescriptor.d.ts +0 -2
  48. package/es/parse/boxParse/SLConfigDescriptor.js +0 -19
  49. package/es/parse/boxParse/avc1.d.ts +0 -10
  50. package/es/parse/boxParse/avc1.js +0 -30
  51. package/es/parse/boxParse/avcC.d.ts +0 -15
  52. package/es/parse/boxParse/avcC.js +0 -35
  53. package/es/parse/boxParse/btrt.d.ts +0 -6
  54. package/es/parse/boxParse/btrt.js +0 -11
  55. package/es/parse/boxParse/co64.d.ts +0 -7
  56. package/es/parse/boxParse/co64.js +0 -16
  57. package/es/parse/boxParse/ctts.d.ts +0 -7
  58. package/es/parse/boxParse/ctts.js +0 -19
  59. package/es/parse/boxParse/dref.d.ts +0 -6
  60. package/es/parse/boxParse/dref.js +0 -18
  61. package/es/parse/boxParse/elst.d.ts +0 -8
  62. package/es/parse/boxParse/elst.js +0 -35
  63. package/es/parse/boxParse/esds.d.ts +0 -5
  64. package/es/parse/boxParse/esds.js +0 -12
  65. package/es/parse/boxParse/ftyp.d.ts +0 -6
  66. package/es/parse/boxParse/ftyp.js +0 -15
  67. package/es/parse/boxParse/hdlr.d.ts +0 -7
  68. package/es/parse/boxParse/hdlr.js +0 -18
  69. package/es/parse/boxParse/hmhd.d.ts +0 -0
  70. package/es/parse/boxParse/index.d.ts +0 -32
  71. package/es/parse/boxParse/index.js +0 -31
  72. package/es/parse/boxParse/iods.d.ts +0 -6
  73. package/es/parse/boxParse/iods.js +0 -16
  74. package/es/parse/boxParse/mdat.d.ts +0 -1
  75. package/es/parse/boxParse/mdat.js +0 -4
  76. package/es/parse/boxParse/mdhd.d.ts +0 -12
  77. package/es/parse/boxParse/mdhd.js +0 -28
  78. package/es/parse/boxParse/mfhd.d.ts +0 -0
  79. package/es/parse/boxParse/mp4a.d.ts +0 -7
  80. package/es/parse/boxParse/mp4a.js +0 -19
  81. package/es/parse/boxParse/mvhd.d.ts +0 -15
  82. package/es/parse/boxParse/mvhd.js +0 -27
  83. package/es/parse/boxParse/nmhd.d.ts +0 -0
  84. package/es/parse/boxParse/pasp.d.ts +0 -4
  85. package/es/parse/boxParse/pasp.js +0 -9
  86. package/es/parse/boxParse/sbgp.d.ts +0 -0
  87. package/es/parse/boxParse/sdtp.d.ts +0 -0
  88. package/es/parse/boxParse/smhd.d.ts +0 -6
  89. package/es/parse/boxParse/smhd.js +0 -11
  90. package/es/parse/boxParse/stco.d.ts +0 -7
  91. package/es/parse/boxParse/stco.js +0 -16
  92. package/es/parse/boxParse/stsc.d.ts +0 -7
  93. package/es/parse/boxParse/stsc.js +0 -36
  94. package/es/parse/boxParse/stsd.d.ts +0 -6
  95. package/es/parse/boxParse/stsd.js +0 -15
  96. package/es/parse/boxParse/stsh.d.ts +0 -0
  97. package/es/parse/boxParse/stss.d.ts +0 -7
  98. package/es/parse/boxParse/stss.js +0 -16
  99. package/es/parse/boxParse/stsz.d.ts +0 -8
  100. package/es/parse/boxParse/stsz.js +0 -17
  101. package/es/parse/boxParse/stts.d.ts +0 -10
  102. package/es/parse/boxParse/stts.js +0 -19
  103. package/es/parse/boxParse/stz2.d.ts +0 -0
  104. package/es/parse/boxParse/tfhd.d.ts +0 -0
  105. package/es/parse/boxParse/tkhd.d.ts +0 -18
  106. package/es/parse/boxParse/tkhd.js +0 -40
  107. package/es/parse/boxParse/traf.d.ts +0 -0
  108. package/es/parse/boxParse/trun.d.ts +0 -0
  109. package/es/parse/boxParse/udta.d.ts +0 -1
  110. package/es/parse/boxParse/udta.js +0 -4
  111. package/es/parse/boxParse/url.d.ts +0 -6
  112. package/es/parse/boxParse/url.js +0 -16
  113. package/es/parse/boxParse/vmhd.d.ts +0 -7
  114. package/es/parse/boxParse/vmhd.js +0 -12
  115. package/es/parse/date.d.ts +0 -5
  116. package/es/parse/date.js +0 -17
  117. package/es/parse/index.d.ts +0 -8
  118. package/es/parse/index.js +0 -44
  119. package/es/parse/stream.d.ts +0 -23
  120. package/es/parse/stream.js +0 -106
  121. package/es/write/box/MP4DecConfigDescrTag.d.ts +0 -1
  122. package/es/write/box/MP4DecSpecificDescrTag.d.ts +0 -1
  123. package/es/write/box/MP4ESDescrTag.d.ts +0 -1
  124. package/es/write/box/SLConfigDescriptor.d.ts +0 -1
  125. package/es/write/box/avc1.d.ts +0 -1
  126. package/es/write/box/avcC.d.ts +0 -1
  127. package/es/write/box/btrt.d.ts +0 -1
  128. package/es/write/box/co64.d.ts +0 -1
  129. package/es/write/box/ctts.d.ts +0 -1
  130. package/es/write/box/dref.d.ts +0 -1
  131. package/es/write/box/elst.d.ts +0 -1
  132. package/es/write/box/esds.d.ts +0 -1
  133. package/es/write/box/ftyp.d.ts +0 -1
  134. package/es/write/box/hdlr.d.ts +0 -1
  135. package/es/write/box/iods.d.ts +0 -1
  136. package/es/write/box/mdat.d.ts +0 -1
  137. package/es/write/box/mdhd.d.ts +0 -1
  138. package/es/write/box/mehd.d.ts +0 -1
  139. package/es/write/box/mfhd.d.ts +0 -1
  140. package/es/write/box/mfro.d.ts +0 -1
  141. package/es/write/box/mp4a.d.ts +0 -1
  142. package/es/write/box/mvhd.d.ts +0 -1
  143. package/es/write/box/pasp.d.ts +0 -1
  144. package/es/write/box/smhd.d.ts +0 -1
  145. package/es/write/box/stco.d.ts +0 -1
  146. package/es/write/box/stsc.d.ts +0 -1
  147. package/es/write/box/stsd.d.ts +0 -1
  148. package/es/write/box/stss.d.ts +0 -1
  149. package/es/write/box/stsz.d.ts +0 -1
  150. package/es/write/box/stts.d.ts +0 -1
  151. package/es/write/box/tfdt.d.ts +0 -1
  152. package/es/write/box/tfhd.d.ts +0 -1
  153. package/es/write/box/tfra.d.ts +0 -1
  154. package/es/write/box/tkhd.d.ts +0 -1
  155. package/es/write/box/trex.d.ts +0 -1
  156. package/es/write/box/trun.d.ts +0 -1
  157. package/es/write/box/udta.d.ts +0 -1
  158. package/es/write/box/url.d.ts +0 -1
  159. package/es/write/box/vmhd.d.ts +0 -1
  160. package/es/write/box/wide.d.ts +0 -1
  161. package/es/write/box.d.ts +0 -15
  162. package/es/write/buffer.d.ts +0 -5
  163. package/es/write/index.d.ts +0 -5
  164. package/es/write/stream.d.ts +0 -20
  165. /package/es/{index_backup.d.ts → worker/transmuxerworker.d.ts} +0 -0
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
+