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,42 @@
1
+ import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, defineProperty as _defineProperty, assertThisInitialized as _assertThisInitialized, createClass as _createClass } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
+ import "../../utils/util.js";
3
+ import "../../utils/debug.js";
4
+ import Plugin from "../../plugin/plugin.js";
5
+ var Icon = /* @__PURE__ */ function(_Plugin) {
6
+ _inherits(Icon2, _Plugin);
7
+ var _super = _createSuper(Icon2);
8
+ function Icon2() {
9
+ var _this;
10
+ _classCallCheck(this, Icon2);
11
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
12
+ args[_key] = arguments[_key];
13
+ }
14
+ _this = _super.call.apply(_super, [this].concat(args));
15
+ _defineProperty(_assertThisInitialized(_this), "_onMouseenter", function(e) {
16
+ _this.emit("icon_mouseenter", {
17
+ pluginName: _this.pluginName
18
+ });
19
+ });
20
+ _defineProperty(_assertThisInitialized(_this), "_onMouseLeave", function(e) {
21
+ _this.emit("icon_mouseleave", {
22
+ pluginName: _this.pluginName
23
+ });
24
+ });
25
+ return _this;
26
+ }
27
+ _createClass(Icon2, [{
28
+ key: "afterCreate",
29
+ value: function afterCreate() {
30
+ this.bind("mouseenter", this._onMouseenter);
31
+ this.bind("mouseleave", this._onMouseLeave);
32
+ }
33
+ }, {
34
+ key: "destroy",
35
+ value: function destroy() {
36
+ this.unbind("mouseenter", this._onMouseenter);
37
+ this.unbind("mouseleave", this._onMouseLeave);
38
+ }
39
+ }]);
40
+ return Icon2;
41
+ }(Plugin);
42
+ export { Icon as default };
@@ -0,0 +1 @@
1
+ export function xgIconTips(plugin: any, textKey: any, isShow: any): string;
@@ -0,0 +1,8 @@
1
+ function xgIconTips(plugin, textKey, isShow) {
2
+ try {
3
+ return ' <div class="xg-tips '.concat(isShow ? "hide" : " ", '" lang-key="').concat(plugin.i18nKeys[textKey], '">\n ').concat(plugin.i18n[textKey], "\n </div>");
4
+ } catch (e) {
5
+ return '<div class="xg-tips hide"></div>';
6
+ }
7
+ }
8
+ export { xgIconTips };
@@ -0,0 +1,2 @@
1
+ @import "./optionsIcon.scss";
2
+ @import "./thumbnail.scss";
@@ -0,0 +1,15 @@
1
+ export default class OptionList {
2
+ constructor(args: any);
3
+ config: any;
4
+ parent: any;
5
+ root: HTMLElement;
6
+ onItemClick(e: any): boolean;
7
+ _delegates: any;
8
+ renderItemList(data: any): void;
9
+ attrKeys: string[];
10
+ getAttrObj(dom: any, keys: any): {};
11
+ show(): void;
12
+ hide(): void;
13
+ setStyle(style: any): void;
14
+ destroy(): void;
15
+ }
@@ -0,0 +1,120 @@
1
+ import { createClass as _createClass, classCallCheck as _classCallCheck } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
+ import util from "../../utils/util.js";
3
+ import sniffer from "../../utils/sniffer.js";
4
+ import "../../utils/debug.js";
5
+ import Plugin from "../../plugin/plugin.js";
6
+ var OptionList = /* @__PURE__ */ function() {
7
+ function OptionList2(args) {
8
+ _classCallCheck(this, OptionList2);
9
+ this.config = args.config;
10
+ this.parent = args.root;
11
+ this.root = util.createDom("ul", "", {}, "xg-options-list xg-list-slide-scroll ".concat(this.config.className));
12
+ args.root.appendChild(this.root);
13
+ var maxHeight = this.config.maxHeight;
14
+ if (maxHeight) {
15
+ this.setStyle({
16
+ maxHeight
17
+ });
18
+ }
19
+ this.onItemClick = this.onItemClick.bind(this);
20
+ this.renderItemList();
21
+ var eventName = sniffer.device === "mobile" ? "touchend" : "click";
22
+ this._delegates = Plugin.delegate.call(this, this.root, "li", eventName, this.onItemClick);
23
+ }
24
+ _createClass(OptionList2, [{
25
+ key: "renderItemList",
26
+ value: function renderItemList(data) {
27
+ var _this = this;
28
+ var config = this.config, root = this.root;
29
+ if (data) {
30
+ config.data = data;
31
+ } else {
32
+ data = config.data;
33
+ }
34
+ if (config.style) {
35
+ Object.keys(config.style).map(function(key) {
36
+ root.style[key] = config[key];
37
+ });
38
+ }
39
+ if (data.length > 0) {
40
+ this.attrKeys = Object.keys(data[0]);
41
+ }
42
+ this.root.innerHTML = "";
43
+ data.map(function(item, index) {
44
+ var className = item.selected ? "option-item selected" : "option-item";
45
+ item["data-index"] = index;
46
+ _this.root.appendChild(util.createDom("li", "<span>".concat(item.showText, "</span>"), item, className));
47
+ });
48
+ }
49
+ }, {
50
+ key: "onItemClick",
51
+ value: function onItemClick(e) {
52
+ if (!e.delegateTarget) {
53
+ e.delegateTarget = e.target;
54
+ }
55
+ var target = e.delegateTarget;
56
+ if (target && util.hasClass(target, "selected")) {
57
+ return false;
58
+ }
59
+ var changeCallback = typeof this.config.onItemClick === "function" ? this.config.onItemClick : null;
60
+ var curSelected = this.root.querySelector(".selected");
61
+ util.addClass(target, "selected");
62
+ curSelected && util.removeClass(curSelected, "selected");
63
+ changeCallback(e, {
64
+ from: curSelected ? this.getAttrObj(curSelected, this.attrKeys) : null,
65
+ to: this.getAttrObj(target, this.attrKeys)
66
+ });
67
+ }
68
+ }, {
69
+ key: "getAttrObj",
70
+ value: function getAttrObj(dom, keys) {
71
+ if (!dom || !keys) {
72
+ return {};
73
+ }
74
+ var obj = {};
75
+ keys.map(function(key) {
76
+ obj[key] = dom.getAttribute(key);
77
+ });
78
+ var index = dom.getAttribute("data-index");
79
+ if (index) {
80
+ obj.index = Number(index);
81
+ }
82
+ return obj;
83
+ }
84
+ }, {
85
+ key: "show",
86
+ value: function show() {
87
+ util.removeClass(this.root, "hide");
88
+ util.addClass(this.root, "active");
89
+ }
90
+ }, {
91
+ key: "hide",
92
+ value: function hide() {
93
+ util.removeClass(this.root, "active");
94
+ util.addClass(this.root, "hide");
95
+ }
96
+ }, {
97
+ key: "setStyle",
98
+ value: function setStyle(style) {
99
+ var _this2 = this;
100
+ Object.keys(style).forEach(function(key) {
101
+ _this2.root.style[key] = style[key];
102
+ });
103
+ }
104
+ }, {
105
+ key: "destroy",
106
+ value: function destroy() {
107
+ if (this._delegates) {
108
+ this._delegates.map(function(item) {
109
+ item.destroy && item.destroy();
110
+ });
111
+ this._delegates = null;
112
+ }
113
+ this.root.innerHTML = null;
114
+ this.parent.removeChild(this.root);
115
+ this.root = null;
116
+ }
117
+ }]);
118
+ return OptionList2;
119
+ }();
120
+ export { OptionList as default };
@@ -0,0 +1,40 @@
1
+ export default class OptionsIcon extends Plugin {
2
+ /**
3
+ * @type { IOptionsIconConfig }
4
+ */
5
+ static get defaultConfig(): IOptionsIconConfig;
6
+ constructor(args: any);
7
+ isIcons: boolean;
8
+ isActive: boolean;
9
+ curValue: any;
10
+ curIndex: number;
11
+ activeEvent: string;
12
+ initIcons(): void;
13
+ show(): void;
14
+ getTextByLang(item: any, key: any, lang: any): any;
15
+ onEnter: (e: any) => void;
16
+ switchActiveState: (e: any) => void;
17
+ onLeave: (e: any) => void;
18
+ onListEnter: (e: any) => void;
19
+ enterType: number;
20
+ onListLeave: (e: any) => void;
21
+ toggle(isActive: any): void;
22
+ onItemClick(e: any, data: any): void;
23
+ curItem: any;
24
+ onIconClick(e: any): void;
25
+ changeCurrentText(): void;
26
+ renderItemList(itemList: any, curIndex: any): void;
27
+ optionsList: OptionList;
28
+ _resizeList(): void;
29
+ render(): string;
30
+ }
31
+ export type IOptionsIconConfig = {
32
+ [propName: string]: any;
33
+ isShow?: boolean;
34
+ index?: number;
35
+ list?: Array<any>;
36
+ listType?: string;
37
+ hidePortrait?: boolean;
38
+ };
39
+ import Plugin from "../../plugin";
40
+ import OptionList from "./optionList";
@@ -0,0 +1,304 @@
1
+ import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, defineProperty as _defineProperty, assertThisInitialized as _assertThisInitialized, createClass as _createClass, typeof as _typeof } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
+ import util from "../../utils/util.js";
3
+ import sniffer from "../../utils/sniffer.js";
4
+ import { VIDEO_RESIZE, FULLSCREEN_CHANGE, CANPLAY, PLAYER_FOCUS } from "../../events.js";
5
+ import "../../utils/debug.js";
6
+ import Plugin, { POSITIONS } from "../../plugin/plugin.js";
7
+ import OptionList from "./optionList.js";
8
+ var LIST_TYPES = {
9
+ SIDE: "side",
10
+ MIDDLE: "middle"
11
+ };
12
+ var TOGGLE_MODES = {
13
+ CLICK: "click",
14
+ HOVER: "hover"
15
+ };
16
+ function getListClassName(listType, position) {
17
+ if (listType === LIST_TYPES.SIDE) {
18
+ return position === POSITIONS.CONTROLS_LEFT ? "xg-side-list xg-left-side" : "xg-side-list xg-right-side";
19
+ } else {
20
+ return "";
21
+ }
22
+ }
23
+ var IS_MOBILE = sniffer.device === "mobile";
24
+ var OptionsIcon = /* @__PURE__ */ function(_Plugin) {
25
+ _inherits(OptionsIcon2, _Plugin);
26
+ var _super = _createSuper(OptionsIcon2);
27
+ function OptionsIcon2(args) {
28
+ var _this;
29
+ _classCallCheck(this, OptionsIcon2);
30
+ _this = _super.call(this, args);
31
+ _defineProperty(_assertThisInitialized(_this), "onEnter", function(e) {
32
+ e.stopPropagation();
33
+ _this.emit("icon_mouseenter", {
34
+ pluginName: _this.pluginName
35
+ });
36
+ _this.switchActiveState(e);
37
+ });
38
+ _defineProperty(_assertThisInitialized(_this), "switchActiveState", function(e) {
39
+ e.stopPropagation();
40
+ var toggleMode = _this.config.toggleMode;
41
+ if (toggleMode === TOGGLE_MODES.CLICK) {
42
+ _this.toggle(!_this.isActive);
43
+ } else {
44
+ _this.toggle(true);
45
+ }
46
+ });
47
+ _defineProperty(_assertThisInitialized(_this), "onLeave", function(e) {
48
+ e.stopPropagation();
49
+ _this.emit("icon_mouseleave", {
50
+ pluginName: _this.pluginName
51
+ });
52
+ if (_this.config.listType !== LIST_TYPES.SIDE) {
53
+ _this.isActive && _this.toggle(false);
54
+ }
55
+ });
56
+ _defineProperty(_assertThisInitialized(_this), "onListEnter", function(e) {
57
+ _this.enterType = 2;
58
+ });
59
+ _defineProperty(_assertThisInitialized(_this), "onListLeave", function(e) {
60
+ _this.enterType = 0;
61
+ _this.isActive && _this.toggle(false);
62
+ });
63
+ _this.isIcons = false;
64
+ _this.isActive = false;
65
+ _this.curValue = null;
66
+ _this.curIndex = 0;
67
+ return _this;
68
+ }
69
+ _createClass(OptionsIcon2, [{
70
+ key: "updateLang",
71
+ value: function updateLang(value) {
72
+ this.renderItemList(this.config.list, this.curIndex);
73
+ }
74
+ }, {
75
+ key: "afterCreate",
76
+ value: function afterCreate() {
77
+ var _this2 = this;
78
+ var config = this.config;
79
+ this.initIcons();
80
+ if (IS_MOBILE && config.listType !== LIST_TYPES.MIDDLE) {
81
+ config.listType = LIST_TYPES.SIDE;
82
+ }
83
+ config.hidePortrait && util.addClass(this.root, "portrait");
84
+ this.on([VIDEO_RESIZE, FULLSCREEN_CHANGE], function() {
85
+ _this2._resizeList();
86
+ });
87
+ this.once(CANPLAY, function() {
88
+ if (config.list && config.list.length > 0) {
89
+ _this2.renderItemList(config.list);
90
+ _this2.show();
91
+ }
92
+ });
93
+ IS_MOBILE && this.on(PLAYER_FOCUS, function() {
94
+ if (!_this2.isActive) {
95
+ return;
96
+ }
97
+ _this2.optionsList && _this2.optionsList.hide();
98
+ _this2.isActive = false;
99
+ });
100
+ if (IS_MOBILE) {
101
+ config.toggleMode = TOGGLE_MODES.CLICK;
102
+ this.activeEvent = "touchend";
103
+ } else {
104
+ this.activeEvent = config.toggleMode === TOGGLE_MODES.CLICK ? "click" : "mouseenter";
105
+ }
106
+ if (config.toggleMode === TOGGLE_MODES.CLICK) {
107
+ this.bind(this.activeEvent, this.switchActiveState);
108
+ } else {
109
+ this.bind(this.activeEvent, this.onEnter);
110
+ this.bind("mouseleave", this.onLeave);
111
+ }
112
+ this.isIcons && this.bind("click", this.onIconClick);
113
+ }
114
+ }, {
115
+ key: "initIcons",
116
+ value: function initIcons() {
117
+ var _this3 = this;
118
+ var icons = this.icons;
119
+ var _c = Object.keys(icons);
120
+ var _isIcons = false;
121
+ if (_c.length > 0) {
122
+ _c.forEach(function(key) {
123
+ _this3.appendChild(".xgplayer-icon", icons[key]);
124
+ !_isIcons && (_isIcons = icons[key]);
125
+ });
126
+ this.isIcons = _isIcons;
127
+ }
128
+ if (_isIcons) {
129
+ return;
130
+ }
131
+ this.appendChild(".xgplayer-icon", util.createDom("span", "", {}, "icon-text"));
132
+ util.addClass(this.find(".xgplayer-icon"), "btn-text");
133
+ }
134
+ }, {
135
+ key: "show",
136
+ value: function show() {
137
+ if (!this.config.list || this.config.list.length < 2) {
138
+ return;
139
+ }
140
+ util.addClass(this.root, "show");
141
+ }
142
+ }, {
143
+ key: "hide",
144
+ value: function hide() {
145
+ util.removeClass(this.root, "show");
146
+ }
147
+ }, {
148
+ key: "getTextByLang",
149
+ value: function getTextByLang(item, key, lang) {
150
+ if (item === void 0) {
151
+ return "";
152
+ }
153
+ var list = this.config.list;
154
+ !lang && (lang = this.player.lang);
155
+ key = !key || util.isUndefined(item[key]) ? "text" : key;
156
+ typeof item === "number" && (item = list[item]);
157
+ try {
158
+ if (_typeof(item[key]) === "object") {
159
+ return item[key][lang] || item[key].en;
160
+ } else {
161
+ return item[key];
162
+ }
163
+ } catch (err) {
164
+ console.warn(err);
165
+ return "";
166
+ }
167
+ }
168
+ }, {
169
+ key: "toggle",
170
+ value: function toggle(isActive) {
171
+ if (isActive === this.isActive)
172
+ return;
173
+ var controls = this.player.controls;
174
+ var listType = this.config.listType;
175
+ if (isActive) {
176
+ listType === LIST_TYPES.SIDE ? controls.blur() : controls.focus();
177
+ this.optionsList && this.optionsList.show();
178
+ } else {
179
+ listType === LIST_TYPES.SIDE ? controls.focus() : controls.focusAwhile();
180
+ this.optionsList && this.optionsList.hide();
181
+ }
182
+ this.isActive = isActive;
183
+ }
184
+ }, {
185
+ key: "onItemClick",
186
+ value: function onItemClick(e, data) {
187
+ e.stopPropagation();
188
+ var _this$config = this.config, listType = _this$config.listType, list = _this$config.list;
189
+ this.curIndex = data.to.index;
190
+ this.curItem = list[this.curIndex];
191
+ this.changeCurrentText();
192
+ var isItemClickHide = this.config.isItemClickHide;
193
+ (isItemClickHide || IS_MOBILE || listType === LIST_TYPES.SIDE) && this.toggle(false);
194
+ }
195
+ }, {
196
+ key: "onIconClick",
197
+ value: function onIconClick(e) {
198
+ }
199
+ }, {
200
+ key: "changeCurrentText",
201
+ value: function changeCurrentText() {
202
+ if (this.isIcons) {
203
+ return;
204
+ }
205
+ var list = this.config.list;
206
+ var index = this.curIndex < list.length ? this.curIndex : 0;
207
+ var curItem = list[index];
208
+ if (!curItem)
209
+ return;
210
+ this.find(".icon-text").innerHTML = this.getTextByLang(curItem, "iconText");
211
+ }
212
+ }, {
213
+ key: "renderItemList",
214
+ value: function renderItemList(itemList, curIndex) {
215
+ var _this4 = this;
216
+ var config = this.config, optionsList = this.optionsList, player = this.player;
217
+ if (typeof curIndex === "number") {
218
+ this.curIndex = curIndex;
219
+ this.curItem = config.list[curIndex];
220
+ }
221
+ if (optionsList) {
222
+ optionsList.renderItemList(itemList);
223
+ this.changeCurrentText();
224
+ return;
225
+ }
226
+ var options = {
227
+ config: {
228
+ data: itemList || [],
229
+ className: getListClassName(config.listType, config.position),
230
+ onItemClick: function onItemClick(e, data) {
231
+ _this4.onItemClick(e, data);
232
+ }
233
+ },
234
+ root: config.listType === LIST_TYPES.SIDE ? player.innerContainer || player.root : this.root
235
+ };
236
+ if (this.config.isShowIcon) {
237
+ var _this$player$root$get = this.player.root.getBoundingClientRect(), height = _this$player$root$get.height;
238
+ var _maxH = config.listType === LIST_TYPES.MIDDLE ? height - 50 : height;
239
+ if (_maxH) {
240
+ options.config.maxHeight = "".concat(_maxH, "px");
241
+ }
242
+ this.optionsList = new OptionList(options);
243
+ this.changeCurrentText();
244
+ this.show();
245
+ }
246
+ this._resizeList();
247
+ }
248
+ }, {
249
+ key: "_resizeList",
250
+ value: function _resizeList() {
251
+ var _this$player$root$get2 = this.player.root.getBoundingClientRect(), height = _this$player$root$get2.height;
252
+ var _maxH = this.config.listType === LIST_TYPES.MIDDLE ? height - 50 : height;
253
+ this.optionsList && this.optionsList.setStyle({
254
+ maxHeight: "".concat(_maxH, "px")
255
+ });
256
+ }
257
+ }, {
258
+ key: "destroy",
259
+ value: function destroy() {
260
+ var config = this.config;
261
+ if (config.toggleMode === TOGGLE_MODES.CLICK) {
262
+ this.unbind(this.activeEvent, this.switchActiveState);
263
+ } else {
264
+ this.unbind(this.activeEvent, this.onEnter);
265
+ this.unbind("mouseleave", this.onLeave);
266
+ }
267
+ this.isIcons && this.unbind("click", this.onIconClick);
268
+ if (this.optionsList) {
269
+ this.optionsList.destroy();
270
+ this.optionsList = null;
271
+ }
272
+ }
273
+ }, {
274
+ key: "render",
275
+ value: function render() {
276
+ if (!this.config.isShowIcon) {
277
+ return;
278
+ }
279
+ return '<xg-icon class="xg-options-icon '.concat(this.config.className || "", '">\n <div class="xgplayer-icon">\n </div>\n </xg-icon>');
280
+ }
281
+ }], [{
282
+ key: "pluginName",
283
+ get: function get() {
284
+ return "optionsIcon";
285
+ }
286
+ }, {
287
+ key: "defaultConfig",
288
+ get: function get() {
289
+ return {
290
+ position: POSITIONS.CONTROLS_RIGHT,
291
+ index: 100,
292
+ list: [],
293
+ listType: "middle",
294
+ listStyle: {},
295
+ hidePortrait: true,
296
+ isShowIcon: false,
297
+ isItemClickHide: true,
298
+ toggleMode: TOGGLE_MODES.HOVER
299
+ };
300
+ }
301
+ }]);
302
+ return OptionsIcon2;
303
+ }(Plugin);
304
+ export { OptionsIcon as default };
@@ -0,0 +1,154 @@
1
+ @import "../../style/variable";
2
+ .xgplayer {
3
+ .xg-options-icon {
4
+ display: none;
5
+ cursor: pointer;
6
+ &.show {
7
+ display: block;
8
+ }
9
+ }
10
+
11
+ @keyframes xg_right_options_active {
12
+ 0% {
13
+ transform: translateX(50%);
14
+ }
15
+ 100% {
16
+ transform: translateX(-50%);
17
+ }
18
+ }
19
+
20
+ @keyframes xg_right_options_hide {
21
+ 0% {
22
+ transform: translateX(-50%);
23
+ }
24
+ 100% {
25
+ transform: translateX(50%);
26
+ }
27
+ }
28
+
29
+ @keyframes xg_left_options_active {
30
+ 0% {
31
+ transform: translateX(-50%);
32
+ }
33
+ 100% {
34
+ transform: translateX(50%);
35
+ }
36
+ }
37
+
38
+ @keyframes xg_left_options_hide {
39
+ 0% {
40
+ transform: translateX(50%);
41
+ }
42
+ 100% {
43
+ transform: translateX(-50%);
44
+ }
45
+ }
46
+
47
+ .xg-options-list {
48
+ display: none;
49
+ position: absolute;
50
+ z-index: 5;
51
+ width: 78px;
52
+ right: 50%;
53
+ bottom: 100%;
54
+ background: $definitionUlBgColor;
55
+ border-radius: 1px;
56
+ transform: translateX(50%);
57
+ cursor: pointer;
58
+ overflow: auto;
59
+ height: 0;
60
+ opacity: 0.85;
61
+ font-size: 14px;
62
+ color: $definitionLiColor;
63
+ li {
64
+ height: 20px;
65
+ line-height: 20px;
66
+ position: relative;
67
+ padding: 4px 0;
68
+ text-align: center;
69
+ &:hover{
70
+ color: $definitionLiActiveColor;
71
+ opacity: 1;
72
+ }
73
+ &.selected{
74
+ color: $definitionLiActiveColor;
75
+ opacity: 1;
76
+ }
77
+ }
78
+ li:nth-child(1) {
79
+ position: relative;
80
+ margin-top: 12px;
81
+ }
82
+ li:last-child {
83
+ position: relative;
84
+ margin-bottom: 12px;
85
+ }
86
+ &:hover {
87
+ opacity: 1;
88
+ }
89
+ &.active {
90
+ display: block;
91
+ height: auto;
92
+ }
93
+ &.xg-side-list {
94
+ width: 20%;
95
+ height: 100%;
96
+ bottom: 0;
97
+ background: rgba(0,0,0,0.9);
98
+ display: flex;
99
+ flex-direction: column;
100
+ box-sizing: border-box;
101
+ li {
102
+ flex:1;
103
+ width: 100%;
104
+ padding: 0;
105
+ position: relative;
106
+ span {
107
+ display: block;
108
+ position: relative;
109
+ top: 50%;
110
+ transform: translateY(-50%);
111
+ pointer-events: none;
112
+ }
113
+ }
114
+ li:nth-child(1) {
115
+ margin-top: 20px;
116
+ }
117
+ li:last-child {
118
+ margin-bottom: 20px;
119
+ }
120
+ }
121
+ &.xg-right-side {
122
+ right: -10.5%;
123
+ &.active {
124
+ height: 100%;
125
+ animation: xg_right_options_active .2s ease-out forwards;
126
+ }
127
+ &.hide {
128
+ height: 100%;
129
+ animation: xg_right_options_hide .2s ease-in forwards;
130
+ }
131
+ }
132
+
133
+ &.xg-left-side {
134
+ left: -10.5%;
135
+ transform: translateX(-50%);
136
+ &.active {
137
+ height: 100%;
138
+ animation: xg_left_options_active .2s ease-out forwards;
139
+ }
140
+ &.hide {
141
+ height: 100%;
142
+ animation: xg_left_options_hide .2s ease-in forwards;
143
+ }
144
+ }
145
+ }
146
+ }
147
+
148
+ @media only screen and (max-width: 480px) {
149
+ .xgplayer-mobile .xg-options-icon {
150
+ &.portrait {
151
+ display: none;
152
+ }
153
+ }
154
+ }