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,316 @@
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 util from "../../utils/util.js";
3
+ import sniffer from "../../utils/sniffer.js";
4
+ import { TIME_UPDATE, COMPLETE, EMPTIED, PLAY, PAUSE, LOADED_DATA, LOAD_START } from "../../events.js";
5
+ import XG_DEBUG from "../../utils/debug.js";
6
+ import Plugin from "../../plugin/plugin.js";
7
+ var MODES = {
8
+ REAL_TIME: "realtime",
9
+ FIRST_FRAME: "firstframe",
10
+ FRAME_RATE: "framerate",
11
+ POSTER: "poster"
12
+ };
13
+ function nowTime() {
14
+ try {
15
+ return parseInt(window.performance.now(), 10);
16
+ } catch (e) {
17
+ return new Date().getTime();
18
+ }
19
+ }
20
+ function checkIsSupportCanvas() {
21
+ try {
22
+ var ctx = document.createElement("canvas").getContext;
23
+ if (ctx) {
24
+ return true;
25
+ }
26
+ return false;
27
+ } catch (e) {
28
+ return false;
29
+ }
30
+ }
31
+ var isSupportCanvas = null;
32
+ var DynamicBg = /* @__PURE__ */ function(_Plugin) {
33
+ _inherits(DynamicBg2, _Plugin);
34
+ var _super = _createSuper(DynamicBg2);
35
+ function DynamicBg2() {
36
+ var _this;
37
+ _classCallCheck(this, DynamicBg2);
38
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
39
+ args[_key] = arguments[_key];
40
+ }
41
+ _this = _super.call.apply(_super, [this].concat(args));
42
+ _defineProperty(_assertThisInitialized(_this), "onLoadedData", function(e) {
43
+ if (!_this.player) {
44
+ return;
45
+ }
46
+ _this._frameCount = _this.config.startFrameCount;
47
+ _this.renderOnTimeupdate(e);
48
+ _this.off(TIME_UPDATE, _this.renderOnTimeupdate);
49
+ _this.on(TIME_UPDATE, _this.renderOnTimeupdate);
50
+ });
51
+ _defineProperty(_assertThisInitialized(_this), "renderOnTimeupdate", function(e) {
52
+ if (_this._frameCount > 0) {
53
+ _this.renderOnce();
54
+ _this._frameCount--;
55
+ } else {
56
+ _this._isLoaded = true;
57
+ _this.off(TIME_UPDATE, _this.renderOnTimeupdate);
58
+ !_this.player.paused && _this._checkIfCanStart() && _this.start();
59
+ }
60
+ });
61
+ _defineProperty(_assertThisInitialized(_this), "start", function() {
62
+ var video = _this.player.media;
63
+ var _now = nowTime();
64
+ var _sVideo = _this.checkVideoIsSupport(video);
65
+ if (!_sVideo || !_this.canvasCtx) {
66
+ return;
67
+ }
68
+ _this.stop();
69
+ if (video.videoWidth && video.videoHeight) {
70
+ _this.videoPI = video.videoHeight > 0 ? parseInt(video.videoWidth / video.videoHeight * 100, 10) : 0;
71
+ if (_this.config.mode === MODES.REAL_TIME) {
72
+ video && video.videoWidth && _this.update(_sVideo, _this.videoPI);
73
+ _this.preTime = _now;
74
+ } else if (_now - _this.preTime >= _this.interval) {
75
+ video && video.videoWidth && _this.update(_sVideo, _this.videoPI);
76
+ _this.preTime = _now;
77
+ }
78
+ }
79
+ _this.frameId = util.requestAnimationFrame(_this.start);
80
+ });
81
+ _defineProperty(_assertThisInitialized(_this), "stop", function() {
82
+ if (_this.frameId) {
83
+ util.cancelAnimationFrame(_this.frameId);
84
+ _this.frameId = null;
85
+ }
86
+ });
87
+ return _this;
88
+ }
89
+ _createClass(DynamicBg2, [{
90
+ key: "afterCreate",
91
+ value: function afterCreate() {
92
+ var _this2 = this;
93
+ if (this.playerConfig.dynamicBg === true) {
94
+ this.config.disable = false;
95
+ }
96
+ if (!DynamicBg2.isSupport) {
97
+ this.config.disable = true;
98
+ }
99
+ var _this$config = this.config, disable = _this$config.disable, mode = _this$config.mode, frameRate = _this$config.frameRate;
100
+ if (disable) {
101
+ return;
102
+ }
103
+ this._pos = {
104
+ width: 0,
105
+ height: 0,
106
+ rwidth: 0,
107
+ rheight: 0,
108
+ x: 0,
109
+ y: 0,
110
+ pi: 0
111
+ };
112
+ this.isStart = false;
113
+ this._isLoaded = false;
114
+ this.videoPI = 0;
115
+ this.preTime = 0;
116
+ this.interval = parseInt(1e3 / frameRate, 10);
117
+ this.canvas = null;
118
+ this.canvasCtx = null;
119
+ this._frameCount = 0;
120
+ this.once(COMPLETE, function() {
121
+ if (!_this2.player) {
122
+ return;
123
+ }
124
+ _this2.init();
125
+ if (!_this2.player.paused) {
126
+ _this2.start();
127
+ }
128
+ });
129
+ if (mode === MODES.POSTER) {
130
+ return;
131
+ }
132
+ if (mode !== MODES.FIRST_FRAME) {
133
+ this.on(EMPTIED, function() {
134
+ _this2.stop();
135
+ });
136
+ this.on(PLAY, function() {
137
+ _this2._checkIfCanStart() && _this2.start();
138
+ });
139
+ this.on(PAUSE, function() {
140
+ _this2.stop();
141
+ });
142
+ }
143
+ this.on(LOADED_DATA, this.onLoadedData);
144
+ this.on(LOAD_START, function() {
145
+ _this2._isLoaded = false;
146
+ _this2.stop();
147
+ });
148
+ }
149
+ }, {
150
+ key: "init",
151
+ value: function init() {
152
+ var player = this.player, config = this.config;
153
+ this.canvasFilter = DynamicBg2.supportCanvasFilter();
154
+ try {
155
+ var parent = !this.config.isInnerRender ? player.root : player.innerContainer || player.root;
156
+ parent.insertAdjacentHTML("afterbegin", '<div class="xgplayer-dynamic-bg" data-index="'.concat(config.index, '"><canvas>\n </canvas><xgmask></xgmask></div>'));
157
+ this.root = parent.children[0];
158
+ this.canvas = this.find("canvas");
159
+ if (!this.canvasFilter) {
160
+ this.canvas.style.filter = config.filter;
161
+ this.canvas.style.webkitFilter = config.filter;
162
+ }
163
+ this.mask = this.find("xgmask");
164
+ config.addMask && (this.mask.style.background = config.maskBg);
165
+ this.canvasCtx = this.canvas.getContext("2d");
166
+ this.renderByPoster();
167
+ } catch (e) {
168
+ XG_DEBUG.logError("plugin:DynamicBg", e);
169
+ }
170
+ }
171
+ }, {
172
+ key: "checkVideoIsSupport",
173
+ value: function checkVideoIsSupport(video) {
174
+ if (!video) {
175
+ return null;
176
+ }
177
+ var _tVideo = video && video instanceof window.HTMLVideoElement ? video : video.canvas ? video.canvas : video.flyVideo ? video.flyVideo : null;
178
+ if (_tVideo && !(sniffer.browser === "safari" && util.isMSE(_tVideo))) {
179
+ return _tVideo;
180
+ }
181
+ var _tagName = _tVideo ? _tVideo.tagName.toLowerCase() : "";
182
+ if (_tagName === "canvas" || _tagName === "img") {
183
+ return _tVideo;
184
+ }
185
+ return null;
186
+ }
187
+ }, {
188
+ key: "renderByPoster",
189
+ value: function renderByPoster() {
190
+ var poster = this.playerConfig.poster;
191
+ if (poster) {
192
+ var url = util.typeOf(poster) === "String" ? poster : util.typeOf(poster.poster) === "String" ? poster.poster : null;
193
+ this.updateImg(url);
194
+ }
195
+ }
196
+ }, {
197
+ key: "_checkIfCanStart",
198
+ value: function _checkIfCanStart() {
199
+ var mode = this.config.mode;
200
+ return this._isLoaded && mode !== MODES.FIRST_FRAME && mode !== MODES.POSTER;
201
+ }
202
+ }, {
203
+ key: "renderOnce",
204
+ value: function renderOnce() {
205
+ var video = this.player.media;
206
+ if (!video.videoWidth || !video.videoHeight) {
207
+ return;
208
+ }
209
+ this.videoPI = parseInt(video.videoWidth / video.videoHeight * 100, 10);
210
+ var _sVideo = this.checkVideoIsSupport(video);
211
+ _sVideo && video.videoWidth && this.update(_sVideo, this.videoPI);
212
+ }
213
+ }, {
214
+ key: "updateImg",
215
+ value: function updateImg(url) {
216
+ var _this3 = this;
217
+ if (!url) {
218
+ return;
219
+ }
220
+ var _this$canvas$getBound = this.canvas.getBoundingClientRect(), width = _this$canvas$getBound.width, height = _this$canvas$getBound.height;
221
+ var image = new window.Image();
222
+ image.onload = function() {
223
+ if (!_this3.canvas || _this3.frameId || _this3.isStart) {
224
+ return;
225
+ }
226
+ _this3.canvas.height = height;
227
+ _this3.canvas.width = width;
228
+ var pi = parseInt(width / height * 100, 10);
229
+ _this3.update(image, pi);
230
+ image = null;
231
+ };
232
+ image.src = url;
233
+ }
234
+ }, {
235
+ key: "update",
236
+ value: function update(video, sourcePI) {
237
+ if (!this.canvas || !this.canvasCtx || !sourcePI) {
238
+ return;
239
+ }
240
+ try {
241
+ var _pos = this._pos, config = this.config;
242
+ var _this$canvas$getBound2 = this.canvas.getBoundingClientRect(), width = _this$canvas$getBound2.width, height = _this$canvas$getBound2.height;
243
+ if (width !== _pos.width || height !== _pos.height || _pos.pi !== sourcePI) {
244
+ var pi = parseInt(width / height * 100, 10);
245
+ _pos.pi = sourcePI;
246
+ _pos.width = this.canvas.width = width;
247
+ _pos.height = this.canvas.height = height;
248
+ var rheight = height;
249
+ var rwidth = width;
250
+ if (pi < sourcePI) {
251
+ rwidth = parseInt(height * sourcePI / 100, 10);
252
+ } else if (pi > sourcePI) {
253
+ rheight = parseInt(width * 100 / sourcePI, 10);
254
+ }
255
+ _pos.rwidth = rwidth * config.multiple;
256
+ _pos.rheight = rheight * config.multiple;
257
+ _pos.x = (width - _pos.rwidth) / 2;
258
+ _pos.y = (height - _pos.rheight) / 2;
259
+ }
260
+ this.canvasFilter && (this.canvasCtx.filter = config.filter);
261
+ this.canvasCtx.drawImage(video, _pos.x, _pos.y, _pos.rwidth, _pos.rheight);
262
+ } catch (e) {
263
+ XG_DEBUG.logError("plugin:DynamicBg", e);
264
+ }
265
+ }
266
+ }, {
267
+ key: "destroy",
268
+ value: function destroy() {
269
+ this.stop();
270
+ this.canvasCtx = null;
271
+ this.canvas = null;
272
+ }
273
+ }, {
274
+ key: "render",
275
+ value: function render() {
276
+ return "";
277
+ }
278
+ }], [{
279
+ key: "pluginName",
280
+ get: function get() {
281
+ return "dynamicBg";
282
+ }
283
+ }, {
284
+ key: "defaultConfig",
285
+ get: function get() {
286
+ return {
287
+ isInnerRender: false,
288
+ disable: true,
289
+ index: -1,
290
+ mode: "framerate",
291
+ frameRate: 10,
292
+ filter: "blur(50px)",
293
+ startFrameCount: 2,
294
+ addMask: true,
295
+ multiple: 1.2,
296
+ maskBg: "rgba(0,0,0,0.7)"
297
+ };
298
+ }
299
+ }, {
300
+ key: "isSupport",
301
+ get: function get() {
302
+ if (typeof isSupportCanvas === "boolean") {
303
+ return isSupportCanvas;
304
+ }
305
+ isSupportCanvas = checkIsSupportCanvas();
306
+ return isSupportCanvas;
307
+ }
308
+ }, {
309
+ key: "supportCanvasFilter",
310
+ value: function supportCanvasFilter() {
311
+ return !(sniffer.browser === "safari" || sniffer.browser === "firefox");
312
+ }
313
+ }]);
314
+ return DynamicBg2;
315
+ }(Plugin);
316
+ export { DynamicBg as default };
@@ -0,0 +1,19 @@
1
+
2
+ .xgplayer-dynamic-bg, .xgplayer-dynamic-bg canvas, .xgplayer-dynamic-bg xgmask, .xgplayer-dynamic-bg xgfilter{
3
+ display: block;
4
+ position: absolute;
5
+ top: 0;
6
+ left: 0;
7
+ height: 100%;
8
+ width: 100%;
9
+ // filter: blur(50px);
10
+ pointer-events: none;
11
+ }
12
+ .xgplayer-dynamic-bg {
13
+ canvas {
14
+ transform: translateZ(0);
15
+ }
16
+ xgmask {
17
+ background: rgba(0,0,0,0.7);
18
+ }
19
+ }
@@ -0,0 +1,104 @@
1
+ .xgplayer-enter {
2
+ display: none;
3
+ position: absolute;
4
+ left: 0;
5
+ top: 0;
6
+ width: 100%;
7
+ height: 100%;
8
+ background: rgba(0, 0, 0, 0.8);
9
+ z-index: 5;
10
+ pointer-events: none;
11
+ }
12
+ .xgplayer-enter .show {
13
+ display: block;
14
+ }
15
+ .xgplayer-enter .xgplayer-enter-spinner {
16
+ display: block;
17
+ position: absolute;
18
+ z-index: 1;
19
+ left: 50%;
20
+ top: 50%;
21
+ height: 100px;
22
+ width: 100px;
23
+ transform: translate(-50%, -50%);
24
+ }
25
+ .xgplayer-enter .xgplayer-enter-spinner div {
26
+ width: 6%;
27
+ height: 13%;
28
+ background-color: rgba(255, 255, 255, 0.7);
29
+ position: absolute;
30
+ left: 45%;
31
+ top: 45%;
32
+ opacity: 0;
33
+ border-radius: 30px;
34
+ animation: fade 1s linear infinite;
35
+ }
36
+ .xgplayer-enter .xgplayer-enter-spinner div.xgplayer-enter-bar1 {
37
+ transform: rotate(0deg) translate(0, -140%);
38
+ animation-delay: -0s;
39
+ }
40
+ .xgplayer-enter .xgplayer-enter-spinner div.xgplayer-enter-bar2 {
41
+ transform: rotate(30deg) translate(0, -140%);
42
+ animation-delay: -0.9163s;
43
+ }
44
+ .xgplayer-enter .xgplayer-enter-spinner div.xgplayer-enter-bar3 {
45
+ transform: rotate(60deg) translate(0, -140%);
46
+ animation-delay: -0.833s;
47
+ }
48
+ .xgplayer-enter .xgplayer-enter-spinner div.xgplayer-enter-bar4 {
49
+ transform: rotate(90deg) translate(0, -140%);
50
+ animation-delay: -0.7497s;
51
+ }
52
+ .xgplayer-enter .xgplayer-enter-spinner div.xgplayer-enter-bar5 {
53
+ transform: rotate(120deg) translate(0, -140%);
54
+ animation-delay: -0.6664s;
55
+ }
56
+ .xgplayer-enter .xgplayer-enter-spinner div.xgplayer-enter-bar6 {
57
+ transform: rotate(150deg) translate(0, -140%);
58
+ animation-delay: -0.5831s;
59
+ }
60
+ .xgplayer-enter .xgplayer-enter-spinner div.xgplayer-enter-bar7 {
61
+ transform: rotate(180deg) translate(0, -140%);
62
+ animation-delay: -0.4998s;
63
+ }
64
+ .xgplayer-enter .xgplayer-enter-spinner div.xgplayer-enter-bar8 {
65
+ transform: rotate(210deg) translate(0, -140%);
66
+ animation-delay: -0.4165s;
67
+ }
68
+ .xgplayer-enter .xgplayer-enter-spinner div.xgplayer-enter-bar9 {
69
+ transform: rotate(240deg) translate(0, -140%);
70
+ animation-delay: -0.3332s;
71
+ }
72
+ .xgplayer-enter .xgplayer-enter-spinner div.xgplayer-enter-bar10 {
73
+ transform: rotate(270deg) translate(0, -140%);
74
+ animation-delay: -0.2499s;
75
+ }
76
+ .xgplayer-enter .xgplayer-enter-spinner div.xgplayer-enter-bar11 {
77
+ transform: rotate(300deg) translate(0, -140%);
78
+ animation-delay: -0.1666s;
79
+ }
80
+ .xgplayer-enter .xgplayer-enter-spinner div.xgplayer-enter-bar12 {
81
+ transform: rotate(330deg) translate(0, -142%);
82
+ animation-delay: -0.0833s;
83
+ }
84
+ @keyframes fade {
85
+ from {
86
+ opacity: 1;
87
+ }
88
+ to {
89
+ opacity: 0.25;
90
+ }
91
+ }
92
+
93
+ .xgplayer.xgplayer-is-enter .xgplayer-enter {
94
+ display: block;
95
+ opacity: 1;
96
+ transition: opacity 0.3s;
97
+ }
98
+ .xgplayer.xgplayer-nostart .xgplayer-enter {
99
+ display: none;
100
+ }
101
+ .xgplayer.xgplayer-mobile .xgplayer-enter .xgplayer-enter-spinner {
102
+ width: 70px;
103
+ height: 70px;
104
+ }
@@ -0,0 +1,19 @@
1
+ export default Enter;
2
+ export type IEnterConfig = {
3
+ [propName: string]: any;
4
+ innerHtml?: string;
5
+ };
6
+ /**
7
+ * @typedef { {
8
+ * innerHtml?: string,
9
+ * [propName: string]: any
10
+ * } } IEnterConfig
11
+ */
12
+ declare class Enter extends Plugin {
13
+ /**
14
+ * @type IEnterConfig
15
+ */
16
+ static get defaultConfig(): IEnterConfig;
17
+ render(): HTMLElement;
18
+ }
19
+ import Plugin from "../../plugin";
@@ -0,0 +1,46 @@
1
+ import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, createClass as _createClass } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
+ import util from "../../utils/util.js";
3
+ import "../../utils/debug.js";
4
+ import Plugin from "../../plugin/plugin.js";
5
+ var Enter = /* @__PURE__ */ function(_Plugin) {
6
+ _inherits(Enter2, _Plugin);
7
+ var _super = _createSuper(Enter2);
8
+ function Enter2() {
9
+ _classCallCheck(this, Enter2);
10
+ return _super.apply(this, arguments);
11
+ }
12
+ _createClass(Enter2, [{
13
+ key: "render",
14
+ value: function render() {
15
+ var innerHtml = this.config.innerHtml;
16
+ var root = util.createDom("xg-enter", "", {}, "xgplayer-enter");
17
+ if (innerHtml && innerHtml instanceof window.HTMLElement) {
18
+ root.appendChild(innerHtml);
19
+ } else if (innerHtml && typeof innerHtml === "string") {
20
+ root.innerHTML = innerHtml;
21
+ } else {
22
+ var barStr = "";
23
+ for (var i = 1; i <= 12; i++) {
24
+ barStr += '<div class="xgplayer-enter-bar'.concat(i, '"></div>');
25
+ }
26
+ root.innerHTML = '<div class="xgplayer-enter-spinner">'.concat(barStr, "</div>");
27
+ }
28
+ return root;
29
+ }
30
+ }], [{
31
+ key: "pluginName",
32
+ get: function get() {
33
+ return "enter";
34
+ }
35
+ }, {
36
+ key: "defaultConfig",
37
+ get: function get() {
38
+ return {
39
+ innerHtml: "",
40
+ logo: ""
41
+ };
42
+ }
43
+ }]);
44
+ return Enter2;
45
+ }(Plugin);
46
+ export { Enter as default };
@@ -0,0 +1,78 @@
1
+ .xgplayer-enter {
2
+ display: none;
3
+ position: absolute;
4
+ left: 0;
5
+ top: 0;
6
+ width: 100%;
7
+ height: 100%;
8
+ background: rgba(0,0,0,.8);
9
+ z-index: 5;
10
+ pointer-events: none;
11
+ .show {
12
+ display: block;
13
+ }
14
+ .xgplayer-enter-spinner {
15
+ display: block;
16
+ position: absolute;
17
+ z-index: 1;
18
+ left: 50%;
19
+ top: 50%;
20
+ height: 100px;
21
+ width: 100px;
22
+ transform: translate(-50%,-50%);
23
+ }
24
+
25
+ .xgplayer-enter-spinner div {
26
+ width: 6%;
27
+ height: 13%;
28
+ background-color: rgba(255,255,255,0.7);
29
+ position: absolute;
30
+ left: 45%;
31
+ top: 45%;
32
+ opacity: 0;
33
+ border-radius: 30px;
34
+ animation: fade 1s linear infinite;
35
+ }
36
+
37
+ @for $i from 1 to 12 {
38
+ .xgplayer-enter-spinner div.xgplayer-enter-bar#{$i} {
39
+ transform: rotate(#{($i - 1) * 30 }deg) translate(0, -140%);
40
+ animation-delay: -#{(13 - $i)%12 * 0.0833}s;
41
+ }
42
+ }
43
+ .xgplayer-enter-spinner div.xgplayer-enter-bar12 {
44
+ transform:rotate(330deg) translate(0, -142%);
45
+ animation-delay: -0.0833s;
46
+ }
47
+ @keyframes fade {
48
+ from {opacity: 1;}
49
+ to {opacity: 0.25;}
50
+ }
51
+ }
52
+
53
+ .xgplayer {
54
+ &.xgplayer-is-enter {
55
+ .xgplayer-enter {
56
+ display: block;
57
+ opacity: 1;
58
+ transition: opacity 0.3s;
59
+ }
60
+ }
61
+ &.xgplayer-nostart {
62
+ .xgplayer-enter {
63
+ display: none;
64
+ }
65
+ }
66
+ &.xgplayer-mobile {
67
+ .xgplayer-enter .xgplayer-enter-spinner {
68
+ width: 70px;
69
+ height: 70px;
70
+ }
71
+ }
72
+ }
73
+
74
+ // .not-allow-autoplay, .xgplayer-playing, .xgplayer-nostart{
75
+ // .xgplayer-enter {
76
+ // display: none;
77
+ // }
78
+ // }
@@ -0,0 +1,29 @@
1
+ .xgplayer-error {
2
+ background: #000;
3
+ display: none;
4
+ position: absolute;
5
+ left: 0;
6
+ top: 0;
7
+ width: 100%;
8
+ height: 100%;
9
+ z-index: 6;
10
+ color: #fff;
11
+ text-align: center;
12
+ line-height: 100%;
13
+ justify-content: center;
14
+ align-items: center;
15
+ }
16
+ .xgplayer-error .xgplayer-error-refresh {
17
+ color: #FA1F41;
18
+ padding: 0 3px;
19
+ cursor: pointer;
20
+ }
21
+ .xgplayer-error .xgplayer-error-text {
22
+ line-height: 18px;
23
+ margin: auto 6px;
24
+ display: block;
25
+ margin-bottom: 20px;
26
+ }
27
+ .xgplayer-is-error .xgplayer-error {
28
+ display: flex;
29
+ }
@@ -0,0 +1,8 @@
1
+ export default class ErrorPlugin extends Plugin {
2
+ clickHandler: any;
3
+ onError: any;
4
+ errorRetry(e: any): void;
5
+ handleError(error?: {}): void;
6
+ render(): string;
7
+ }
8
+ import Plugin from "../../plugin";
@@ -0,0 +1,75 @@
1
+ import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, createClass as _createClass } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
+ import "../../utils/util.js";
3
+ import { ERROR } from "../../events.js";
4
+ import "../../utils/debug.js";
5
+ import Plugin from "../../plugin/plugin.js";
6
+ var ErrorPlugin = /* @__PURE__ */ function(_Plugin) {
7
+ _inherits(ErrorPlugin2, _Plugin);
8
+ var _super = _createSuper(ErrorPlugin2);
9
+ function ErrorPlugin2() {
10
+ _classCallCheck(this, ErrorPlugin2);
11
+ return _super.apply(this, arguments);
12
+ }
13
+ _createClass(ErrorPlugin2, [{
14
+ key: "afterCreate",
15
+ value: function afterCreate() {
16
+ var _this = this;
17
+ this.clickHandler = this.hook("errorRetry", this.errorRetry, {
18
+ pre: function pre(e) {
19
+ e.preventDefault();
20
+ e.stopPropagation();
21
+ }
22
+ });
23
+ this.onError = this.hook("showError", this.handleError);
24
+ this.bind(".xgplayer-error-refresh", "click", this.clickHandler);
25
+ this.on(ERROR, function(error) {
26
+ _this.onError(error);
27
+ });
28
+ }
29
+ }, {
30
+ key: "errorRetry",
31
+ value: function errorRetry(e) {
32
+ this.emitUserAction(e, "error_retry", {});
33
+ this.player.retry();
34
+ }
35
+ }, {
36
+ key: "handleError",
37
+ value: function handleError() {
38
+ var error = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
39
+ var player = this.player;
40
+ var type = error.errorType;
41
+ var errorNote = player.errorNote ? this.i18n[player.errorNote] : "";
42
+ if (!errorNote) {
43
+ switch (type) {
44
+ case "decoder":
45
+ errorNote = this.i18n.MEDIA_ERR_DECODE;
46
+ break;
47
+ case "network":
48
+ errorNote = this.i18n.MEDIA_ERR_NETWORK;
49
+ break;
50
+ default:
51
+ errorNote = this.i18n.MEDIA_ERR_SRC_NOT_SUPPORTED;
52
+ }
53
+ }
54
+ this.find(".xgplayer-error-text").innerHTML = errorNote;
55
+ this.find(".xgplayer-error-tips").innerHTML = "".concat(this.i18n.REFRESH_TIPS, '<span class="xgplayer-error-refresh">').concat(this.i18n.REFRESH, "</span>");
56
+ }
57
+ }, {
58
+ key: "destroy",
59
+ value: function destroy() {
60
+ this.unbind(".xgplayer-error-refresh", "click", this.clickHandler);
61
+ }
62
+ }, {
63
+ key: "render",
64
+ value: function render() {
65
+ return '<xg-error class="xgplayer-error">\n <div class="xgplayer-errornote">\n <span class="xgplayer-error-text"></span>\n <span class="xgplayer-error-tips"><em class="xgplayer-error-refresh"></em></span>\n </div>\n </xg-error>';
66
+ }
67
+ }], [{
68
+ key: "pluginName",
69
+ get: function get() {
70
+ return "error";
71
+ }
72
+ }]);
73
+ return ErrorPlugin2;
74
+ }(Plugin);
75
+ export { ErrorPlugin as default };