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,631 @@
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, CANPLAY, ENDED } from "../../events.js";
5
+ import "../../utils/debug.js";
6
+ import { runHooks } from "../../plugin/hooksDescriptor.js";
7
+ import Plugin from "../../plugin/plugin.js";
8
+ import { STATES } from "../../state.js";
9
+ import Touche from "./touch.js";
10
+ import SeekTipIcon from "../assets/seekicon.js";
11
+ var ACTIONS = {
12
+ AUTO: "auto",
13
+ SEEKING: "seeking",
14
+ PLAYBACK: "playbackrate",
15
+ LIGHT: ""
16
+ };
17
+ var HOOKS = ["videoClick", "videoDbClick"];
18
+ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
19
+ _inherits(MobilePlugin2, _Plugin);
20
+ var _super = _createSuper(MobilePlugin2);
21
+ function MobilePlugin2(options) {
22
+ var _this;
23
+ _classCallCheck(this, MobilePlugin2);
24
+ _this = _super.call(this, options);
25
+ _defineProperty(_assertThisInitialized(_this), "onTouchStart", function(e) {
26
+ var _assertThisInitialize = _assertThisInitialized(_this), player = _assertThisInitialize.player, config = _assertThisInitialize.config, pos = _assertThisInitialize.pos, playerConfig = _assertThisInitialize.playerConfig;
27
+ var touche = _this.getTouche(e);
28
+ if (touche && !config.disableGesture && _this.duration > 0 && !player.ended) {
29
+ pos.isStart = true;
30
+ util.checkIsFunction(playerConfig.disableSwipeHandler) && playerConfig.disableSwipeHandler();
31
+ _this.find(".xg-dur").innerHTML = util.format(_this.duration);
32
+ var rect = _this.root.getBoundingClientRect();
33
+ if (player.rotateDeg === 90) {
34
+ pos.top = rect.left;
35
+ pos.left = rect.top;
36
+ pos.width = rect.height;
37
+ pos.height = rect.width;
38
+ } else {
39
+ pos.top = rect.top;
40
+ pos.left = rect.left;
41
+ pos.width = rect.width;
42
+ pos.height = rect.height;
43
+ }
44
+ var _x = parseInt(touche.pageX - pos.left, 10);
45
+ var _y = parseInt(touche.pageY - pos.top, 10);
46
+ pos.x = player.rotateDeg === 90 ? _y : _x;
47
+ pos.y = player.rotateDeg === 90 ? _x : _y;
48
+ pos.scopeL = config.scopeL * pos.width;
49
+ pos.scopeR = (1 - config.scopeR) * pos.width;
50
+ pos.scopeM1 = pos.width * (1 - config.scopeM) / 2;
51
+ pos.scopeM2 = pos.width - pos.scopeM1;
52
+ }
53
+ });
54
+ _defineProperty(_assertThisInitialized(_this), "onTouchMove", function(e) {
55
+ var touche = _this.getTouche(e);
56
+ var _assertThisInitialize2 = _assertThisInitialized(_this), pos = _assertThisInitialize2.pos, config = _assertThisInitialize2.config, player = _assertThisInitialize2.player;
57
+ if (!touche || config.disableGesture || !_this.duration || !pos.isStart) {
58
+ return;
59
+ }
60
+ var miniMoveStep = config.miniMoveStep, hideControlsActive = config.hideControlsActive;
61
+ var _x = parseInt(touche.pageX - pos.left, 10);
62
+ var _y = parseInt(touche.pageY - pos.top, 10);
63
+ var x = player.rotateDeg === 90 ? _y : _x;
64
+ var y = player.rotateDeg === 90 ? _x : _y;
65
+ if (Math.abs(x - pos.x) > miniMoveStep || Math.abs(y - pos.y) > miniMoveStep) {
66
+ var diffx = x - pos.x;
67
+ var diffy = y - pos.y;
68
+ var scope = pos.scope;
69
+ if (scope === -1) {
70
+ scope = _this.checkScope(x, y, diffx, diffy, pos);
71
+ if (scope === 0) {
72
+ !hideControlsActive ? player.focus({
73
+ autoHide: false
74
+ }) : player.blur();
75
+ !pos.time && (pos.time = parseInt(player.currentTime * 1e3, 10) + _this.timeOffset * 1e3);
76
+ }
77
+ pos.scope = scope;
78
+ }
79
+ if (scope === -1 || scope > 0 && !config.gestureY || scope === 0 && !config.gestureX) {
80
+ return;
81
+ }
82
+ e.cancelable && e.preventDefault();
83
+ _this.executeMove(diffx, diffy, scope, pos.width, pos.height);
84
+ pos.x = x;
85
+ pos.y = y;
86
+ }
87
+ });
88
+ _defineProperty(_assertThisInitialized(_this), "onTouchEnd", function(e) {
89
+ var _assertThisInitialize3 = _assertThisInitialized(_this), player = _assertThisInitialize3.player, pos = _assertThisInitialize3.pos, playerConfig = _assertThisInitialize3.playerConfig;
90
+ if (!pos.isStart) {
91
+ return;
92
+ }
93
+ if (pos.scope > -1) {
94
+ e.cancelable && e.preventDefault();
95
+ }
96
+ var _this$config = _this.config, disableGesture = _this$config.disableGesture, gestureX = _this$config.gestureX;
97
+ if (!disableGesture && gestureX) {
98
+ _this.endLastMove(pos.scope);
99
+ setTimeout(function() {
100
+ player.getPlugin("progress") && player.getPlugin("progress").resetSeekState();
101
+ }, 10);
102
+ } else {
103
+ pos.time = 0;
104
+ }
105
+ pos.scope = -1;
106
+ _this.resetPos();
107
+ util.checkIsFunction(playerConfig.enableSwipeHandler) && playerConfig.enableSwipeHandler();
108
+ _this.changeAction(ACTIONS.AUTO);
109
+ });
110
+ _defineProperty(_assertThisInitialized(_this), "onRootTouchMove", function(e) {
111
+ if (_this.config.disableGesture || !_this.config.gestureX) {
112
+ return;
113
+ }
114
+ if (_this.checkIsRootTarget(e)) {
115
+ e.stopPropagation();
116
+ if (!_this.pos.isStart) {
117
+ _this.onTouchStart(e);
118
+ } else {
119
+ _this.onTouchMove(e);
120
+ }
121
+ }
122
+ });
123
+ _defineProperty(_assertThisInitialized(_this), "onRootTouchEnd", function(e) {
124
+ if (_this.pos.isStart && _this.checkIsRootTarget(e)) {
125
+ e.stopPropagation();
126
+ _this.onTouchEnd(e);
127
+ }
128
+ });
129
+ _this.pos = {
130
+ isStart: false,
131
+ x: 0,
132
+ y: 0,
133
+ time: 0,
134
+ volume: 0,
135
+ rate: 1,
136
+ light: 0,
137
+ width: 0,
138
+ height: 0,
139
+ scopeL: 0,
140
+ scopeR: 0,
141
+ scopeM1: 0,
142
+ scopeM2: 0,
143
+ scope: -1
144
+ };
145
+ _this.timer = null;
146
+ return _this;
147
+ }
148
+ _createClass(MobilePlugin2, [{
149
+ key: "duration",
150
+ get: function get() {
151
+ return this.playerConfig.customDuration || this.player.duration;
152
+ }
153
+ }, {
154
+ key: "timeOffset",
155
+ get: function get() {
156
+ return this.playerConfig.timeOffset || 0;
157
+ }
158
+ }, {
159
+ key: "registerIcons",
160
+ value: function registerIcons() {
161
+ return {
162
+ seekTipIcon: {
163
+ icon: SeekTipIcon,
164
+ class: "xg-seek-pre"
165
+ }
166
+ };
167
+ }
168
+ }, {
169
+ key: "afterCreate",
170
+ value: function afterCreate() {
171
+ var _this2 = this;
172
+ HOOKS.map(function(item) {
173
+ _this2.__hooks[item] = null;
174
+ });
175
+ var playerConfig = this.playerConfig, config = this.config, player = this.player;
176
+ if (playerConfig.closeVideoDblclick === true) {
177
+ config.closedbClick = true;
178
+ }
179
+ this.resetPos();
180
+ if (!util.isUndefined(playerConfig.disableGesture)) {
181
+ config.disableGesture = !!playerConfig.disableGesture;
182
+ }
183
+ this.appendChild(".xg-seek-icon", this.icons.seekTipIcon);
184
+ this.xgMask = util.createDom("xg-mask", "", {}, "xgmask");
185
+ player.root.appendChild(this.xgMask);
186
+ this.initCustomStyle();
187
+ this.registerThumbnail();
188
+ var eventType = this.domEventType === "mouse" ? "mouse" : "touch";
189
+ this.touch = new Touche(this.root, {
190
+ eventType,
191
+ needPreventDefault: !this.config.disableGesture
192
+ });
193
+ this.root.addEventListener("contextmenu", function(e) {
194
+ e.preventDefault();
195
+ });
196
+ player.root.addEventListener("touchmove", this.onRootTouchMove, true);
197
+ player.root.addEventListener("touchend", this.onRootTouchEnd, true);
198
+ this.on(DURATION_CHANGE, function() {
199
+ var player2 = _this2.player, config2 = _this2.config;
200
+ if (player2.duration * 1e3 < config2.moveDuration) {
201
+ config2.moveDuration = player2.duration * 1e3;
202
+ }
203
+ });
204
+ this.on([CANPLAY, ENDED], function() {
205
+ var _this2$pos = _this2.pos, time = _this2$pos.time, isStart = _this2$pos.isStart;
206
+ if (!isStart && time > 0) {
207
+ _this2.pos.time = 0;
208
+ }
209
+ });
210
+ var eventsMap = {
211
+ touchstart: "onTouchStart",
212
+ touchmove: "onTouchMove",
213
+ touchend: "onTouchEnd",
214
+ press: "onPress",
215
+ pressend: "onPressEnd",
216
+ click: "onClick",
217
+ doubleclick: "onDbClick"
218
+ };
219
+ Object.keys(eventsMap).map(function(key) {
220
+ _this2.touch.on(key, function(e) {
221
+ _this2[eventsMap[key]](e);
222
+ });
223
+ });
224
+ if (!config.disableActive) {
225
+ var progressPlugin = player.plugins.progress;
226
+ if (progressPlugin) {
227
+ progressPlugin.addCallBack("dragmove", function(data) {
228
+ _this2.activeSeekNote(data.currentTime, data.forward);
229
+ });
230
+ progressPlugin.addCallBack("dragend", function() {
231
+ _this2.changeAction(ACTIONS.AUTO);
232
+ });
233
+ }
234
+ }
235
+ }
236
+ }, {
237
+ key: "registerThumbnail",
238
+ value: function registerThumbnail() {
239
+ var player = this.player;
240
+ var thumbnail = player.plugins.thumbnail;
241
+ if (thumbnail && thumbnail.usable) {
242
+ this.thumbnail = thumbnail.createThumbnail(null, "mobile-thumbnail");
243
+ var timePreview = this.find(".time-preview");
244
+ timePreview.insertBefore(this.thumbnail, timePreview.children[0]);
245
+ }
246
+ }
247
+ }, {
248
+ key: "initCustomStyle",
249
+ value: function initCustomStyle() {
250
+ var _ref = this.playerConfig || {}, commonStyle = _ref.commonStyle;
251
+ var playedColor = commonStyle.playedColor, progressColor = commonStyle.progressColor;
252
+ if (playedColor) {
253
+ this.find(".xg-curbar").style.backgroundColor = playedColor;
254
+ this.find(".xg-cur").style.color = playedColor;
255
+ }
256
+ if (progressColor) {
257
+ this.find(".xg-bar").style.backgroundColor = progressColor;
258
+ this.find(".time-preview").style.color = progressColor;
259
+ }
260
+ this.config.disableTimeProgress && util.addClass(this.find(".xg-timebar"), "hide");
261
+ }
262
+ }, {
263
+ key: "resetPos",
264
+ value: function resetPos() {
265
+ var _this3 = this;
266
+ if (this.pos) {
267
+ this.pos.isStart = false;
268
+ this.pos.scope = -1;
269
+ ["x", "y", "width", "height", "scopeL", "scopeR", "scopeM1", "scopeM2"].map(function(item) {
270
+ _this3.pos[item] = 0;
271
+ });
272
+ } else {
273
+ this.pos = {
274
+ isStart: false,
275
+ x: 0,
276
+ y: 0,
277
+ volume: 0,
278
+ rate: 1,
279
+ light: 0,
280
+ width: 0,
281
+ height: 0,
282
+ scopeL: 0,
283
+ scopeR: 0,
284
+ scopeM1: 0,
285
+ scopeM2: 0,
286
+ scope: -1,
287
+ time: 0
288
+ };
289
+ }
290
+ }
291
+ }, {
292
+ key: "changeAction",
293
+ value: function changeAction(action) {
294
+ var player = this.player, root = this.root;
295
+ root.setAttribute("data-xg-action", action);
296
+ var startPlugin = player.plugins.start;
297
+ startPlugin && startPlugin.recover();
298
+ }
299
+ }, {
300
+ key: "getTouche",
301
+ value: function getTouche(e) {
302
+ var rotateDeg = this.player.rotateDeg;
303
+ var touche = e.touches && e.touches.length > 0 ? e.touches[e.touches.length - 1] : e;
304
+ return rotateDeg === 0 ? {
305
+ pageX: touche.pageX,
306
+ pageY: touche.pageY
307
+ } : {
308
+ pageX: touche.pageX,
309
+ pageY: touche.pageY
310
+ };
311
+ }
312
+ }, {
313
+ key: "checkScope",
314
+ value: function checkScope(x, y, diffx, diffy, pos) {
315
+ var width = pos.width;
316
+ var scope = -1;
317
+ if (x < 0 || x > width) {
318
+ return scope;
319
+ }
320
+ var mold = diffy === 0 ? Math.abs(diffx) : Math.abs(diffx / diffy);
321
+ if (Math.abs(diffx) > 0 && mold >= 1.73 && x > pos.scopeM1 && x < pos.scopeM2) {
322
+ scope = 0;
323
+ } else if (Math.abs(diffx) === 0 || mold <= 0.57) {
324
+ scope = x < pos.scopeL ? 1 : x > pos.scopeR ? 2 : 3;
325
+ }
326
+ return scope;
327
+ }
328
+ }, {
329
+ key: "executeMove",
330
+ value: function executeMove(diffx, diffy, scope, width, height) {
331
+ switch (scope) {
332
+ case 0:
333
+ this.updateTime(diffx / width * this.config.scopeM);
334
+ break;
335
+ case 1:
336
+ this.updateBrightness(diffy / height);
337
+ break;
338
+ case 2:
339
+ if (!sniffer.os.isIos) {
340
+ this.updateVolume(diffy / height);
341
+ }
342
+ break;
343
+ }
344
+ }
345
+ }, {
346
+ key: "endLastMove",
347
+ value: function endLastMove(lastScope) {
348
+ var _this4 = this;
349
+ var pos = this.pos, player = this.player, config = this.config;
350
+ var time = (pos.time - this.timeOffset) / 1e3;
351
+ switch (lastScope) {
352
+ case 0:
353
+ player.seek(Number(time).toFixed(1));
354
+ config.hideControlsEnd ? player.blur() : player.focus();
355
+ this.timer = setTimeout(function() {
356
+ _this4.pos.time = 0;
357
+ }, 500);
358
+ break;
359
+ }
360
+ this.changeAction(ACTIONS.AUTO);
361
+ }
362
+ }, {
363
+ key: "checkIsRootTarget",
364
+ value: function checkIsRootTarget(e) {
365
+ var plugins = this.player.plugins || {};
366
+ if (plugins.progress && plugins.progress.root.contains(e.target)) {
367
+ return false;
368
+ }
369
+ return plugins.start && plugins.start.root.contains(e.target) || plugins.controls && plugins.controls.root.contains(e.target);
370
+ }
371
+ }, {
372
+ key: "sendUseAction",
373
+ value: function sendUseAction(event) {
374
+ var paused = this.player.paused;
375
+ this.emitUserAction(event, "switch_play_pause", {
376
+ prop: "paused",
377
+ from: paused,
378
+ to: !paused
379
+ });
380
+ }
381
+ }, {
382
+ key: "clickHandler",
383
+ value: function clickHandler(e) {
384
+ var player = this.player, config = this.config, playerConfig = this.playerConfig;
385
+ if (player.state < STATES.RUNNING) {
386
+ if (!playerConfig.closeVideoClick) {
387
+ this.sendUseAction(util.createEvent("click"));
388
+ player.play();
389
+ }
390
+ return;
391
+ }
392
+ if (!config.closedbClick || playerConfig.closeVideoClick) {
393
+ player.isActive ? player.blur() : player.focus();
394
+ } else if (!playerConfig.closeVideoClick) {
395
+ if (player.isActive || config.focusVideoClick) {
396
+ this.sendUseAction(util.createEvent("click"));
397
+ this.switchPlayPause();
398
+ }
399
+ player.focus();
400
+ }
401
+ }
402
+ }, {
403
+ key: "dbClickHandler",
404
+ value: function dbClickHandler(e) {
405
+ var config = this.config, player = this.player;
406
+ if (!config.closedbClick && player.state >= STATES.RUNNING) {
407
+ this.sendUseAction(util.createEvent("dblclick"));
408
+ this.switchPlayPause();
409
+ }
410
+ }
411
+ }, {
412
+ key: "onClick",
413
+ value: function onClick(e) {
414
+ var _this5 = this;
415
+ var player = this.player;
416
+ runHooks(this, HOOKS[0], function(plugin, data) {
417
+ _this5.clickHandler(data.e);
418
+ }, {
419
+ e,
420
+ paused: player.paused
421
+ });
422
+ }
423
+ }, {
424
+ key: "onDbClick",
425
+ value: function onDbClick(e) {
426
+ var _this6 = this;
427
+ var player = this.player;
428
+ runHooks(this, HOOKS[1], function(plugin, data) {
429
+ _this6.dbClickHandler(data.e);
430
+ }, {
431
+ e,
432
+ paused: player.paused
433
+ });
434
+ }
435
+ }, {
436
+ key: "onPress",
437
+ value: function onPress(e) {
438
+ var pos = this.pos, config = this.config, player = this.player;
439
+ if (config.disablePress) {
440
+ return;
441
+ }
442
+ pos.rate = this.player.playbackRate;
443
+ this.emitUserAction("press", "change_rate", {
444
+ prop: "playbackRate",
445
+ from: player.playbackRate,
446
+ to: config.pressRate
447
+ });
448
+ player.playbackRate = config.pressRate;
449
+ this.changeAction(ACTIONS.PLAYBACK);
450
+ }
451
+ }, {
452
+ key: "onPressEnd",
453
+ value: function onPressEnd(e) {
454
+ var pos = this.pos, config = this.config, player = this.player;
455
+ if (config.disablePress) {
456
+ return;
457
+ }
458
+ this.emitUserAction("pressend", "change_rate", {
459
+ prop: "playbackRate",
460
+ from: player.playbackRate,
461
+ to: pos.rate
462
+ });
463
+ player.playbackRate = pos.rate;
464
+ pos.rate = 1;
465
+ this.changeAction(ACTIONS.AUTO);
466
+ }
467
+ }, {
468
+ key: "updateTime",
469
+ value: function updateTime(percent) {
470
+ var player = this.player, config = this.config;
471
+ var duration = this.player.duration;
472
+ percent = Number(percent.toFixed(4));
473
+ var time = parseInt(percent * config.moveDuration, 10) + this.timeOffset;
474
+ time += this.pos.time;
475
+ time = time < 0 ? 0 : time > duration * 1e3 ? duration * 1e3 - 200 : time;
476
+ player.getPlugin("time") && player.getPlugin("time").updateTime(time / 1e3);
477
+ player.getPlugin("progress") && player.getPlugin("progress").updatePercent(time / 1e3 / this.duration, true);
478
+ this.activeSeekNote(time / 1e3, percent > 0);
479
+ if (config.isTouchingSeek) {
480
+ player.seek(Number((time - this.timeOffset) / 1e3).toFixed(1));
481
+ }
482
+ this.pos.time = time;
483
+ }
484
+ }, {
485
+ key: "updateVolume",
486
+ value: function updateVolume(percent) {
487
+ if (this.player.rotateDeg) {
488
+ percent = -percent;
489
+ }
490
+ var player = this.player, pos = this.pos;
491
+ percent = parseInt(percent * 100, 10);
492
+ pos.volume += percent;
493
+ if (Math.abs(pos.volume) < 10) {
494
+ return;
495
+ }
496
+ var volume = parseInt(player.volume * 10, 10) - parseInt(pos.volume / 10, 10);
497
+ volume = volume > 10 ? 10 : volume < 1 ? 0 : volume;
498
+ player.volume = volume / 10;
499
+ pos.volume = 0;
500
+ }
501
+ }, {
502
+ key: "updateBrightness",
503
+ value: function updateBrightness(percent) {
504
+ if (this.player.rotateDeg) {
505
+ percent = -percent;
506
+ }
507
+ var pos = this.pos, config = this.config, xgMask = this.xgMask;
508
+ var light = pos.light + 0.8 * percent;
509
+ light = light > config.maxDarkness ? config.maxDarkness : light < 0 ? 0 : light;
510
+ if (xgMask) {
511
+ xgMask.style.backgroundColor = "rgba(0,0,0,".concat(light, ")");
512
+ }
513
+ pos.light = light;
514
+ }
515
+ }, {
516
+ key: "activeSeekNote",
517
+ value: function activeSeekNote(time) {
518
+ var isForward = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
519
+ var player = this.player, config = this.config;
520
+ var isLive = !(this.duration !== Infinity && this.duration > 0);
521
+ if (!time || typeof time !== "number" || isLive || config.disableActive) {
522
+ return;
523
+ }
524
+ if (time < 0) {
525
+ time = 0;
526
+ } else if (time > player.duration) {
527
+ time = player.duration - 0.2;
528
+ }
529
+ this.changeAction(ACTIONS.SEEKING);
530
+ var startPlugin = player.plugins.start;
531
+ startPlugin && startPlugin.focusHide();
532
+ this.find(".xg-dur").innerHTML = util.format(this.duration);
533
+ this.find(".xg-cur").innerHTML = util.format(time);
534
+ this.find(".xg-curbar").style.width = "".concat(time / this.duration * 100, "%");
535
+ if (isForward) {
536
+ util.removeClass(this.find(".xg-seek-show"), "xg-back");
537
+ } else {
538
+ util.addClass(this.find(".xg-seek-show"), "xg-back");
539
+ }
540
+ this.updateThumbnails(time);
541
+ }
542
+ }, {
543
+ key: "updateThumbnails",
544
+ value: function updateThumbnails(time) {
545
+ var player = this.player;
546
+ var thumbnail = player.plugins.thumbnail;
547
+ if (thumbnail && thumbnail.usable) {
548
+ this.thumbnail && thumbnail.update(this.thumbnail, time, 160, 90);
549
+ }
550
+ }
551
+ }, {
552
+ key: "switchPlayPause",
553
+ value: function switchPlayPause() {
554
+ var player = this.player;
555
+ if (player.state < STATES.ATTACHED) {
556
+ return false;
557
+ } else if (!player.ended) {
558
+ if (player.paused) {
559
+ player.play();
560
+ } else {
561
+ player.pause();
562
+ }
563
+ }
564
+ }
565
+ }, {
566
+ key: "disableGesture",
567
+ value: function disableGesture() {
568
+ this.config.disableGesture = false;
569
+ }
570
+ }, {
571
+ key: "enableGesture",
572
+ value: function enableGesture() {
573
+ this.config.disableGesture = true;
574
+ }
575
+ }, {
576
+ key: "destroy",
577
+ value: function destroy() {
578
+ var player = this.player;
579
+ this.timer && clearTimeout(this.timer);
580
+ this.thumbnail = null;
581
+ player.root.removeChild(this.xgMask);
582
+ this.xgMask = null;
583
+ this.touch && this.touch.destroy();
584
+ this.touch = null;
585
+ player.root.removeEventListener("touchmove", this.onRootTouchMove, true);
586
+ player.root.removeEventListener("touchend", this.onRootTouchEnd, true);
587
+ }
588
+ }, {
589
+ key: "render",
590
+ value: function render() {
591
+ var className = this.config.gradient !== "normal" ? "gradient ".concat(this.config.gradient) : "gradient";
592
+ return '\n <xg-trigger class="trigger">\n <div class="'.concat(className, '"></div>\n <div class="time-preview">\n <div class="xg-seek-show ').concat(this.config.disableSeekIcon ? " hide-seek-icon" : "", '">\n <i class="xg-seek-icon"></i>\n <span class="xg-cur">00:00</span>\n <span>/</span>\n <span class="xg-dur">00:00</span>\n </div>\n <div class="xg-bar xg-timebar">\n <div class="xg-curbar"></div>\n </div>\n </div>\n <div class="xg-playbackrate xg-top-note">\n <span><i>').concat(this.config.pressRate, "X</i>").concat(this.i18n.FORWARD, "</span>\n </div>\n </xg-trigger>\n ");
593
+ }
594
+ }], [{
595
+ key: "pluginName",
596
+ get: function get() {
597
+ return "mobile";
598
+ }
599
+ }, {
600
+ key: "defaultConfig",
601
+ get: function get() {
602
+ return {
603
+ index: 0,
604
+ disableGesture: false,
605
+ gestureX: true,
606
+ gestureY: true,
607
+ gradient: "normal",
608
+ isTouchingSeek: false,
609
+ miniMoveStep: 5,
610
+ miniYPer: 5,
611
+ scopeL: 0.25,
612
+ scopeR: 0.25,
613
+ scopeM: 0.9,
614
+ pressRate: 2,
615
+ darkness: true,
616
+ maxDarkness: 0.8,
617
+ disableActive: false,
618
+ disableTimeProgress: false,
619
+ hideControlsActive: false,
620
+ hideControlsEnd: false,
621
+ moveDuration: 60 * 6 * 1e3,
622
+ closedbClick: false,
623
+ disablePress: true,
624
+ disableSeekIcon: false,
625
+ focusVideoClick: false
626
+ };
627
+ }
628
+ }]);
629
+ return MobilePlugin2;
630
+ }(Plugin);
631
+ export { MobilePlugin as default };