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,475 @@
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 { DURATION_CHANGE } from "../../events.js";
5
+ import "../../utils/debug.js";
6
+ import Plugin from "../../plugin/plugin.js";
7
+ import initDotsAPI from "./dotsApi.js";
8
+ var CALLBACK_MAP = {
9
+ dragmove: "onProgressMove",
10
+ dragstart: "onProgressDragStart",
11
+ dragend: "onProgressDragEnd",
12
+ click: "onProgressClick",
13
+ mouseover: "onProgressMouseOver",
14
+ mouseenter: "onProgressMove"
15
+ };
16
+ var ProgressPreview = /* @__PURE__ */ function(_Plugin) {
17
+ _inherits(ProgressPreview2, _Plugin);
18
+ var _super = _createSuper(ProgressPreview2);
19
+ function ProgressPreview2(args) {
20
+ var _this;
21
+ _classCallCheck(this, ProgressPreview2);
22
+ _this = _super.call(this, args);
23
+ _defineProperty(_assertThisInitialized(_this), "onMousemove", function(e) {
24
+ if (_this.config.disable) {
25
+ return;
26
+ }
27
+ if (util.hasClass(e.target, "xg-spot-content") && _this.config.isHideThumbnailHover) {
28
+ _this.player.plugins.progress.onMouseLeave(e);
29
+ return;
30
+ }
31
+ if (_this._state.f || util.hasClass(e.target, "xg-spot-content")) {
32
+ util.event(e);
33
+ e.stopPropagation();
34
+ }
35
+ });
36
+ _defineProperty(_assertThisInitialized(_this), "onMousedown", function(e) {
37
+ if (_this.config.disable) {
38
+ return;
39
+ }
40
+ if (_this._state.f || util.hasClass(e.target, "xg-spot-content")) {
41
+ util.event(e);
42
+ e.stopPropagation();
43
+ }
44
+ });
45
+ _defineProperty(_assertThisInitialized(_this), "onMouseup", function(e) {
46
+ if (!_this.isDrag) {
47
+ return;
48
+ }
49
+ var progress = _this.player.plugins.progress;
50
+ if (progress && progress.pos) {
51
+ progress.onMouseUp(e);
52
+ !progress.pos.isEnter && progress.onMouseLeave(e);
53
+ }
54
+ });
55
+ _defineProperty(_assertThisInitialized(_this), "onDotMouseLeave", function(e) {
56
+ if (_this.config.disable) {
57
+ return;
58
+ }
59
+ _this._curDot.removeEventListener("mouseleave", _this.onDotMouseLeave);
60
+ _this.blurDot(e.target);
61
+ _this._curDot = null;
62
+ var progress = _this.player.plugins.progress;
63
+ progress && progress.enableBlur();
64
+ _this.show();
65
+ });
66
+ _defineProperty(_assertThisInitialized(_this), "onProgressMouseOver", function(data, e) {
67
+ if (_this.config.disable) {
68
+ return;
69
+ }
70
+ if (util.hasClass(e.target, "xgplayer-spot") && !_this._curDot) {
71
+ _this._curDot = e.target;
72
+ _this.focusDot(e.target);
73
+ if (_this._curDot.children.length > 0) {
74
+ _this.hide();
75
+ }
76
+ var progress = _this.player.plugins.progress;
77
+ progress && progress.disableBlur();
78
+ _this._curDot.addEventListener("mouseleave", _this.onDotMouseLeave);
79
+ }
80
+ });
81
+ _this._ispots = [];
82
+ _this.videoPreview = null;
83
+ _this.videothumbnail = null;
84
+ _this.thumbnail = null;
85
+ _this.timeStr = "";
86
+ _this._state = {
87
+ now: 0,
88
+ f: false
89
+ };
90
+ return _this;
91
+ }
92
+ _createClass(ProgressPreview2, [{
93
+ key: "beforeCreate",
94
+ value: function beforeCreate(args) {
95
+ var progress = args.player.plugins.progress;
96
+ if (progress) {
97
+ args.root = progress.root;
98
+ }
99
+ }
100
+ }, {
101
+ key: "afterCreate",
102
+ value: function afterCreate() {
103
+ var _this2 = this;
104
+ this._curDot = null;
105
+ this.handlerSpotClick = this.hook("spotClick", function(_event, data) {
106
+ if (data.seekTime) {
107
+ _this2.player.seek(data.seekTime);
108
+ }
109
+ });
110
+ this.transformTimeHook = this.hook("transformTime", function(time) {
111
+ _this2.setTimeContent(time);
112
+ });
113
+ initDotsAPI(this);
114
+ this.on(DURATION_CHANGE, function() {
115
+ _this2.show();
116
+ });
117
+ if (this.config.disable) {
118
+ this.disable();
119
+ }
120
+ this.extTextRoot = this.find(".xg-spot-ext-text");
121
+ }
122
+ }, {
123
+ key: "setConfig",
124
+ value: function setConfig(config) {
125
+ var _this3 = this;
126
+ if (!config) {
127
+ return;
128
+ }
129
+ Object.keys(config).map(function(key) {
130
+ _this3.config[key] = config[key];
131
+ });
132
+ }
133
+ }, {
134
+ key: "onPluginsReady",
135
+ value: function onPluginsReady() {
136
+ var player = this.player;
137
+ if (!player.plugins.progress) {
138
+ return;
139
+ }
140
+ this.previewLine = this.find(".xg-spot-line");
141
+ this.timePoint = this.find(".xgplayer-progress-point");
142
+ this.timeText = this.find(".xg-spot-time");
143
+ this.tipText = this.find(".spot-inner-text");
144
+ this._hasThumnail = false;
145
+ this.registerThumbnail();
146
+ this.bindEvents();
147
+ }
148
+ }, {
149
+ key: "bindEvents",
150
+ value: function bindEvents() {
151
+ var _this4 = this;
152
+ var progress = this.player.plugins.progress;
153
+ if (!progress) {
154
+ return;
155
+ }
156
+ Object.keys(CALLBACK_MAP).map(function(key) {
157
+ _this4[CALLBACK_MAP[key]] = _this4[CALLBACK_MAP[key]].bind(_this4);
158
+ progress.addCallBack(key, _this4[CALLBACK_MAP[key]]);
159
+ });
160
+ if (sniffer.device === "mobile")
161
+ return;
162
+ this.bind(".xg-spot-info", "mousemove", this.onMousemove);
163
+ this.bind(".xg-spot-info", "mousedown", this.onMousedown);
164
+ this.bind(".xg-spot-info", "mouseup", this.onMouseup);
165
+ var fun = this.hook("previewClick", function() {
166
+ });
167
+ this.handlerPreviewClick = function(e) {
168
+ e.stopPropagation();
169
+ fun(parseInt(_this4._state.now * 1e3, 10) / 1e3, e);
170
+ };
171
+ this.bind(".xg-spot-content", "mouseup", this.handlerPreviewClick);
172
+ }
173
+ }, {
174
+ key: "onProgressMove",
175
+ value: function onProgressMove(data, e) {
176
+ if (this.config.disable || !this.player.duration) {
177
+ return;
178
+ }
179
+ this.updatePosition(data.offset, data.width, data.currentTime, data.e);
180
+ }
181
+ }, {
182
+ key: "onProgressDragStart",
183
+ value: function onProgressDragStart(data) {
184
+ if (this.config.disable || !this.player.duration) {
185
+ return;
186
+ }
187
+ this.isDrag = true;
188
+ this.videoPreview && util.addClass(this.videoPreview, "show");
189
+ }
190
+ }, {
191
+ key: "onProgressDragEnd",
192
+ value: function onProgressDragEnd(data) {
193
+ if (this.config.disable || !this.player.duration) {
194
+ return;
195
+ }
196
+ this.isDrag = false;
197
+ this.videoPreview && util.removeClass(this.videoPreview, "show");
198
+ }
199
+ }, {
200
+ key: "onProgressClick",
201
+ value: function onProgressClick(data, e) {
202
+ if (this.config.disable) {
203
+ return;
204
+ }
205
+ if (util.hasClass(e.target, "xgplayer-spot")) {
206
+ e.stopPropagation();
207
+ e.preventDefault();
208
+ ["time", "id", "text"].map(function(key) {
209
+ data[key] = e.target.getAttribute("data-".concat(key));
210
+ });
211
+ data.time && (data.time = Number(data.time));
212
+ this.handlerSpotClick(e, data);
213
+ }
214
+ }
215
+ }, {
216
+ key: "updateLinePos",
217
+ value: function updateLinePos(offset, cwidth) {
218
+ var root = this.root, previewLine = this.previewLine, player = this.player, config = this.config;
219
+ var mode = player.controls.mode;
220
+ var isflex = mode === "flex";
221
+ var lwidth = root.getBoundingClientRect().width;
222
+ if (!lwidth && this._hasThumnail) {
223
+ return;
224
+ }
225
+ lwidth = this._hasThumnail && lwidth < config.width ? config.width : lwidth;
226
+ var x = offset - lwidth / 2;
227
+ var _t;
228
+ if (x < 0 && !isflex) {
229
+ x = 0;
230
+ _t = offset - lwidth / 2;
231
+ } else if (x > cwidth - lwidth && !isflex) {
232
+ _t = x - (cwidth - lwidth);
233
+ x = cwidth - lwidth;
234
+ } else {
235
+ _t = 0;
236
+ }
237
+ _t !== void 0 && (previewLine.style.transform = "translateX(".concat(_t.toFixed(2), "px)"));
238
+ root.style.transform = "translateX(".concat(x.toFixed(2), "px) translateZ(0)");
239
+ }
240
+ }, {
241
+ key: "updateTimeText",
242
+ value: function updateTimeText(timeStr) {
243
+ var timeText = this.timeText, timePoint = this.timePoint;
244
+ timeText.innerHTML = timeStr;
245
+ !this.thumbnail && (timePoint.innerHTML = timeStr);
246
+ }
247
+ }, {
248
+ key: "updatePosition",
249
+ value: function updatePosition(offset, cwidth, time, e) {
250
+ var root = this.root, config = this.config, _state = this._state;
251
+ if (!root) {
252
+ return;
253
+ }
254
+ _state.now = time;
255
+ this.transformTimeHook(time);
256
+ var timeStr = this.timeStr;
257
+ if (e && e.target && util.hasClass(e.target, "xgplayer-spot")) {
258
+ this.showTips(e.target.getAttribute("data-text"), false, timeStr);
259
+ this.focusDot(e.target);
260
+ _state.f = true;
261
+ config.isFocusDots && _state.f && (_state.now = parseInt(e.target.getAttribute("data-time"), 10));
262
+ } else if (config.defaultText) {
263
+ _state.f = false;
264
+ this.showTips(config.defaultText, true, timeStr);
265
+ } else {
266
+ _state.f = false;
267
+ this.hideTips("");
268
+ }
269
+ this.updateTimeText(timeStr);
270
+ this.updateThumbnails(_state.now);
271
+ this.updateLinePos(offset, cwidth);
272
+ }
273
+ }, {
274
+ key: "setTimeContent",
275
+ value: function setTimeContent(time) {
276
+ this.timeStr = "".concat(util.format(time));
277
+ }
278
+ }, {
279
+ key: "updateThumbnails",
280
+ value: function updateThumbnails(time) {
281
+ var player = this.player, videoPreview = this.videoPreview, config = this.config;
282
+ var thumbnail = player.plugins.thumbnail;
283
+ if (thumbnail && thumbnail.usable) {
284
+ this.thumbnail && thumbnail.update(this.thumbnail, time, config.width, config.height);
285
+ var rect = videoPreview && videoPreview.getBoundingClientRect();
286
+ this.videothumbnail && thumbnail.update(this.videothumbnail, time, rect.width, rect.height);
287
+ }
288
+ }
289
+ }, {
290
+ key: "registerThumbnail",
291
+ value: function registerThumbnail() {
292
+ var thumbnailConfig = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
293
+ if (sniffer.device === "mobile") {
294
+ return;
295
+ }
296
+ var player = this.player, config = this.config;
297
+ var thumbnail = player.getPlugin("thumbnail");
298
+ if (thumbnail) {
299
+ thumbnail.setConfig(thumbnailConfig);
300
+ }
301
+ if (!thumbnail || !thumbnail.usable || !config.isShowThumbnail) {
302
+ util.addClass(this.root, "short-line no-thumbnail");
303
+ return;
304
+ } else {
305
+ util.removeClass(this.root, "short-line no-thumbnail");
306
+ }
307
+ if (config.mode === "short") {
308
+ util.addClass(this.root, "short-line");
309
+ }
310
+ this._hasThumnail = true;
311
+ var tRoot = this.find(".xg-spot-thumbnail");
312
+ this.thumbnail = thumbnail.createThumbnail(tRoot, "progress-thumbnail");
313
+ if (config.isShowCoverPreview) {
314
+ this.videoPreview = util.createDom("xg-video-preview", "", {}, "xgvideo-preview");
315
+ player.root.appendChild(this.videoPreview);
316
+ this.videothumbnail = thumbnail.createThumbnail(this.videoPreview, "xgvideo-thumbnail");
317
+ }
318
+ this.updateThumbnails(0);
319
+ }
320
+ }, {
321
+ key: "calcuPosition",
322
+ value: function calcuPosition(time, duration) {
323
+ var progress = this.player.plugins.progress;
324
+ var player = this.player;
325
+ var totalWidth = progress.root.getBoundingClientRect().width;
326
+ var widthPerSeconds = player.duration / totalWidth * 6;
327
+ if (time + duration > player.duration) {
328
+ duration = player.duration - time;
329
+ }
330
+ time / player.duration * 100;
331
+ duration / player.duration;
332
+ return {
333
+ left: time / player.duration * 100,
334
+ width: duration / player.duration * 100,
335
+ isMini: duration < widthPerSeconds
336
+ };
337
+ }
338
+ }, {
339
+ key: "showDot",
340
+ value: function showDot(id) {
341
+ var dot = this.findDot(id);
342
+ if (dot) {
343
+ var rect = this.root.getBoundingClientRect();
344
+ var width = rect.width;
345
+ var offset = dot.time / this.player.duration * width;
346
+ this.updatePosition(offset, width, dot.time);
347
+ }
348
+ }
349
+ }, {
350
+ key: "focusDot",
351
+ value: function focusDot(target, id) {
352
+ if (!target) {
353
+ return;
354
+ }
355
+ if (!id) {
356
+ id = target.getAttribute("data-id");
357
+ }
358
+ util.addClass(target, "active");
359
+ this._activeDotId = id;
360
+ }
361
+ }, {
362
+ key: "blurDot",
363
+ value: function blurDot(target) {
364
+ if (!target) {
365
+ var id = this._activeDotId;
366
+ target = this.getDotDom(id);
367
+ }
368
+ if (!target) {
369
+ return;
370
+ }
371
+ util.removeClass(target, "active");
372
+ this._activeDotId = null;
373
+ }
374
+ }, {
375
+ key: "showTips",
376
+ value: function showTips(text, isDefault) {
377
+ var timeStr = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
378
+ util.addClass(this.root, "no-timepoint");
379
+ if (!text) {
380
+ return;
381
+ }
382
+ util.addClass(this.find(".xg-spot-content"), "show-text");
383
+ if (isDefault && this.config.mode === "production") {
384
+ util.addClass(this.root, "product");
385
+ this.tipText.textContent = text;
386
+ } else {
387
+ util.removeClass(this.root, "product");
388
+ this.tipText.textContent = this._hasThumnail ? text : "".concat(timeStr, " ").concat(text);
389
+ }
390
+ }
391
+ }, {
392
+ key: "hideTips",
393
+ value: function hideTips() {
394
+ util.removeClass(this.root, "no-timepoint");
395
+ this.tipText.textContent = "";
396
+ util.removeClass(this.find(".xg-spot-content"), "show-text");
397
+ util.removeClass(this.root, "product");
398
+ }
399
+ }, {
400
+ key: "hide",
401
+ value: function hide() {
402
+ util.addClass(this.root, "hide");
403
+ }
404
+ }, {
405
+ key: "show",
406
+ value: function show() {
407
+ util.removeClass(this.root, "hide");
408
+ }
409
+ }, {
410
+ key: "enable",
411
+ value: function enable() {
412
+ var config = this.config, playerConfig = this.playerConfig;
413
+ this.config.disable = false;
414
+ this.show();
415
+ if (!this.thumbnail && config.isShowThumbnail) {
416
+ this.registerThumbnail(playerConfig.thumbnail || {});
417
+ }
418
+ }
419
+ }, {
420
+ key: "disable",
421
+ value: function disable() {
422
+ this.config.disable = true;
423
+ this.hide();
424
+ }
425
+ }, {
426
+ key: "destroy",
427
+ value: function destroy() {
428
+ var _this5 = this;
429
+ var progress = this.player.plugins.progress;
430
+ progress && Object.keys(CALLBACK_MAP).map(function(key) {
431
+ progress.removeCallBack(key, _this5[CALLBACK_MAP[key]]);
432
+ });
433
+ this.videothumbnail = null;
434
+ this.thumbnail = null;
435
+ this.videoPreview && this.player.root.removeChild(this.videoPreview);
436
+ this.unbind(".xg-spot-info", "mousemove", this.onMousemove);
437
+ this.unbind(".xg-spot-info", "mousedown", this.onMousedown);
438
+ this.unbind(".xg-spot-info", "mouseup", this.onMouseup);
439
+ this.unbind(".xg-spot-content", "mouseup", this.handlerPreviewClick);
440
+ }
441
+ }, {
442
+ key: "render",
443
+ value: function render() {
444
+ if (sniffer.device === "mobile" || this.playerConfig.isMobileSimulateMode === "mobile") {
445
+ return "";
446
+ }
447
+ return '<div class="xg-spot-info hide '.concat(this.config.mode === "short" ? "short-line" : "", '">\n <div class="xg-spot-content">\n <div class="xg-spot-thumbnail">\n <span class="xg-spot-time"></span>\n </div>\n <div class="xg-spot-text"><span class="spot-inner-text"></span></div>\n </div>\n <div class="xgplayer-progress-point">00:00</div>\n <div class="xg-spot-ext-text"></div>\n <div class="xg-spot-line"></div>\n </div>');
448
+ }
449
+ }], [{
450
+ key: "pluginName",
451
+ get: function get() {
452
+ return "progresspreview";
453
+ }
454
+ }, {
455
+ key: "defaultConfig",
456
+ get: function get() {
457
+ return {
458
+ index: 1,
459
+ miniWidth: 6,
460
+ ispots: [],
461
+ defaultText: "",
462
+ isFocusDots: true,
463
+ isHideThumbnailHover: true,
464
+ isShowThumbnail: true,
465
+ isShowCoverPreview: false,
466
+ mode: "",
467
+ disable: false,
468
+ width: 160,
469
+ height: 90
470
+ };
471
+ }
472
+ }]);
473
+ return ProgressPreview2;
474
+ }(Plugin);
475
+ export { ProgressPreview as default };
@@ -0,0 +1,235 @@
1
+ $bottom: -7px;
2
+ $shortBottom: -4px;
3
+ .xgplayer {
4
+ .xgplayer-spot {
5
+ position: absolute;
6
+ // z-index: 10;
7
+ top: 0;
8
+ left: 0;
9
+ height: 100%;
10
+ // min-width: 6px;
11
+ background: #fff;
12
+ border-radius: 12px;
13
+ &.mini {
14
+ min-width: 6px;
15
+ transform: translate(-50%, 0);
16
+ }
17
+ &.active {
18
+ .xgplayer-spot-pop {
19
+ display: block;
20
+ opacity: 1;
21
+ pointer-events: initial;
22
+ }
23
+ }
24
+ }
25
+ .xgplayer-spot-pop {
26
+ display: block;
27
+ opacity: 0;
28
+ pointer-events: none;
29
+ position: absolute;
30
+ left: 50%;
31
+ bottom: 5px;
32
+ padding-bottom: 5px;
33
+ transform: translateX(-50%);
34
+ }
35
+
36
+ @at-root.xgplayer-mobile {
37
+ .xgplayer-spot {
38
+ height: 3px;
39
+ min-width: 3px;
40
+ top: 50%;
41
+ opacity: 1;
42
+ transform: translate(0, -50%);
43
+ &.mini {
44
+ min-width: 3px;
45
+ transform: translate(-50%, -50%);
46
+ }
47
+ }
48
+ }
49
+
50
+ .xgplayer-progress.active {
51
+ .xgplayer-spot {
52
+ opacity: 1;
53
+ transition: opacity .3s;
54
+ visibility: visible;
55
+ }
56
+ }
57
+
58
+ /** xg-spot-info start**/
59
+ .xg-spot-info {
60
+ position: absolute;
61
+ left: 0;
62
+ bottom: 100%;
63
+ // visibility: hidden;
64
+ // opacity: 0;
65
+ display: none;
66
+ &.short-line {
67
+ .xg-spot-line{
68
+ height: 6px;
69
+ }
70
+ .xg-spot-content {
71
+ bottom: $shortBottom;
72
+ }
73
+ }
74
+ &.no-thumbnail {
75
+ .xg-spot-thumbnail {
76
+ display: none;
77
+ }
78
+ .xgplayer-progress-point {
79
+ display: block;
80
+ }
81
+ }
82
+ &.no-timepoint {
83
+ .xgplayer-progress-point {
84
+ display: none;
85
+ }
86
+ }
87
+ &.hide {
88
+ display: none;
89
+ }
90
+ }
91
+
92
+ .xgplayer-progress.active {
93
+ .xg-spot-info {
94
+ // opacity: 1;
95
+ // visibility: visible;
96
+ // transition: opacity .3s;
97
+ display: block;
98
+ &.hide {
99
+ display: none;
100
+ }
101
+ }
102
+ }
103
+
104
+ .xg-spot-line {
105
+ position: relative;
106
+ bottom: $bottom;
107
+ margin-left: 50%;
108
+ display: block;
109
+ width: 1px;
110
+ height: 41px;
111
+ background-color: #FFF;
112
+ pointer-events: none;
113
+ }
114
+
115
+ /* 时间预览样式 */
116
+ .xgplayer-progress-point {
117
+ display: none;
118
+ position: relative;
119
+ bottom: $shortBottom;
120
+ left: 50%;
121
+ transform: translateX(-50%);
122
+ background:rgba(0, 0, 0, 0.54);
123
+ font-size: 11px;
124
+ color: #fff;
125
+ padding: 4px 6px;
126
+ border-radius: 4px;
127
+ text-align: center;
128
+ opacity: 0.85;
129
+ white-space: nowrap;
130
+ }
131
+
132
+ .xg-spot-content {
133
+ position: relative;
134
+ // width: 160px;
135
+ bottom: $bottom;
136
+ color: #fff;
137
+ border-radius: 2px 2px 0px 0px;
138
+ }
139
+
140
+ .xg-spot-ext-text {
141
+ position: relative;
142
+ bottom: $bottom;
143
+ }
144
+
145
+ .xg-spot-thumbnail {
146
+ position: relative;
147
+ // width: 160px;
148
+ background-color: rgba(17, 16, 16, 1);
149
+ pointer-events: none;
150
+ border-radius: 2px 2px 0 0;
151
+ }
152
+
153
+ .xg-spot-time {
154
+ position: absolute;
155
+ left: 50%;
156
+ bottom: 2px;
157
+ font-size: 12px;
158
+ line-height: 16.8px;
159
+ left: 50%;
160
+ transform: translateX(-50%);
161
+ pointer-events: none;
162
+ }
163
+
164
+ .progress-thumbnail {
165
+ margin: 0 auto;
166
+ display: block;
167
+ }
168
+
169
+ .xg-spot-text {
170
+ display: none;
171
+ // width: 160px;
172
+ padding: 5px 8px;
173
+ background: rgba(0, 0, 0, 0.8);
174
+ border-radius: 0px 0px 2px 2px;
175
+ pointer-events: none;
176
+ box-sizing: border-box;
177
+ }
178
+
179
+ .spot-inner-text {
180
+ overflow: hidden;
181
+ text-overflow: ellipsis;
182
+ display: -webkit-box;
183
+ -webkit-line-clamp: 2;
184
+ -webkit-box-orient: vertical;
185
+ line-height: 20px;
186
+ font-size: 12px;
187
+ max-height: 40px;
188
+ }
189
+
190
+ .xg-spot-content.show-text {
191
+ .xg-spot-text {
192
+ display: block;
193
+ }
194
+ }
195
+
196
+ .product {
197
+ .xg-spot-text {
198
+ background: #3370FF;
199
+ }
200
+ .xg-spot-line {
201
+ border-left: 10px solid transparent;
202
+ border-right: 10px solid transparent;
203
+ border-top: 7px solid #3370FF;
204
+ width: 0;
205
+ height: 15px;
206
+ left: -10px;
207
+ background: none;
208
+ }
209
+ }
210
+
211
+ /** xg-spot-info end**/
212
+
213
+ .xgvideo-preview {
214
+ position: absolute;
215
+ width: 100%;
216
+ height: 100%;
217
+ top: 0;
218
+ left: 0;
219
+ opacity: 0;
220
+ visibility: hidden;
221
+ transition: visibility .3s, opacity .3s;
222
+ background-color: #000;
223
+ .xgvideo-thumbnail {
224
+ position: relative;
225
+ top: 50%;
226
+ left: 50%;
227
+ transform: translate(-50%, -50%);
228
+ border-radius: 0;
229
+ }
230
+ &.show {
231
+ opacity: 1;
232
+ visibility: visible;
233
+ }
234
+ }
235
+ }