xgplayer 2.32.5 → 2.32.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.
Files changed (371) hide show
  1. package/browser/controls/airplay.js +1 -1
  2. package/browser/controls/cssFullscreen.js +1 -1
  3. package/browser/controls/danmu.js +3 -1
  4. package/browser/controls/definition.js +1 -1
  5. package/browser/controls/download.js +1 -1
  6. package/browser/controls/enter.js +1 -1
  7. package/browser/controls/error.js +1 -1
  8. package/browser/controls/errorRetry.js +1 -1
  9. package/browser/controls/flex.js +1 -1
  10. package/browser/controls/fullscreen.js +1 -1
  11. package/browser/controls/loading.js +1 -1
  12. package/browser/controls/memoryPlay.js +1 -1
  13. package/browser/controls/miniplayer.js +9 -7
  14. package/browser/controls/mobile.js +1 -1
  15. package/browser/controls/nativeTextTrack.js +1 -1
  16. package/browser/controls/pc.js +1 -1
  17. package/browser/controls/pip.js +1 -1
  18. package/browser/controls/play.js +1 -1
  19. package/browser/controls/playNext.js +1 -1
  20. package/browser/controls/playbackRate.js +1 -1
  21. package/browser/controls/poster.js +1 -1
  22. package/browser/controls/progress.js +1 -1
  23. package/browser/controls/reload.js +1 -1
  24. package/browser/controls/replay.js +1 -1
  25. package/browser/controls/rotate.js +1 -1
  26. package/browser/controls/screenShot.js +1 -1
  27. package/browser/controls/start.js +1 -1
  28. package/browser/controls/textTrack.js +1 -1
  29. package/browser/controls/time.js +1 -1
  30. package/browser/controls/volume.js +1 -1
  31. package/browser/core_player.js +1 -1
  32. package/browser/core_player.js.map +1 -1
  33. package/browser/index.js +11 -7
  34. package/browser/index.js.map +1 -1
  35. package/browser/simple_player.js +1 -1
  36. package/browser/simple_player.js.map +1 -1
  37. package/dist/controls/airplay.js +1 -1
  38. package/dist/controls/cssFullscreen.js +1 -1
  39. package/dist/controls/danmu.js +3 -1
  40. package/dist/controls/definition.js +1 -1
  41. package/dist/controls/download.js +1 -1
  42. package/dist/controls/enter.js +1 -1
  43. package/dist/controls/error.js +1 -1
  44. package/dist/controls/errorRetry.js +1 -1
  45. package/dist/controls/flex.js +1 -1
  46. package/dist/controls/fullscreen.js +1 -1
  47. package/dist/controls/loading.js +1 -1
  48. package/dist/controls/memoryPlay.js +1 -1
  49. package/dist/controls/miniplayer.js +9 -7
  50. package/dist/controls/mobile.js +1 -1
  51. package/dist/controls/nativeTextTrack.js +1 -1
  52. package/dist/controls/pc.js +1 -1
  53. package/dist/controls/pip.js +1 -1
  54. package/dist/controls/play.js +1 -1
  55. package/dist/controls/playNext.js +1 -1
  56. package/dist/controls/playbackRate.js +1 -1
  57. package/dist/controls/poster.js +1 -1
  58. package/dist/controls/progress.js +1 -1
  59. package/dist/controls/reload.js +1 -1
  60. package/dist/controls/replay.js +1 -1
  61. package/dist/controls/rotate.js +1 -1
  62. package/dist/controls/screenShot.js +1 -1
  63. package/dist/controls/start.js +1 -1
  64. package/dist/controls/textTrack.js +1 -1
  65. package/dist/controls/time.js +1 -1
  66. package/dist/controls/volume.js +1 -1
  67. package/dist/core_player.js +2960 -2889
  68. package/dist/core_player.js.map +1 -1
  69. package/dist/index.js +1938 -3321
  70. package/dist/index.js.map +1 -1
  71. package/dist/index.min.css +1 -0
  72. package/dist/index.min.js +2 -0
  73. package/dist/index.min.js.map +1 -0
  74. package/dist/simple_player.js +274 -281
  75. package/dist/simple_player.js.map +1 -1
  76. package/es/_virtual/_rollupPluginBabelHelpers.js +216 -0
  77. package/es/constant.d.ts +4 -0
  78. package/es/constant.js +5 -0
  79. package/es/controls/airplay.js +1 -1
  80. package/es/controls/cssFullscreen.js +1 -1
  81. package/es/controls/danmu.js +3 -1
  82. package/es/controls/definition.js +1 -1
  83. package/es/controls/download.js +1 -1
  84. package/es/controls/enter.js +1 -1
  85. package/es/controls/error.js +1 -1
  86. package/es/controls/errorRetry.js +1 -1
  87. package/es/controls/flex.js +1 -1
  88. package/es/controls/fullscreen.js +1 -1
  89. package/es/controls/i18n.js +1 -1
  90. package/es/controls/keyboard.js +1 -1
  91. package/es/controls/loading.js +1 -1
  92. package/es/controls/localPreview.js +1 -1
  93. package/es/controls/memoryPlay.js +1 -1
  94. package/es/controls/miniplayer.js +9 -7
  95. package/es/controls/mobile.js +1 -1
  96. package/es/controls/nativeTextTrack.js +1 -1
  97. package/es/controls/pc.js +1 -1
  98. package/es/controls/pip.js +1 -1
  99. package/es/controls/play.js +1 -1
  100. package/es/controls/playNext.js +1 -1
  101. package/es/controls/playbackRate.js +1 -1
  102. package/es/controls/poster.js +1 -1
  103. package/es/controls/progress.js +1 -1
  104. package/es/controls/reload.js +1 -1
  105. package/es/controls/replay.js +1 -1
  106. package/es/controls/rotate.js +1 -1
  107. package/es/controls/screenShot.js +1 -1
  108. package/es/controls/start.js +1 -1
  109. package/es/controls/textTrack.js +1 -1
  110. package/es/controls/time.js +1 -1
  111. package/es/controls/volume.js +1 -1
  112. package/es/core_player.js +1 -1
  113. package/es/core_player.js.map +1 -1
  114. package/es/defaultConfig.d.ts +243 -0
  115. package/es/defaultConfig.js +85 -0
  116. package/es/error.d.ts +114 -0
  117. package/es/error.js +75 -0
  118. package/es/events.d.ts +61 -0
  119. package/es/events.js +62 -0
  120. package/es/icons.d.ts +2 -0
  121. package/es/index.css +499 -0
  122. package/es/index.d.ts +25 -0
  123. package/es/index.js +11 -7
  124. package/es/index.js.map +1 -1
  125. package/es/index.scss +29 -0
  126. package/es/index.umd.d.ts +60 -0
  127. package/es/index.umd.js +30 -0
  128. package/es/lang/en.d.ts +91 -0
  129. package/es/lang/en.js +77 -0
  130. package/es/lang/i18n.d.ts +36 -0
  131. package/es/lang/i18n.js +122 -0
  132. package/es/lang/index.d.ts +2 -0
  133. package/es/lang/jp.d.ts +91 -0
  134. package/es/lang/jp.js +77 -0
  135. package/es/lang/zh-cn.d.ts +91 -0
  136. package/es/lang/zh-cn.js +77 -0
  137. package/es/lang/zh-hk.d.ts +91 -0
  138. package/es/lang/zh-hk.js +77 -0
  139. package/es/mediaProxy.d.ts +334 -0
  140. package/es/mediaProxy.js +623 -0
  141. package/es/player.d.ts +825 -0
  142. package/es/player.js +1945 -0
  143. package/es/plugin/basePlugin.d.ts +180 -0
  144. package/es/plugin/basePlugin.js +259 -0
  145. package/es/plugin/hooksDescriptor.d.ts +60 -0
  146. package/es/plugin/hooksDescriptor.js +149 -0
  147. package/es/plugin/index.d.ts +13 -0
  148. package/es/plugin/plugin.d.ts +207 -0
  149. package/es/plugin/plugin.js +542 -0
  150. package/es/plugin/pluginsManager.d.ts +162 -0
  151. package/es/plugin/pluginsManager.js +362 -0
  152. package/es/plugin/preset.d.ts +1 -0
  153. package/es/plugin/preset.js +28 -0
  154. package/es/plugin/resizeObserver.d.ts +3 -0
  155. package/es/plugin/resizeObserver.js +108 -0
  156. package/es/plugins/assets/back.js +4 -0
  157. package/es/plugins/assets/download.js +4 -0
  158. package/es/plugins/assets/exitCssFull.js +4 -0
  159. package/es/plugins/assets/exitFull.js +4 -0
  160. package/es/plugins/assets/loading.js +4 -0
  161. package/es/plugins/assets/panel.js +4 -0
  162. package/es/plugins/assets/pause.js +4 -0
  163. package/es/plugins/assets/pipIcon.js +4 -0
  164. package/es/plugins/assets/pipIconExit.js +4 -0
  165. package/es/plugins/assets/play.js +4 -0
  166. package/es/plugins/assets/playNext.js +4 -0
  167. package/es/plugins/assets/replay.js +4 -0
  168. package/es/plugins/assets/requestCssFull.js +7 -0
  169. package/es/plugins/assets/requestFull.js +4 -0
  170. package/es/plugins/assets/rotate.js +4 -0
  171. package/es/plugins/assets/seekicon.js +4 -0
  172. package/es/plugins/assets/volumeLarge.js +4 -0
  173. package/es/plugins/assets/volumeMuted.js +4 -0
  174. package/es/plugins/assets/volumeSmall.js +4 -0
  175. package/es/plugins/common/iconPlugin.d.ts +5 -0
  176. package/es/plugins/common/iconPlugin.js +42 -0
  177. package/es/plugins/common/iconTools.d.ts +1 -0
  178. package/es/plugins/common/iconTools.js +8 -0
  179. package/es/plugins/common/index.scss +2 -0
  180. package/es/plugins/common/optionList.d.ts +15 -0
  181. package/es/plugins/common/optionList.js +120 -0
  182. package/es/plugins/common/optionsIcon.d.ts +40 -0
  183. package/es/plugins/common/optionsIcon.js +304 -0
  184. package/es/plugins/common/optionsIcon.scss +154 -0
  185. package/es/plugins/common/thumbnail.d.ts +62 -0
  186. package/es/plugins/common/thumbnail.js +191 -0
  187. package/es/plugins/common/thumbnail.scss +27 -0
  188. package/es/plugins/controls/index.css +132 -0
  189. package/es/plugins/controls/index.d.ts +73 -0
  190. package/es/plugins/controls/index.js +189 -0
  191. package/es/plugins/controls/index.scss +204 -0
  192. package/es/plugins/cssFullScreen/index.css +12 -0
  193. package/es/plugins/cssFullScreen/index.d.ts +40 -0
  194. package/es/plugins/cssFullScreen/index.js +136 -0
  195. package/es/plugins/cssFullScreen/index.scss +19 -0
  196. package/es/plugins/danmu/danmuIcon.d.ts +24 -0
  197. package/es/plugins/danmu/danmuIcon.js +98 -0
  198. package/es/plugins/danmu/danmuPanel.d.ts +39 -0
  199. package/es/plugins/danmu/danmuPanel.js +81 -0
  200. package/es/plugins/danmu/index.css +603 -0
  201. package/es/plugins/danmu/index.d.ts +96 -0
  202. package/es/plugins/danmu/index.js +313 -0
  203. package/es/plugins/danmu/index.scss +356 -0
  204. package/es/plugins/definition/index.css +4 -0
  205. package/es/plugins/definition/index.d.ts +38 -0
  206. package/es/plugins/definition/index.js +164 -0
  207. package/es/plugins/definition/index.scss +4 -0
  208. package/es/plugins/download/index.css +13 -0
  209. package/es/plugins/download/index.d.ts +31 -0
  210. package/es/plugins/download/index.js +107 -0
  211. package/es/plugins/download/index.scss +22 -0
  212. package/es/plugins/dynamicBg/index.css +16 -0
  213. package/es/plugins/dynamicBg/index.d.ts +83 -0
  214. package/es/plugins/dynamicBg/index.js +316 -0
  215. package/es/plugins/dynamicBg/index.scss +19 -0
  216. package/es/plugins/enter/index.css +104 -0
  217. package/es/plugins/enter/index.d.ts +19 -0
  218. package/es/plugins/enter/index.js +46 -0
  219. package/es/plugins/enter/index.scss +78 -0
  220. package/es/plugins/error/index.css +29 -0
  221. package/es/plugins/error/index.d.ts +8 -0
  222. package/es/plugins/error/index.js +75 -0
  223. package/es/plugins/error/index.scss +34 -0
  224. package/es/plugins/fpsDetect/index.d.ts +34 -0
  225. package/es/plugins/fpsDetect/index.js +149 -0
  226. package/es/plugins/fullscreen/backicon.d.ts +17 -0
  227. package/es/plugins/fullscreen/backicon.js +72 -0
  228. package/es/plugins/fullscreen/index.css +23 -0
  229. package/es/plugins/fullscreen/index.d.ts +58 -0
  230. package/es/plugins/fullscreen/index.js +202 -0
  231. package/es/plugins/fullscreen/index.scss +35 -0
  232. package/es/plugins/gapJump/index.d.ts +21 -0
  233. package/es/plugins/gapJump/index.js +142 -0
  234. package/es/plugins/keyboard/index.d.ts +89 -0
  235. package/es/plugins/keyboard/index.js +421 -0
  236. package/es/plugins/loading/index.css +58 -0
  237. package/es/plugins/loading/index.d.ts +11 -0
  238. package/es/plugins/loading/index.js +43 -0
  239. package/es/plugins/loading/index.scss +70 -0
  240. package/es/plugins/logger/index.d.ts +54 -0
  241. package/es/plugins/logger/index.js +311 -0
  242. package/es/plugins/miniScreen/index.css +179 -0
  243. package/es/plugins/miniScreen/index.d.ts +68 -0
  244. package/es/plugins/miniScreen/index.js +212 -0
  245. package/es/plugins/miniScreen/index.scss +198 -0
  246. package/es/plugins/miniScreen/miniScreenIcon.d.ts +11 -0
  247. package/es/plugins/miniScreen/miniScreenIcon.js +56 -0
  248. package/es/plugins/mobile/index.css +181 -0
  249. package/es/plugins/mobile/index.d.ts +125 -0
  250. package/es/plugins/mobile/index.js +631 -0
  251. package/es/plugins/mobile/index.scss +180 -0
  252. package/es/plugins/mobile/touch.d.ts +43 -0
  253. package/es/plugins/mobile/touch.js +214 -0
  254. package/es/plugins/netAdaption/index.d.ts +5 -0
  255. package/es/plugins/pc/index.css +3 -0
  256. package/es/plugins/pc/index.d.ts +14 -0
  257. package/es/plugins/pc/index.js +199 -0
  258. package/es/plugins/pc/index.scss +5 -0
  259. package/es/plugins/pip/index.css +12 -0
  260. package/es/plugins/pip/index.d.ts +37 -0
  261. package/es/plugins/pip/index.js +222 -0
  262. package/es/plugins/pip/index.scss +21 -0
  263. package/es/plugins/play/index.css +12 -0
  264. package/es/plugins/play/index.d.ts +23 -0
  265. package/es/plugins/play/index.js +127 -0
  266. package/es/plugins/play/index.scss +18 -0
  267. package/es/plugins/playNext/index.css +22 -0
  268. package/es/plugins/playNext/index.d.ts +19 -0
  269. package/es/plugins/playNext/index.js +104 -0
  270. package/es/plugins/playNext/index.scss +35 -0
  271. package/es/plugins/playbackRate/index.css +4 -0
  272. package/es/plugins/playbackRate/index.d.ts +31 -0
  273. package/es/plugins/playbackRate/index.js +140 -0
  274. package/es/plugins/playbackRate/index.scss +6 -0
  275. package/es/plugins/poster/index.css +39 -0
  276. package/es/plugins/poster/index.d.ts +27 -0
  277. package/es/plugins/poster/index.js +109 -0
  278. package/es/plugins/poster/index.scss +56 -0
  279. package/es/plugins/progress/index.css +234 -0
  280. package/es/plugins/progress/index.d.ts +178 -0
  281. package/es/plugins/progress/index.js +687 -0
  282. package/es/plugins/progress/index.scss +288 -0
  283. package/es/plugins/progress/innerList.d.ts +49 -0
  284. package/es/plugins/progress/innerList.js +285 -0
  285. package/es/plugins/progress/miniProgress.d.ts +9 -0
  286. package/es/plugins/progress/miniProgress.js +55 -0
  287. package/es/plugins/progressPreview/dotsApi.d.ts +1 -0
  288. package/es/plugins/progressPreview/dotsApi.js +269 -0
  289. package/es/plugins/progressPreview/index.css +190 -0
  290. package/es/plugins/progressPreview/index.d.ts +87 -0
  291. package/es/plugins/progressPreview/index.js +475 -0
  292. package/es/plugins/progressPreview/index.scss +235 -0
  293. package/es/plugins/prompt/index.css +47 -0
  294. package/es/plugins/prompt/index.d.ts +24 -0
  295. package/es/plugins/prompt/index.js +110 -0
  296. package/es/plugins/prompt/index.scss +53 -0
  297. package/es/plugins/replay/index.css +33 -0
  298. package/es/plugins/replay/index.d.ts +16 -0
  299. package/es/plugins/replay/index.js +109 -0
  300. package/es/plugins/replay/index.scss +41 -0
  301. package/es/plugins/rotate/index.css +0 -0
  302. package/es/plugins/rotate/index.d.ts +22 -0
  303. package/es/plugins/rotate/index.js +148 -0
  304. package/es/plugins/rotate/index.scss +0 -0
  305. package/es/plugins/rotate/index2.js +2 -0
  306. package/es/plugins/screenShot/index.css +3 -0
  307. package/es/plugins/screenShot/index.d.ts +30 -0
  308. package/es/plugins/screenShot/index.js +178 -0
  309. package/es/plugins/screenShot/index.scss +5 -0
  310. package/es/plugins/start/index.css +91 -0
  311. package/es/plugins/start/index.d.ts +41 -0
  312. package/es/plugins/start/index.js +267 -0
  313. package/es/plugins/start/index.scss +115 -0
  314. package/es/plugins/stats/index.d.ts +38 -0
  315. package/es/plugins/stats/index.js +194 -0
  316. package/es/plugins/testspeed/index.d.ts +26 -0
  317. package/es/plugins/testspeed/index.js +207 -0
  318. package/es/plugins/time/index.css +46 -0
  319. package/es/plugins/time/index.d.ts +28 -0
  320. package/es/plugins/time/index.js +225 -0
  321. package/es/plugins/time/index.scss +57 -0
  322. package/es/plugins/time/timesegments.d.ts +24 -0
  323. package/es/plugins/time/timesegments.js +216 -0
  324. package/es/plugins/track/index.css +91 -0
  325. package/es/plugins/track/index.d.ts +132 -0
  326. package/es/plugins/track/index.js +463 -0
  327. package/es/plugins/track/index.scss +111 -0
  328. package/es/plugins/track/nativeSubTitle.d.ts +22 -0
  329. package/es/plugins/track/nativeSubTitle.js +94 -0
  330. package/es/plugins/volume/index.css +95 -0
  331. package/es/plugins/volume/index.d.ts +88 -0
  332. package/es/plugins/volume/index.js +319 -0
  333. package/es/plugins/volume/index.scss +124 -0
  334. package/es/plugins/waitingTimeoutJump/index.d.ts +15 -0
  335. package/es/plugins/waitingTimeoutJump/index.js +88 -0
  336. package/es/presets/default-en.d.ts +33 -0
  337. package/es/presets/default-en.js +63 -0
  338. package/es/presets/default.d.ts +34 -0
  339. package/es/presets/default.js +70 -0
  340. package/es/presets/index.d.ts +4 -0
  341. package/es/presets/live.d.ts +94 -0
  342. package/es/presets/live.js +39 -0
  343. package/es/presets/mobile.d.ts +103 -0
  344. package/es/presets/mobile.js +34 -0
  345. package/es/simple_player.js +1 -1
  346. package/es/simple_player.js.map +1 -1
  347. package/es/state.d.ts +11 -0
  348. package/es/state.js +12 -0
  349. package/es/stateClassMap.d.ts +32 -0
  350. package/es/stateClassMap.js +32 -0
  351. package/es/style/common/animation.scss +16 -0
  352. package/es/style/common/svg-url.scss +70 -0
  353. package/es/style/common.scss +457 -0
  354. package/es/style/index.scss +4 -0
  355. package/es/style/variable.scss +76 -0
  356. package/es/utils/database.d.ts +31 -0
  357. package/es/utils/database.js +107 -0
  358. package/es/utils/debug.d.ts +10 -0
  359. package/es/utils/debug.js +43 -0
  360. package/es/utils/draggabilly.d.ts +54 -0
  361. package/es/utils/draggabilly.js +410 -0
  362. package/es/utils/sniffer.d.ts +28 -0
  363. package/es/utils/sniffer.js +150 -0
  364. package/es/utils/url.d.ts +1 -0
  365. package/es/utils/util.d.ts +304 -0
  366. package/es/utils/util.js +827 -0
  367. package/es/utils/xgplayerTimeRange.d.ts +7 -0
  368. package/es/utils/xgplayerTimeRange.js +25 -0
  369. package/es/version.d.ts +2 -0
  370. package/es/version.js +2 -0
  371. package/package.json +2 -3
@@ -0,0 +1,142 @@
1
+ import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, defineProperty as _defineProperty, assertThisInitialized as _assertThisInitialized, createClass as _createClass } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
+ import "../../utils/util.js";
3
+ import { WAITING, PLAY, SEEKING } from "../../events.js";
4
+ import "../../utils/debug.js";
5
+ import Plugin from "../../plugin/plugin.js";
6
+ var GapJump = /* @__PURE__ */ function(_BasePlugin) {
7
+ _inherits(GapJump2, _BasePlugin);
8
+ var _super = _createSuper(GapJump2);
9
+ function GapJump2() {
10
+ var _this;
11
+ _classCallCheck(this, GapJump2);
12
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
13
+ args[_key] = arguments[_key];
14
+ }
15
+ _this = _super.call.apply(_super, [this].concat(args));
16
+ _defineProperty(_assertThisInitialized(_this), "onGapJump", function() {
17
+ var _assertThisInitialize = _assertThisInitialized(_this), player = _assertThisInitialize.player, config = _assertThisInitialize.config;
18
+ if (player.media.readyState === HTMLMediaElement.HAVE_NOTHING) {
19
+ return;
20
+ }
21
+ if (player.media.seeking) {
22
+ if (!_this.seekingEventReceived) {
23
+ return;
24
+ }
25
+ } else {
26
+ _this.seekingEventReceived = false;
27
+ }
28
+ if (player.media.paused && player.media.currentTime !== 0 && _this.hasPlayed) {
29
+ return;
30
+ }
31
+ var buffered = player.media.buffered;
32
+ var smallGapLimit = config.smallGapLimit || 0.5;
33
+ var gapDetectionThreshold = config.gapDetectionThreshold || 0.3;
34
+ var currentTime = player.media.currentTime;
35
+ var idx = _this._getIndex(buffered, currentTime, gapDetectionThreshold);
36
+ if (idx === null || idx === 0) {
37
+ return;
38
+ }
39
+ console.log("GapJump bufferRange ", buffered.start(idx), buffered.end(idx));
40
+ var jumpTo = buffered.start(idx) + 0.1;
41
+ var seekEnd = player.media.duration;
42
+ if (jumpTo > seekEnd) {
43
+ return;
44
+ }
45
+ var jumpSize = jumpTo - currentTime;
46
+ var isGapSmall = jumpSize <= smallGapLimit;
47
+ if (jumpSize < GapJump2.BROWSER_GAP_TOLERANCE) {
48
+ return;
49
+ }
50
+ if (isGapSmall) {
51
+ if (config.useGapJump !== false) {
52
+ player.media.currentTime = _this.isSafari ? jumpTo + 0.1 : jumpTo;
53
+ }
54
+ _this.player && _this.player.emit("detectGap");
55
+ console.log("gapJump gapIndex", idx, " isGapSamll:", isGapSmall, " currentTime:", player.media.currentTime, " jumpSize:", currentTime - player.media.currentTime);
56
+ if (jumpTo !== 0.08) {
57
+ player && player.emit("log", {
58
+ type: "oneevent",
59
+ end_type: "gap",
60
+ vid: player.config.vid,
61
+ ext: {
62
+ video_postion: Math.floor(jumpTo * 1e3)
63
+ }
64
+ });
65
+ }
66
+ }
67
+ });
68
+ return _this;
69
+ }
70
+ _createClass(GapJump2, [{
71
+ key: "afterCreate",
72
+ value: function afterCreate() {
73
+ var _this2 = this;
74
+ var useGapJump = this.config.useGapJump;
75
+ if (useGapJump === false) {
76
+ return;
77
+ }
78
+ this.hasPlayed = false;
79
+ this.seekingEventReceived = false;
80
+ this.isSafari = /(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent) && !/BlackBerry/.test(navigator.platform);
81
+ this.on(WAITING, this.onGapJump);
82
+ this.on(PLAY, function() {
83
+ _this2.hasPlayed = true;
84
+ });
85
+ this.on(SEEKING, function() {
86
+ _this2.seekingEventReceived = true;
87
+ });
88
+ }
89
+ }, {
90
+ key: "_getIndex",
91
+ value: function _getIndex(buffered, time, threshold) {
92
+ if (!buffered || !buffered.length) {
93
+ return null;
94
+ }
95
+ if (buffered.length === 1 && buffered.end(0) - buffered.start(0) < 1e-6) {
96
+ return null;
97
+ }
98
+ var bufferedInfo = this._getBuffered(buffered);
99
+ var idx = null;
100
+ for (var i = 0; i < bufferedInfo.length; i++) {
101
+ var item = bufferedInfo[i];
102
+ if (item.start > time && (i === 0 || bufferedInfo[i - 1].end - time <= threshold)) {
103
+ idx = i;
104
+ break;
105
+ }
106
+ }
107
+ return idx;
108
+ }
109
+ }, {
110
+ key: "_getBuffered",
111
+ value: function _getBuffered(b) {
112
+ if (!b) {
113
+ return [];
114
+ }
115
+ var ret = [];
116
+ for (var i = 0; i < b.length; i++) {
117
+ ret.push({
118
+ start: b.start(i),
119
+ end: b.end(i)
120
+ });
121
+ }
122
+ return ret;
123
+ }
124
+ }], [{
125
+ key: "pluginName",
126
+ get: function get() {
127
+ return "gapJump";
128
+ }
129
+ }, {
130
+ key: "defaultConfig",
131
+ get: function get() {
132
+ return {
133
+ useGapJump: false,
134
+ smallGapLimit: 0.5,
135
+ gapDetectionThreshold: 0.3
136
+ };
137
+ }
138
+ }]);
139
+ return GapJump2;
140
+ }(Plugin);
141
+ GapJump.BROWSER_GAP_TOLERANCE = 1e-3;
142
+ export { GapJump as default };
@@ -0,0 +1,89 @@
1
+ export default Keyboard;
2
+ export type IKeyboardConfig = {
3
+ [propName: string]: any;
4
+ seekStep?: number;
5
+ checkVisible?: boolean;
6
+ disableBodyTrigger?: boolean;
7
+ keyCodeMap?: {
8
+ [propName: string]: any;
9
+ };
10
+ disable: boolean;
11
+ playbackRate: number;
12
+ isIgnoreUserActive: boolean;
13
+ };
14
+ declare class Keyboard extends BasePlugin {
15
+ /**
16
+ * @type IKeyboardConfig
17
+ */
18
+ static get defaultConfig(): IKeyboardConfig;
19
+ mergekeyCodeMap(): void;
20
+ seekStep: number;
21
+ keyCodeMap: {
22
+ space: {
23
+ keyCode: number;
24
+ action: string;
25
+ disable: boolean;
26
+ disablePress: boolean;
27
+ noBodyTarget: boolean;
28
+ };
29
+ up: {
30
+ keyCode: number;
31
+ action: string;
32
+ disable: boolean;
33
+ disablePress: boolean;
34
+ noBodyTarget: boolean;
35
+ };
36
+ down: {
37
+ keyCode: number;
38
+ action: string;
39
+ disable: boolean;
40
+ disablePress: boolean;
41
+ noBodyTarget: boolean;
42
+ };
43
+ left: {
44
+ keyCode: number;
45
+ action: string;
46
+ disablePress: boolean;
47
+ disable: boolean;
48
+ };
49
+ right: {
50
+ keyCode: number;
51
+ action: string;
52
+ pressAction: string;
53
+ disablePress: boolean;
54
+ disable: boolean;
55
+ };
56
+ esc: {
57
+ keyCode: number;
58
+ action: string;
59
+ disablePress: boolean;
60
+ disable: boolean;
61
+ };
62
+ };
63
+ _keyState: {
64
+ isKeyDown: boolean;
65
+ isBodyKeyDown: boolean;
66
+ isPress: boolean;
67
+ tt: number;
68
+ playbackRate: number;
69
+ };
70
+ checkIsVisible(): boolean;
71
+ checkCode(code: any, isBodyTarget: any): boolean;
72
+ downVolume(event: any): void;
73
+ upVolume(event: any): void;
74
+ seek(event: any): void;
75
+ seekBack(event: any): void;
76
+ changePlaybackRate(event: any): void;
77
+ playPause(event: any): void;
78
+ exitFullscreen(event: any): void;
79
+ onBodyKeyDown: (event: any) => void;
80
+ onBodyKeyUp: (event: any) => void;
81
+ onKeydown: (event: any) => void;
82
+ onKeyup: (event: any) => void;
83
+ handleKeyDown(e: any): void;
84
+ handleKeyUp(e: any): void;
85
+ handleKeyCode(curKeyCode: any, event: any, isPress: any): void;
86
+ disable(): void;
87
+ enable(): void;
88
+ }
89
+ import { BasePlugin } from "../../plugin";
@@ -0,0 +1,421 @@
1
+ import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, defineProperty as _defineProperty, assertThisInitialized as _assertThisInitialized, createClass as _createClass, objectSpread2 as _objectSpread2 } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
+ import util from "../../utils/util.js";
3
+ import { SHORTCUT } from "../../events.js";
4
+ import BasePlugin from "../../plugin/basePlugin.js";
5
+ import "delegate";
6
+ function preventDefault(e) {
7
+ e.preventDefault();
8
+ e.returnValue = false;
9
+ }
10
+ function isDisableTag(el) {
11
+ var tagName = el.tagName;
12
+ if (tagName === "INPUT" || tagName === "TEXTAREA" || el.isContentEditable) {
13
+ return true;
14
+ }
15
+ return false;
16
+ }
17
+ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
18
+ _inherits(Keyboard2, _BasePlugin);
19
+ var _super = _createSuper(Keyboard2);
20
+ function Keyboard2() {
21
+ var _this;
22
+ _classCallCheck(this, Keyboard2);
23
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
24
+ args[_key] = arguments[_key];
25
+ }
26
+ _this = _super.call.apply(_super, [this].concat(args));
27
+ _defineProperty(_assertThisInitialized(_this), "onBodyKeyDown", function(event) {
28
+ if (!_this.player) {
29
+ return;
30
+ }
31
+ var e = event || window.event;
32
+ var keyCode = e.keyCode;
33
+ var _assertThisInitialize = _assertThisInitialized(_this), _keyState = _assertThisInitialize._keyState, player = _assertThisInitialize.player;
34
+ var _this$config = _this.config, disable = _this$config.disable, disableBodyTrigger = _this$config.disableBodyTrigger, isIgnoreUserActive = _this$config.isIgnoreUserActive;
35
+ if (disable || disableBodyTrigger || !player.isUserActive && !isIgnoreUserActive || isDisableTag(e.target) || !_this.checkIsVisible() || e.metaKey || e.altKey || e.ctrlKey) {
36
+ _keyState.isBodyKeyDown = false;
37
+ return;
38
+ }
39
+ if (!event.repeat && !_keyState.isKeyDown) {
40
+ if ((e.target === document.body || _this.config.isGlobalTrigger && !isDisableTag(e.target)) && _this.checkCode(keyCode, true)) {
41
+ _keyState.isBodyKeyDown = true;
42
+ }
43
+ document.addEventListener("keyup", _this.onBodyKeyUp);
44
+ }
45
+ _keyState.isBodyKeyDown && _this.handleKeyDown(e);
46
+ });
47
+ _defineProperty(_assertThisInitialized(_this), "onBodyKeyUp", function(event) {
48
+ if (!_this.player) {
49
+ return;
50
+ }
51
+ document.removeEventListener("keyup", _this.onBodyKeyUp);
52
+ _this.handleKeyUp(event);
53
+ });
54
+ _defineProperty(_assertThisInitialized(_this), "onKeydown", function(event) {
55
+ if (!_this.player) {
56
+ return;
57
+ }
58
+ var e = event || window.event;
59
+ var _assertThisInitialize2 = _assertThisInitialized(_this), _keyState = _assertThisInitialize2._keyState;
60
+ if (!e.repeat) {
61
+ if (_this.config.disable || _this.config.disableRootTrigger || e.metaKey || e.altKey || e.ctrlKey) {
62
+ return;
63
+ }
64
+ if (!_this.player.isUserActive && !_this.config.isIgnoreUserActive) {
65
+ return;
66
+ }
67
+ if (e && (e.keyCode === 37 || _this.checkCode(e.keyCode)) && (e.target === _this.player.root || e.target === _this.player.video || e.target === _this.player.controls.el)) {
68
+ _keyState.isKeyDown = true;
69
+ }
70
+ _this.player.root.addEventListener("keyup", _this.onKeyup);
71
+ }
72
+ if (!_keyState.isKeyDown) {
73
+ return;
74
+ }
75
+ _this.handleKeyDown(e);
76
+ });
77
+ _defineProperty(_assertThisInitialized(_this), "onKeyup", function(event) {
78
+ if (!_this.player) {
79
+ return;
80
+ }
81
+ _this.player.root.removeEventListener("keyup", _this.onKeyup);
82
+ _this.handleKeyUp(event);
83
+ });
84
+ return _this;
85
+ }
86
+ _createClass(Keyboard2, [{
87
+ key: "mergekeyCodeMap",
88
+ value: function mergekeyCodeMap() {
89
+ var _this2 = this;
90
+ var extendkeyCodeMap = this.config.keyCodeMap;
91
+ if (extendkeyCodeMap) {
92
+ Object.keys(extendkeyCodeMap).map(function(key) {
93
+ if (!_this2.keyCodeMap[key]) {
94
+ _this2.keyCodeMap[key] = extendkeyCodeMap[key];
95
+ } else {
96
+ ["keyCode", "action", "disable", "pressAction", "disablePress", "isBodyTarget"].map(function(key1) {
97
+ extendkeyCodeMap[key][key1] && (_this2.keyCodeMap[key][key1] = extendkeyCodeMap[key][key1]);
98
+ });
99
+ }
100
+ });
101
+ }
102
+ }
103
+ }, {
104
+ key: "afterCreate",
105
+ value: function afterCreate() {
106
+ this.config.disable = !this.playerConfig.keyShortcut;
107
+ var seekStep = typeof this.config.seekStep === "function" ? this.config.seekStep(this.player) : this.config.seekStep;
108
+ if (!(!seekStep || typeof seekStep !== "number")) {
109
+ this.seekStep = seekStep;
110
+ }
111
+ this.keyCodeMap = {
112
+ space: {
113
+ keyCode: 32,
114
+ action: "playPause",
115
+ disable: false,
116
+ disablePress: false,
117
+ noBodyTarget: false
118
+ },
119
+ up: {
120
+ keyCode: 38,
121
+ action: "upVolume",
122
+ disable: false,
123
+ disablePress: false,
124
+ noBodyTarget: true
125
+ },
126
+ down: {
127
+ keyCode: 40,
128
+ action: "downVolume",
129
+ disable: false,
130
+ disablePress: false,
131
+ noBodyTarget: true
132
+ },
133
+ left: {
134
+ keyCode: 37,
135
+ action: "seekBack",
136
+ disablePress: false,
137
+ disable: false
138
+ },
139
+ right: {
140
+ keyCode: 39,
141
+ action: "seek",
142
+ pressAction: "changePlaybackRate",
143
+ disablePress: false,
144
+ disable: false
145
+ },
146
+ esc: {
147
+ keyCode: 27,
148
+ action: "exitFullscreen",
149
+ disablePress: true,
150
+ disable: false
151
+ }
152
+ };
153
+ this.mergekeyCodeMap();
154
+ this._keyState = {
155
+ isKeyDown: false,
156
+ isBodyKeyDown: false,
157
+ isPress: false,
158
+ tt: 0,
159
+ playbackRate: 0
160
+ };
161
+ this.player.root.addEventListener("keydown", this.onKeydown);
162
+ document.addEventListener("keydown", this.onBodyKeyDown);
163
+ }
164
+ }, {
165
+ key: "checkIsVisible",
166
+ value: function checkIsVisible() {
167
+ if (!this.config.checkVisible) {
168
+ return true;
169
+ }
170
+ var rec = this.player.root.getBoundingClientRect();
171
+ var height = rec.height, top = rec.top, bottom = rec.bottom;
172
+ var h = window.innerHeight;
173
+ if (top < 0 && top < 0 - height * 0.9 || bottom > 0 && bottom - h > height * 0.9) {
174
+ return false;
175
+ }
176
+ return true;
177
+ }
178
+ }, {
179
+ key: "checkCode",
180
+ value: function checkCode(code, isBodyTarget) {
181
+ var _this3 = this;
182
+ var flag = false;
183
+ Object.keys(this.keyCodeMap).map(function(key) {
184
+ if (_this3.keyCodeMap[key] && code === _this3.keyCodeMap[key].keyCode && !_this3.keyCodeMap[key].disable) {
185
+ flag = !isBodyTarget || isBodyTarget && !_this3.keyCodeMap[key].noBodyTarget;
186
+ }
187
+ });
188
+ return flag;
189
+ }
190
+ }, {
191
+ key: "downVolume",
192
+ value: function downVolume(event) {
193
+ var player = this.player;
194
+ if (player.volume <= 0) {
195
+ return;
196
+ }
197
+ var val = parseFloat((player.volume - 0.1).toFixed(1));
198
+ var props = {
199
+ volume: {
200
+ from: player.volume,
201
+ to: val
202
+ }
203
+ };
204
+ this.emitUserAction(event, "change_volume", {
205
+ props
206
+ });
207
+ if (val >= 0) {
208
+ player.volume = val;
209
+ } else {
210
+ player.volume = 0;
211
+ }
212
+ }
213
+ }, {
214
+ key: "upVolume",
215
+ value: function upVolume(event) {
216
+ var player = this.player;
217
+ if (player.volume >= 1) {
218
+ return;
219
+ }
220
+ var val = parseFloat((player.volume + 0.1).toFixed(1));
221
+ var props = {
222
+ volume: {
223
+ from: player.volume,
224
+ to: val
225
+ }
226
+ };
227
+ this.emitUserAction(event, "change_volume", {
228
+ props
229
+ });
230
+ if (val <= 1) {
231
+ player.volume = val;
232
+ } else {
233
+ player.volume = 1;
234
+ }
235
+ }
236
+ }, {
237
+ key: "seek",
238
+ value: function seek(event) {
239
+ var _this$player = this.player, currentTime = _this$player.currentTime, offsetCurrentTime = _this$player.offsetCurrentTime, duration = _this$player.duration, offsetDuration = _this$player.offsetDuration, timeSegments = _this$player.timeSegments;
240
+ var _time = offsetCurrentTime > -1 ? offsetCurrentTime : currentTime;
241
+ var _duration = offsetDuration || duration;
242
+ var _step = event.repeat && this.seekStep >= 4 ? parseInt(this.seekStep / 2, 10) : this.seekStep;
243
+ if (_time + _step <= _duration) {
244
+ _time = _time + _step;
245
+ } else {
246
+ _time = _duration;
247
+ }
248
+ var _seekTime = util.getCurrentTimeByOffset(_time, timeSegments);
249
+ var props = {
250
+ currentTime: {
251
+ from: currentTime,
252
+ to: _seekTime
253
+ }
254
+ };
255
+ this.emitUserAction(event, "seek", {
256
+ props
257
+ });
258
+ this.player.currentTime = _seekTime;
259
+ }
260
+ }, {
261
+ key: "seekBack",
262
+ value: function seekBack(event) {
263
+ var _this$player2 = this.player, currentTime = _this$player2.currentTime, offsetCurrentTime = _this$player2.offsetCurrentTime, timeSegments = _this$player2.timeSegments;
264
+ var _step = event.repeat ? parseInt(this.seekStep / 2, 10) : this.seekStep;
265
+ var _time = offsetCurrentTime > -1 ? offsetCurrentTime : currentTime;
266
+ var _seekTime = _time - _step;
267
+ if (_seekTime < 0) {
268
+ _seekTime = 0;
269
+ }
270
+ _seekTime = util.getCurrentTimeByOffset(_seekTime, timeSegments);
271
+ var props = {
272
+ currentTime: {
273
+ from: currentTime,
274
+ to: _seekTime
275
+ }
276
+ };
277
+ this.emitUserAction(event, "seek", {
278
+ props
279
+ });
280
+ this.player.currentTime = _seekTime;
281
+ }
282
+ }, {
283
+ key: "changePlaybackRate",
284
+ value: function changePlaybackRate(event) {
285
+ var _keyState = this._keyState, config = this.config, player = this.player;
286
+ if (_keyState.playbackRate === 0) {
287
+ _keyState.playbackRate = player.playbackRate;
288
+ player.playbackRate = config.playbackRate;
289
+ }
290
+ }
291
+ }, {
292
+ key: "playPause",
293
+ value: function playPause(event) {
294
+ var player = this.player;
295
+ if (!player) {
296
+ return;
297
+ }
298
+ this.emitUserAction(event, "switch_play_pause");
299
+ if (player.paused) {
300
+ player.play();
301
+ } else {
302
+ player.pause();
303
+ }
304
+ }
305
+ }, {
306
+ key: "exitFullscreen",
307
+ value: function exitFullscreen(event) {
308
+ var player = this.player;
309
+ var fullscreen = player.fullscreen, cssfullscreen = player.cssfullscreen;
310
+ if (fullscreen) {
311
+ this.emitUserAction("keyup", "switch_fullscreen", {
312
+ prop: "fullscreen",
313
+ from: fullscreen,
314
+ to: !fullscreen
315
+ });
316
+ player.exitFullscreen();
317
+ }
318
+ if (cssfullscreen) {
319
+ this.emitUserAction("keyup", "switch_css_fullscreen", {
320
+ prop: "cssfullscreen",
321
+ from: cssfullscreen,
322
+ to: !cssfullscreen
323
+ });
324
+ player.exitCssFullscreen();
325
+ }
326
+ }
327
+ }, {
328
+ key: "handleKeyDown",
329
+ value: function handleKeyDown(e) {
330
+ var _keyState = this._keyState;
331
+ if (e.repeat) {
332
+ _keyState.isPress = true;
333
+ var _t = Date.now();
334
+ if (_t - _keyState.tt < 200) {
335
+ return;
336
+ }
337
+ _keyState.tt = _t;
338
+ }
339
+ preventDefault(e);
340
+ this.handleKeyCode(e.keyCode, e, _keyState.isPress);
341
+ }
342
+ }, {
343
+ key: "handleKeyUp",
344
+ value: function handleKeyUp(e) {
345
+ var _keyState = this._keyState;
346
+ if (_keyState.playbackRate > 0) {
347
+ this.player.playbackRate = _keyState.playbackRate;
348
+ _keyState.playbackRate = 0;
349
+ }
350
+ _keyState.isKeyDown = false;
351
+ _keyState.isPress = false;
352
+ _keyState.tt = 0;
353
+ }
354
+ }, {
355
+ key: "handleKeyCode",
356
+ value: function handleKeyCode(curKeyCode, event, isPress) {
357
+ var arr = Object.keys(this.keyCodeMap);
358
+ for (var i = 0; i < arr.length; i++) {
359
+ var _this$keyCodeMap$arr$ = this.keyCodeMap[arr[i]], action = _this$keyCodeMap$arr$.action, keyCode = _this$keyCodeMap$arr$.keyCode, disable = _this$keyCodeMap$arr$.disable, pressAction = _this$keyCodeMap$arr$.pressAction, disablePress = _this$keyCodeMap$arr$.disablePress;
360
+ if (keyCode === curKeyCode) {
361
+ if (!disable && !(isPress && disablePress)) {
362
+ var _action = !isPress ? action : pressAction || action;
363
+ if (typeof _action === "function") {
364
+ action(event, this.player, isPress);
365
+ } else if (typeof _action === "string") {
366
+ if (typeof this[_action] === "function") {
367
+ this[_action](event, this.player, isPress);
368
+ }
369
+ }
370
+ this.emit(SHORTCUT, _objectSpread2({
371
+ key: arr[i],
372
+ target: event.target,
373
+ isPress
374
+ }, this.keyCodeMap[arr[i]]));
375
+ }
376
+ break;
377
+ }
378
+ }
379
+ }
380
+ }, {
381
+ key: "destroy",
382
+ value: function destroy() {
383
+ this.player.root.removeEventListener("keydown", this.onKeydown);
384
+ document.removeEventListener("keydown", this.onBodyKeyDown);
385
+ this.player.root.removeEventListener("keyup", this.onKeyup);
386
+ document.removeEventListener("keyup", this.onBodyKeyUp);
387
+ }
388
+ }, {
389
+ key: "disable",
390
+ value: function disable() {
391
+ this.config.disable = true;
392
+ }
393
+ }, {
394
+ key: "enable",
395
+ value: function enable() {
396
+ this.config.disable = false;
397
+ }
398
+ }], [{
399
+ key: "pluginName",
400
+ get: function get() {
401
+ return "keyboard";
402
+ }
403
+ }, {
404
+ key: "defaultConfig",
405
+ get: function get() {
406
+ return {
407
+ seekStep: 10,
408
+ checkVisible: false,
409
+ disableBodyTrigger: false,
410
+ disableRootTrigger: false,
411
+ isGlobalTrigger: false,
412
+ keyCodeMap: {},
413
+ disable: false,
414
+ playbackRate: 2,
415
+ isIgnoreUserActive: false
416
+ };
417
+ }
418
+ }]);
419
+ return Keyboard2;
420
+ }(BasePlugin);
421
+ export { Keyboard as default };
@@ -0,0 +1,58 @@
1
+ @keyframes loadingRotate {
2
+ 0% {
3
+ transform: rotate(0);
4
+ }
5
+ 25% {
6
+ transform: rotate(90deg);
7
+ }
8
+ 50% {
9
+ transform: rotate(180deg);
10
+ }
11
+ 75% {
12
+ transform: rotate(270deg);
13
+ }
14
+ 100% {
15
+ transform: rotate(360deg);
16
+ }
17
+ }
18
+ @keyframes loadingDashOffset {
19
+ 0% {
20
+ stroke-dashoffset: 236;
21
+ }
22
+ 100% {
23
+ stroke-dashoffset: 0;
24
+ }
25
+ }
26
+ xg-loading-inner {
27
+ display: block;
28
+ height: 100%;
29
+ width: 100%;
30
+ transform-origin: center;
31
+ animation: loadingRotate 1s 0.1s linear infinite;
32
+ }
33
+ .xgplayer-loading {
34
+ display: none;
35
+ width: 70px;
36
+ height: 70px;
37
+ overflow: hidden;
38
+ position: absolute;
39
+ z-index: 10;
40
+ left: 50%;
41
+ top: 50%;
42
+ transform: translate(-50%, -50%);
43
+ pointer-events: none;
44
+ }
45
+ .xgplayer-loading svg, .xgplayer-loading img {
46
+ width: 100%;
47
+ height: 100%;
48
+ }
49
+ .xgplayer-mobile .xgplayer-loading {
50
+ width: 50px;
51
+ height: 50px;
52
+ }
53
+ .xgplayer-isloading .xgplayer-loading {
54
+ display: block;
55
+ }
56
+ .xgplayer-nostart .xgplayer-loading, .xgplayer-pause .xgplayer-loading, .xgplayer-is-enter .xgplayer-loading, .xgplayer-is-ended .xgplayer-loading, .xgplayer-is-error .xgplayer-loading {
57
+ display: none;
58
+ }