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,225 @@
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 { DURATION_CHANGE, SEEKED, TIME_UPDATE, ENDED, EMPTIED } from "../../events.js";
4
+ import "../../utils/debug.js";
5
+ import Plugin, { POSITIONS } from "../../plugin/plugin.js";
6
+ var Time = /* @__PURE__ */ function(_Plugin) {
7
+ _inherits(Time2, _Plugin);
8
+ var _super = _createSuper(Time2);
9
+ function Time2(args) {
10
+ var _this;
11
+ _classCallCheck(this, Time2);
12
+ _this = _super.call(this, args);
13
+ _this.isActiving = false;
14
+ return _this;
15
+ }
16
+ _createClass(Time2, [{
17
+ key: "duration",
18
+ get: function get() {
19
+ var _this$player = this.player, offsetDuration = _this$player.offsetDuration, duration = _this$player.duration;
20
+ return this.playerConfig.customDuration || offsetDuration || duration;
21
+ }
22
+ }, {
23
+ key: "currentTime",
24
+ get: function get() {
25
+ var _this$player2 = this.player, offsetCurrentTime = _this$player2.offsetCurrentTime, currentTime = _this$player2.currentTime;
26
+ return offsetCurrentTime >= 0 ? offsetCurrentTime : currentTime;
27
+ }
28
+ }, {
29
+ key: "timeOffset",
30
+ get: function get() {
31
+ return this.playerConfig.timeOffset || 0;
32
+ }
33
+ }, {
34
+ key: "afterCreate",
35
+ value: function afterCreate() {
36
+ var _this2 = this;
37
+ var constrolsMode = this.player.controls.config.mode;
38
+ this.mode = constrolsMode === "flex" ? "flex" : "normal";
39
+ if (this.config.disable) {
40
+ return;
41
+ }
42
+ if (this.mode === "flex") {
43
+ this.createCenterTime();
44
+ this.root.style.display = "none";
45
+ }
46
+ this.durationDom = this.find(".time-duration");
47
+ this.timeDom = this.find(".time-current");
48
+ this.on([DURATION_CHANGE, SEEKED, TIME_UPDATE], function() {
49
+ _this2.onTimeUpdate();
50
+ });
51
+ this.on(ENDED, function() {
52
+ _this2.onTimeUpdate(true);
53
+ });
54
+ this.on(EMPTIED, function() {
55
+ _this2.onReset();
56
+ });
57
+ }
58
+ }, {
59
+ key: "show",
60
+ value: function show() {
61
+ if (this.mode === "flex") {
62
+ this.centerCurDom && (this.centerCurDom.style.display = "block");
63
+ this.centerDurDom && (this.centerDurDom.style.display = "block");
64
+ return;
65
+ }
66
+ this.root.style.display = "block";
67
+ }
68
+ }, {
69
+ key: "hide",
70
+ value: function hide() {
71
+ if (this.mode === "flex") {
72
+ this.centerCurDom && (this.centerCurDom.style.display = "none");
73
+ this.centerDurDom && (this.centerDurDom.style.display = "none");
74
+ return;
75
+ }
76
+ this.root.style.display = "none";
77
+ }
78
+ }, {
79
+ key: "onTimeUpdate",
80
+ value: function onTimeUpdate(isEnded) {
81
+ var player = this.player, config = this.config, duration = this.duration;
82
+ if (config.disable || this.isActiving || !player.hasStart) {
83
+ return;
84
+ }
85
+ var current = this.currentTime + this.timeOffset;
86
+ current = util.adjustTimeByDuration(current, duration, isEnded);
87
+ if (this.mode === "flex") {
88
+ this.centerCurDom.innerHTML = this.minWidthTime(util.format(current));
89
+ if (duration !== Infinity && duration > 0) {
90
+ this.centerDurDom.innerHTML = util.format(duration);
91
+ }
92
+ } else {
93
+ this.timeDom.innerHTML = this.minWidthTime(util.format(current));
94
+ if (duration !== Infinity && duration > 0) {
95
+ this.durationDom.innerHTML = util.format(duration);
96
+ }
97
+ }
98
+ }
99
+ }, {
100
+ key: "onReset",
101
+ value: function onReset() {
102
+ if (this.mode === "flex") {
103
+ this.centerCurDom.innerHTML = this.minWidthTime(util.format(0));
104
+ this.centerDurDom.innerHTML = util.format(0);
105
+ } else {
106
+ this.timeDom.innerHTML = this.minWidthTime(util.format(0));
107
+ this.durationDom.innerHTML = util.format(0);
108
+ }
109
+ }
110
+ }, {
111
+ key: "createCenterTime",
112
+ value: function createCenterTime() {
113
+ var player = this.player;
114
+ if (!player.controls || !player.controls.center) {
115
+ return;
116
+ }
117
+ var center = player.controls.center;
118
+ this.centerCurDom = util.createDom("xg-icon", "00:00", {}, "xgplayer-time xg-time-left");
119
+ this.centerDurDom = util.createDom("xg-icon", "00:00", {}, "xgplayer-time xg-time-right");
120
+ center.children.length > 0 ? center.insertBefore(this.centerCurDom, center.children[0]) : center.appendChild(this.centerCurDom);
121
+ center.appendChild(this.centerDurDom);
122
+ }
123
+ }, {
124
+ key: "afterPlayerInit",
125
+ value: function afterPlayerInit() {
126
+ var config = this.config;
127
+ if (this.duration === Infinity || this.playerConfig.isLive) {
128
+ util.hide(this.durationDom);
129
+ util.hide(this.timeDom);
130
+ util.hide(this.find(".time-separator"));
131
+ util.show(this.find(".time-live-tag"));
132
+ } else {
133
+ util.hide(this.find(".time-live-tag"));
134
+ }
135
+ if (config.hide) {
136
+ this.hide();
137
+ return;
138
+ }
139
+ this.show();
140
+ }
141
+ }, {
142
+ key: "changeLiveState",
143
+ value: function changeLiveState(isLive) {
144
+ if (isLive) {
145
+ util.hide(this.durationDom);
146
+ util.hide(this.timeDom);
147
+ util.hide(this.find(".time-separator"));
148
+ util.show(this.find(".time-live-tag"));
149
+ } else {
150
+ util.hide(this.find(".time-live-tag"));
151
+ util.show(this.find(".time-separator"));
152
+ util.show(this.durationDom);
153
+ util.show(this.timeDom);
154
+ }
155
+ }
156
+ }, {
157
+ key: "updateTime",
158
+ value: function updateTime(time) {
159
+ this.isActiving = true;
160
+ if (!time && time !== 0 || time > this.duration) {
161
+ return;
162
+ }
163
+ if (this.mode === "flex") {
164
+ this.centerCurDom.innerHTML = this.minWidthTime(util.format(time));
165
+ return;
166
+ }
167
+ this.timeDom.innerHTML = this.minWidthTime(util.format(time));
168
+ }
169
+ }, {
170
+ key: "minWidthTime",
171
+ value: function minWidthTime(timeStr) {
172
+ return timeStr.split(":").map(function(value) {
173
+ return '<span class="time-min-width">'.concat(value, "</span>");
174
+ }).join(":");
175
+ }
176
+ }, {
177
+ key: "resetActive",
178
+ value: function resetActive() {
179
+ var _this3 = this;
180
+ var player = this.player;
181
+ var updateState = function updateState2() {
182
+ _this3.isActiving = false;
183
+ };
184
+ this.off(SEEKED, updateState);
185
+ if (player.isSeeking) {
186
+ this.once(SEEKED, updateState);
187
+ } else {
188
+ this.isActiving = false;
189
+ }
190
+ }
191
+ }, {
192
+ key: "destroy",
193
+ value: function destroy() {
194
+ var center = this.player.controls.center;
195
+ this.centerCurDom && center.removeChild(this.centerCurDom);
196
+ this.centerCurDom = null;
197
+ this.centerDurDom && center.removeChild(this.centerDurDom);
198
+ this.centerDurDom = null;
199
+ }
200
+ }, {
201
+ key: "render",
202
+ value: function render() {
203
+ if (this.config.disable) {
204
+ return;
205
+ }
206
+ return '<xg-icon class="xgplayer-time">\n <span class="time-current">00:00</span>\n <span class="time-separator">/</span>\n <span class="time-duration">00:00</span>\n <span class="time-live-tag">'.concat(this.i18n.LIVE_TIP, "</span>\n </xg-icon>");
207
+ }
208
+ }], [{
209
+ key: "pluginName",
210
+ get: function get() {
211
+ return "time";
212
+ }
213
+ }, {
214
+ key: "defaultConfig",
215
+ get: function get() {
216
+ return {
217
+ position: POSITIONS.CONTROLS_LEFT,
218
+ index: 2,
219
+ disable: false
220
+ };
221
+ }
222
+ }]);
223
+ return Time2;
224
+ }(Plugin);
225
+ export { Time as default };
@@ -0,0 +1,57 @@
1
+ $timeColor: #fff;
2
+ $timeDurationColor: rgba(255, 255, 255, 0.50);
3
+
4
+ .xgplayer {
5
+ .xgplayer-time {
6
+ min-width: 40px;
7
+ font-size: 14px;
8
+ font-family: PingFangSC-Semibold;
9
+ color: $timeColor;
10
+ text-align: center;
11
+ display: inline-block;
12
+ line-height: 40px;
13
+ span {
14
+ display: inline-block;
15
+ line-height: 40px;
16
+ height: 40px;
17
+ // text-align: center;
18
+ // vertical-align: middle;
19
+ .time-min-width {
20
+ text-align: center;
21
+ min-width: 2ch;
22
+ &:first-child {
23
+ text-align: right;
24
+ }
25
+ &:last-child {
26
+ text-align: left;
27
+ }
28
+ }
29
+ }
30
+ .time-duration {
31
+ color: $timeDurationColor;
32
+ }
33
+
34
+ .time-live-tag {
35
+ display: none;
36
+ }
37
+
38
+ &.xg-time-left {
39
+ margin-left: 0;
40
+ }
41
+ &.xg-time-right {
42
+ margin-right: 0;
43
+ }
44
+ }
45
+ &.xgplayer-mobile {
46
+ .xgplayer-time {
47
+ min-width: 30px;
48
+ font-size: 12px;
49
+ &.xg-time-left {
50
+ margin-right: 8px;
51
+ }
52
+ &.xg-time-right {
53
+ margin-left: 8px;
54
+ }
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 进行事件分段控制
3
+ */
4
+ export default class TimeSegmentsControls extends BasePlugin {
5
+ static get defaultConfig(): {
6
+ disable: boolean;
7
+ segments: any[];
8
+ };
9
+ curIndex: any;
10
+ curPos: any;
11
+ lastCurrentTime: any;
12
+ setConfig(newConfig: any): void;
13
+ updateSegments(): void;
14
+ formatTimeSegments(timeSegments: any, duration: any): any[];
15
+ _onDurationChange: () => void;
16
+ _onLoadedData: () => void;
17
+ _onTimeupdate: () => void;
18
+ _onSeeking: () => void;
19
+ _onPlay: () => void;
20
+ getSeekTime(currentTime: any, lastCurrentTime: any, index: any, timeSegments: any): number;
21
+ _checkIfEnabled(segments: any): boolean;
22
+ changeIndex(index: any, timeSegments: any): void;
23
+ }
24
+ import { BasePlugin } from "../../plugin";
@@ -0,0 +1,216 @@
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 { DURATION_CHANGE, LOADED_DATA, TIME_UPDATE, SEEKING, PLAY } from "../../events.js";
4
+ import BasePlugin from "../../plugin/basePlugin.js";
5
+ import "delegate";
6
+ var TimeSegmentsControls = /* @__PURE__ */ function(_BasePlugin) {
7
+ _inherits(TimeSegmentsControls2, _BasePlugin);
8
+ var _super = _createSuper(TimeSegmentsControls2);
9
+ function TimeSegmentsControls2() {
10
+ var _this;
11
+ _classCallCheck(this, TimeSegmentsControls2);
12
+ for (var _len2 = arguments.length, args = new Array(_len2), _key = 0; _key < _len2; _key++) {
13
+ args[_key] = arguments[_key];
14
+ }
15
+ _this = _super.call.apply(_super, [this].concat(args));
16
+ _defineProperty(_assertThisInitialized(_this), "_onDurationChange", function() {
17
+ _this.updateSegments();
18
+ var _this$player = _this.player, currentTime = _this$player.currentTime, timeSegments = _this$player.timeSegments;
19
+ if (!_this._checkIfEnabled(timeSegments)) {
20
+ return;
21
+ }
22
+ var index = util.getIndexByTime(currentTime, timeSegments);
23
+ var time = util.getOffsetCurrentTime(currentTime, timeSegments, index);
24
+ _this.player.offsetCurrentTime = time;
25
+ _this.changeIndex(index, timeSegments);
26
+ });
27
+ _defineProperty(_assertThisInitialized(_this), "_onLoadedData", function() {
28
+ var timeSegments = _this.player.timeSegments;
29
+ if (!_this._checkIfEnabled(timeSegments)) {
30
+ return;
31
+ }
32
+ var time = util.getOffsetCurrentTime(0, timeSegments);
33
+ _this.player.offsetCurrentTime = time;
34
+ _this.changeIndex(0, timeSegments);
35
+ if (_this.curPos.start > 0) {
36
+ _this.player.currentTime = _this.curPos.start;
37
+ }
38
+ });
39
+ _defineProperty(_assertThisInitialized(_this), "_onTimeupdate", function() {
40
+ var _this$player2 = _this.player, currentTime = _this$player2.currentTime, timeSegments = _this$player2.timeSegments;
41
+ if (!_this._checkIfEnabled(timeSegments)) {
42
+ return;
43
+ }
44
+ var _len = timeSegments.length;
45
+ _this.lastCurrentTime = currentTime;
46
+ var index = util.getIndexByTime(currentTime, timeSegments);
47
+ if (index !== _this.curIndex) {
48
+ _this.changeIndex(index, timeSegments);
49
+ }
50
+ var curTime = util.getOffsetCurrentTime(currentTime, timeSegments, index);
51
+ _this.player.offsetCurrentTime = curTime;
52
+ if (!_this.curPos) {
53
+ return;
54
+ }
55
+ var _this$curPos = _this.curPos, start = _this$curPos.start, end = _this$curPos.end;
56
+ if (currentTime < start) {
57
+ _this.player.currentTime = start;
58
+ } else if (currentTime > end && index >= _len - 1) {
59
+ _this.player.pause();
60
+ }
61
+ });
62
+ _defineProperty(_assertThisInitialized(_this), "_onSeeking", function() {
63
+ var _this$player3 = _this.player, currentTime = _this$player3.currentTime, timeSegments = _this$player3.timeSegments;
64
+ if (!_this._checkIfEnabled(timeSegments)) {
65
+ return;
66
+ }
67
+ if (currentTime < timeSegments[0].start) {
68
+ _this.player.currentTime = timeSegments[0].start;
69
+ } else if (currentTime > timeSegments[timeSegments.length - 1].end) {
70
+ _this.player.currentTime = timeSegments[timeSegments.length - 1].end;
71
+ } else {
72
+ var _index = util.getIndexByTime(currentTime, timeSegments);
73
+ if (_index >= 0) {
74
+ var _seekTime = _this.getSeekTime(currentTime, _this.lastCurrentTime, _index, timeSegments);
75
+ if (_seekTime >= 0) {
76
+ _this.player.currentTime = _seekTime;
77
+ }
78
+ }
79
+ }
80
+ });
81
+ _defineProperty(_assertThisInitialized(_this), "_onPlay", function() {
82
+ var _this$player4 = _this.player, currentTime = _this$player4.currentTime, timeSegments = _this$player4.timeSegments;
83
+ if (_this._checkIfEnabled(timeSegments) && currentTime >= timeSegments[timeSegments.length - 1].end) {
84
+ _this.player.currentTime = timeSegments[0].start;
85
+ }
86
+ });
87
+ return _this;
88
+ }
89
+ _createClass(TimeSegmentsControls2, [{
90
+ key: "afterCreate",
91
+ value: function afterCreate() {
92
+ this.curIndex = -1;
93
+ this.curPos = null;
94
+ this.lastCurrentTime = 0;
95
+ this.updateSegments();
96
+ this.on(DURATION_CHANGE, this._onDurationChange);
97
+ this.on(LOADED_DATA, this._onLoadedData);
98
+ this.on(TIME_UPDATE, this._onTimeupdate);
99
+ this.on(SEEKING, this._onSeeking);
100
+ this.on(PLAY, this._onPlay);
101
+ }
102
+ }, {
103
+ key: "setConfig",
104
+ value: function setConfig(newConfig) {
105
+ var _this2 = this;
106
+ if (!newConfig) {
107
+ return;
108
+ }
109
+ var keys = Object.keys(newConfig);
110
+ if (keys.length < 1) {
111
+ return;
112
+ }
113
+ keys.forEach(function(key) {
114
+ _this2.config[key] = newConfig[key];
115
+ });
116
+ this.updateSegments();
117
+ }
118
+ }, {
119
+ key: "updateSegments",
120
+ value: function updateSegments() {
121
+ var _this$config = this.config, disable = _this$config.disable, segments = _this$config.segments;
122
+ var player = this.player;
123
+ if (disable || !segments || segments.length === 0) {
124
+ player.timeSegments = [];
125
+ player.offsetDuration = 0;
126
+ player.offsetCurrentTime = -1;
127
+ } else {
128
+ var _segs = this.formatTimeSegments(segments, player.duration);
129
+ player.timeSegments = _segs;
130
+ player.offsetDuration = _segs.length > 0 ? _segs[_segs.length - 1].duration : 0;
131
+ }
132
+ }
133
+ }, {
134
+ key: "formatTimeSegments",
135
+ value: function formatTimeSegments(timeSegments, duration) {
136
+ var ret = [];
137
+ if (!timeSegments) {
138
+ return [];
139
+ }
140
+ timeSegments.sort(function(a, b) {
141
+ return a.start - b.start;
142
+ });
143
+ timeSegments.forEach(function(item, index) {
144
+ var _item = {};
145
+ _item.start = item.start < 0 ? 0 : item.start;
146
+ _item.end = duration > 0 && item.end > duration ? duration : item.end;
147
+ if (duration > 0 && _item.start > duration) {
148
+ return;
149
+ }
150
+ ret.push(_item);
151
+ var _segDuration = _item.end - _item.start;
152
+ if (index === 0) {
153
+ _item.offset = item.start;
154
+ _item.cTime = 0;
155
+ _item.segDuration = _segDuration;
156
+ _item.duration = _segDuration;
157
+ } else {
158
+ var last = ret[index - 1];
159
+ _item.offset = last.offset + (_item.start - last.end);
160
+ _item.cTime = last.duration + last.cTime;
161
+ _item.segDuration = _segDuration;
162
+ _item.duration = last.duration + _segDuration;
163
+ }
164
+ });
165
+ return ret;
166
+ }
167
+ }, {
168
+ key: "getSeekTime",
169
+ value: function getSeekTime(currentTime, lastCurrentTime, index, timeSegments) {
170
+ var _time = -1;
171
+ var _timeSegments$index = timeSegments[index], start = _timeSegments$index.start, end = _timeSegments$index.end;
172
+ if (currentTime >= start && currentTime <= end) {
173
+ return _time;
174
+ }
175
+ var diff = currentTime - lastCurrentTime;
176
+ if (diff < 0) {
177
+ if (currentTime < start) {
178
+ var diff2 = lastCurrentTime > start ? lastCurrentTime - start : 0;
179
+ _time = index - 1 >= 0 ? timeSegments[index - 1].end + diff + diff2 : 0;
180
+ return _time;
181
+ }
182
+ }
183
+ return -1;
184
+ }
185
+ }, {
186
+ key: "_checkIfEnabled",
187
+ value: function _checkIfEnabled(segments) {
188
+ return !(!segments || segments.length < 1);
189
+ }
190
+ }, {
191
+ key: "changeIndex",
192
+ value: function changeIndex(index, timeSegments) {
193
+ this.curIndex = index;
194
+ if (index >= 0 && timeSegments.length > 0) {
195
+ this.curPos = timeSegments[index];
196
+ } else {
197
+ this.curPos = null;
198
+ }
199
+ }
200
+ }], [{
201
+ key: "pluginName",
202
+ get: function get() {
203
+ return "TimeSegmentsControls";
204
+ }
205
+ }, {
206
+ key: "defaultConfig",
207
+ get: function get() {
208
+ return {
209
+ disable: true,
210
+ segments: []
211
+ };
212
+ }
213
+ }]);
214
+ return TimeSegmentsControls2;
215
+ }(BasePlugin);
216
+ export { TimeSegmentsControls as default };
@@ -0,0 +1,91 @@
1
+ .xgplayer-texttrack[data-state=open] .xg-texttrak-open {
2
+ display: block;
3
+ }
4
+ .xgplayer-texttrack[data-state=open] .xg-texttrak-close {
5
+ display: none;
6
+ }
7
+
8
+ .xgplayer-texttrack[data-state=close] .xg-texttrak-open {
9
+ display: none;
10
+ }
11
+ .xgplayer-texttrack[data-state=close] .xg-texttrak-close {
12
+ display: block;
13
+ }
14
+
15
+ .xgplayer-texttrack-active .xgplayer-texttrack ul {
16
+ display: block;
17
+ }
18
+
19
+ .xgplayer xg-text-track.follow-control {
20
+ transition: transform 0.2s ease;
21
+ }
22
+
23
+ .xgplayer-is-texttrack .xgplayer-texttrack {
24
+ display: block;
25
+ }
26
+
27
+ xg-text-track.xg-text-track {
28
+ font-family: "PingFang SC", "SF Pro SC", "SF Pro Text", "SF Pro Icons", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
29
+ -webkit-font-smoothing: antialiased;
30
+ position: absolute;
31
+ bottom: 0;
32
+ color: #fff;
33
+ left: 0;
34
+ right: 0;
35
+ pointer-events: none;
36
+ display: flex;
37
+ justify-content: center;
38
+ }
39
+ xg-text-track.xg-text-track.text-track-no-fitvideo {
40
+ margin-bottom: 2%;
41
+ }
42
+ xg-text-track.xg-text-track.text-track-hide {
43
+ opacity: 0;
44
+ visibility: hidden;
45
+ }
46
+ xg-text-track.xg-text-track.text-track-show {
47
+ opacity: 1;
48
+ visibility: visible;
49
+ }
50
+ xg-text-track.xg-text-track xg-text-track-inner {
51
+ display: block;
52
+ max-width: 92%;
53
+ text-align: center;
54
+ }
55
+ xg-text-track.xg-text-track xg-text-track-span {
56
+ display: -webkit-box;
57
+ text-align: left;
58
+ text-overflow: ellipsis;
59
+ -webkit-box-orient: vertical;
60
+ overflow: hidden;
61
+ padding: 1px 4px;
62
+ -webkit-line-clamp: 1;
63
+ line-height: 120%;
64
+ word-break: break-word;
65
+ }
66
+ xg-text-track.xg-text-track xg-text-track-span.text-track-deputy {
67
+ font-size: 75%;
68
+ }
69
+ xg-text-track.xg-text-track xg-text-track-span.text-track-single {
70
+ -webkit-line-clamp: 1;
71
+ }
72
+ xg-text-track.xg-text-track xg-text-track-span.text-track-double {
73
+ -webkit-line-clamp: 2;
74
+ }
75
+ xg-text-track.xg-text-track xg-text-track-span.text-track-three {
76
+ -webkit-line-clamp: 3;
77
+ }
78
+ xg-text-track.xg-text-track xg-text-track-span.text-track-space {
79
+ opacity: 0;
80
+ height: 0;
81
+ line-height: 0;
82
+ }
83
+ xg-text-track.xg-text-track.text-track-bg xg-text-track-inner {
84
+ background-color: rgba(0, 0, 0, 0.54);
85
+ border-radius: 2px;
86
+ }
87
+ xg-text-track.xg-text-track.text-track-stroke xg-text-track-inner {
88
+ background-color: none;
89
+ border-radius: 0;
90
+ text-shadow: -1px 1px 0 rgba(0, 0, 0, 0.7), 1px 1px 0 rgba(0, 0, 0, 0.7), 1px -1px 0 rgba(0, 0, 0, 0.7), -1px -1px 0 rgba(0, 0, 0, 0.7);
91
+ }