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,178 @@
1
+ import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, createClass as _createClass, get as _get, getPrototypeOf as _getPrototypeOf } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
+ import "../../utils/util.js";
3
+ import { VIDEO_RESIZE, SCREEN_SHOT } from "../../events.js";
4
+ import "../../utils/debug.js";
5
+ import { POSITIONS } from "../../plugin/plugin.js";
6
+ import Icon from "../common/iconPlugin.js";
7
+ var ScreenShot = /* @__PURE__ */ function(_IconPlugin) {
8
+ _inherits(ScreenShot2, _IconPlugin);
9
+ var _super = _createSuper(ScreenShot2);
10
+ function ScreenShot2() {
11
+ _classCallCheck(this, ScreenShot2);
12
+ return _super.apply(this, arguments);
13
+ }
14
+ _createClass(ScreenShot2, [{
15
+ key: "beforeCreate",
16
+ value: function beforeCreate(args) {
17
+ if (typeof args.player.config.screenShot === "boolean") {
18
+ args.config.disable = !args.player.config.screenShot;
19
+ }
20
+ }
21
+ }, {
22
+ key: "afterCreate",
23
+ value: function afterCreate() {
24
+ _get(_getPrototypeOf(ScreenShot2.prototype), "afterCreate", this).call(this);
25
+ this.appendChild(".xgplayer-icon", this.icons.screenshotIcon);
26
+ var config = this.config;
27
+ this.initSize = function(data) {
28
+ if (config.fitVideo) {
29
+ config.width = data.vWidth;
30
+ config.height = data.vHeight;
31
+ }
32
+ };
33
+ this.once(VIDEO_RESIZE, this.initSize);
34
+ }
35
+ }, {
36
+ key: "onPluginsReady",
37
+ value: function onPluginsReady() {
38
+ this.show();
39
+ this.onClickBtn = this.onClickBtn.bind(this);
40
+ this.bind(["click", "touchend"], this.onClickBtn);
41
+ }
42
+ }, {
43
+ key: "saveScreenShot",
44
+ value: function saveScreenShot(data, filename) {
45
+ var saveLink = document.createElement("a");
46
+ saveLink.href = data;
47
+ saveLink.download = filename;
48
+ var event = document.createEvent("MouseEvents");
49
+ event.initMouseEvent("click", true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
50
+ saveLink.dispatchEvent(event);
51
+ }
52
+ }, {
53
+ key: "createCanvas",
54
+ value: function createCanvas(width, height) {
55
+ var canvas = document.createElement("canvas");
56
+ var canvasCtx = canvas.getContext("2d");
57
+ this.canvasCtx = canvasCtx;
58
+ this.canvas = canvas;
59
+ canvas.width = width || this.config.width;
60
+ canvas.height = height || this.config.height;
61
+ canvasCtx.imageSmoothingEnabled = true;
62
+ if (canvasCtx.imageSmoothingEnabled) {
63
+ canvasCtx.imageSmoothingQuality = "high";
64
+ }
65
+ }
66
+ }, {
67
+ key: "onClickBtn",
68
+ value: function onClickBtn(e) {
69
+ var _this = this;
70
+ e.preventDefault();
71
+ e.stopPropagation();
72
+ this.emitUserAction(e, "shot");
73
+ this.shot().then(function(data) {
74
+ _this.emit(SCREEN_SHOT, data);
75
+ _this.saveScreenShot(data, _this.config.name + _this.config.format);
76
+ });
77
+ }
78
+ }, {
79
+ key: "shot",
80
+ value: function shot(width, height) {
81
+ var _this2 = this;
82
+ var option = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
83
+ quality: 0.92,
84
+ type: "image/png"
85
+ };
86
+ var config = this.config, player = this.player;
87
+ var quality = option.quality || config.quality;
88
+ var type = option.type || config.type;
89
+ return new Promise(function(resolve, reject) {
90
+ var canvas = null;
91
+ var canvasCtx;
92
+ if (player.media.canvas) {
93
+ canvas = player.media.canvas;
94
+ } else {
95
+ if (!_this2.canvas) {
96
+ _this2.createCanvas(width, height);
97
+ } else {
98
+ _this2.canvas.width = width || config.width;
99
+ _this2.canvas.height = height || config.height;
100
+ }
101
+ canvas = _this2.canvas;
102
+ canvasCtx = _this2.canvasCtx;
103
+ var mediaRatio = player.media.videoWidth / player.media.videoHeight;
104
+ var canvasRatio = canvas.width / canvas.height;
105
+ var sx = 0, sy = 0, sw = player.media.videoWidth, sh = player.media.videoHeight;
106
+ var dx, dy, dw, dh;
107
+ if (mediaRatio > canvasRatio) {
108
+ dw = canvas.width;
109
+ dh = canvas.width / mediaRatio;
110
+ dx = 0;
111
+ dy = Math.round((canvas.height - dh) / 2);
112
+ } else if (mediaRatio === canvasRatio) {
113
+ dw = canvas.width;
114
+ dh = canvas.height;
115
+ dx = 0;
116
+ dy = 0;
117
+ } else if (mediaRatio < canvasRatio) {
118
+ dw = canvas.height * mediaRatio;
119
+ dh = canvas.height;
120
+ dx = Math.round((canvas.width - dw) / 2);
121
+ dy = 0;
122
+ }
123
+ canvasCtx.drawImage(player.media, sx, sy, sw, sh, dx, dy, dw, dh);
124
+ }
125
+ var src = canvas.toDataURL(type, quality).replace(type, "image/octet-stream");
126
+ src = src.replace(/^data:image\/[^;]+/, "data:application/octet-stream");
127
+ resolve(src);
128
+ });
129
+ }
130
+ }, {
131
+ key: "registerIcons",
132
+ value: function registerIcons() {
133
+ return {
134
+ screenshotIcon: null
135
+ };
136
+ }
137
+ }, {
138
+ key: "destroy",
139
+ value: function destroy() {
140
+ _get(_getPrototypeOf(ScreenShot2.prototype), "destroy", this).call(this);
141
+ this.unbind(["click", "touchend"], this.onClickBtn);
142
+ this.off(VIDEO_RESIZE, this.initSize);
143
+ }
144
+ }, {
145
+ key: "render",
146
+ value: function render() {
147
+ if (this.config.disable) {
148
+ return;
149
+ }
150
+ var className = this.icons.screenshotIcon ? "xgplayer-icon" : "xgplayer-icon btn-text";
151
+ var langKey = "SCREENSHOT";
152
+ return '\n <xg-icon class="xgplayer-shot">\n <div class="'.concat(className, '">\n ').concat(this.icons.screenshotIcon ? "" : '<span lang-key="'.concat(this.i18nKeys[langKey], '">').concat(this.i18n[langKey], "</span>"), "\n </div>\n </xg-icon>");
153
+ }
154
+ }], [{
155
+ key: "pluginName",
156
+ get: function get() {
157
+ return "screenShot";
158
+ }
159
+ }, {
160
+ key: "defaultConfig",
161
+ get: function get() {
162
+ return {
163
+ position: POSITIONS.CONTROLS_RIGHT,
164
+ index: 5,
165
+ quality: 0.92,
166
+ type: "image/png",
167
+ format: ".png",
168
+ width: 600,
169
+ height: 337,
170
+ fitVideo: true,
171
+ disable: false,
172
+ name: "screenshot"
173
+ };
174
+ }
175
+ }]);
176
+ return ScreenShot2;
177
+ }(Icon);
178
+ export { ScreenShot as default };
@@ -0,0 +1,5 @@
1
+ .xgplayer {
2
+ .xgplayer-shot {
3
+ display: none;
4
+ }
5
+ }
@@ -0,0 +1,91 @@
1
+ @keyframes playPause {
2
+ 0% {
3
+ transform: scale(1);
4
+ opacity: 1;
5
+ }
6
+ 99% {
7
+ transform: scale(1.3);
8
+ opacity: 0;
9
+ }
10
+ to {
11
+ transform: scale(1);
12
+ opacity: 0;
13
+ }
14
+ }
15
+ .xgplayer xg-start-inner {
16
+ display: block;
17
+ width: 100%;
18
+ height: 100%;
19
+ overflow: hidden;
20
+ border-radius: 50%;
21
+ background: rgba(0, 0, 0, 0.38);
22
+ }
23
+ .xgplayer .xgplayer-start {
24
+ width: 70px;
25
+ height: 70px;
26
+ position: absolute;
27
+ left: 50%;
28
+ top: 50%;
29
+ z-index: 5;
30
+ transform: translate(-50%, -50%);
31
+ cursor: pointer;
32
+ }
33
+ .xgplayer .xgplayer-start svg {
34
+ width: 100%;
35
+ height: 100%;
36
+ }
37
+ .xgplayer .xgplayer-start.hide {
38
+ display: none;
39
+ pointer-events: none;
40
+ }
41
+ .xgplayer .xgplayer-start.focus-hide {
42
+ display: none;
43
+ pointer-events: none;
44
+ }
45
+ .xgplayer .xgplayer-start:hover {
46
+ opacity: 0.85;
47
+ }
48
+ .xgplayer .xgplayer-start .xg-icon-play {
49
+ display: block;
50
+ }
51
+ .xgplayer .xgplayer-start .xg-icon-pause {
52
+ display: none;
53
+ }
54
+ .xgplayer .xgplayer-start[data-state=pause] .xg-icon-play {
55
+ display: none;
56
+ }
57
+ .xgplayer .xgplayer-start[data-state=pause] .xg-icon-pause {
58
+ display: block;
59
+ }
60
+ .xgplayer .xgplayer-start.interact {
61
+ display: block;
62
+ }
63
+ .xgplayer .xgplayer-start.interact xg-start-inner {
64
+ animation: playPause 0.4s 0.1s ease-out forwards;
65
+ }
66
+ .xgplayer .xgplayer-start.show {
67
+ display: block;
68
+ }
69
+ .xgplayer.xgplayer-mobile xg-start-inner {
70
+ background: initial;
71
+ border-radius: 0;
72
+ }
73
+ .xgplayer.xgplayer-mobile .xgplayer-start {
74
+ height: 50px;
75
+ width: 50px;
76
+ }
77
+ .xgplayer.xgplayer-mobile .xgplayer-start:hover {
78
+ opacity: 1;
79
+ }
80
+ .xgplayer.xgplayer-inactive .xgplayer-start.auto-hide, .xgplayer.xgplayer-is-enter .xgplayer-start.auto-hide {
81
+ display: none;
82
+ }
83
+ .xgplayer.xgplayer-isloading.xgplayer-playing .xgplayer-start {
84
+ display: none;
85
+ }
86
+ .xgplayer.xgplayer-is-enter .xgplayer-start, .xgplayer.xgplayer-is-error .xgplayer-start {
87
+ display: none;
88
+ }
89
+ .xgplayer.xgplayer-is-enter .xgplayer-start.show, .xgplayer.xgplayer-is-error .xgplayer-start.show {
90
+ display: none;
91
+ }
@@ -0,0 +1,41 @@
1
+ export default Start;
2
+ export type IStartConfig = {
3
+ [propName: string]: any;
4
+ isShowPause?: boolean;
5
+ isShowEnd?: boolean;
6
+ disableAnimate?: boolean;
7
+ mode?: 'hide' | 'show' | 'auto';
8
+ };
9
+ declare class Start extends Plugin {
10
+ /**
11
+ * @type IStartConfig
12
+ */
13
+ static get defaultConfig(): IStartConfig;
14
+ constructor(args: any);
15
+ autoPlayStart: boolean;
16
+ clickHandler: any;
17
+ onPlayerReset: () => void;
18
+ onAutoplayStart: () => void;
19
+ registerIcons(): {
20
+ startPlay: {
21
+ icon: any;
22
+ class: string;
23
+ };
24
+ startPause: {
25
+ icon: any;
26
+ class: string;
27
+ };
28
+ };
29
+ initIcons(): void;
30
+ show(): void;
31
+ focusHide(): void;
32
+ recover(): void;
33
+ switchStatus(isAnimate: any): void;
34
+ animate(endShow: any): void;
35
+ _animateId: any;
36
+ endAnimate(): void;
37
+ switchPausePlay(e: any): void;
38
+ onPlayPause(status: any): void;
39
+ render(): string;
40
+ }
41
+ import Plugin from "../../plugin";
@@ -0,0 +1,267 @@
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 { READY, AUTOPLAY_STARTED, AUTOPLAY_PREVENTED, PLAY, PAUSE, RESET } from "../../events.js";
4
+ import "../../utils/debug.js";
5
+ import Plugin from "../../plugin/plugin.js";
6
+ import { STATES } from "../../state.js";
7
+ import PlaySvg from "../assets/play.js";
8
+ import PauseSvg from "../assets/pause.js";
9
+ var AnimateMap = {};
10
+ function addAnimate(key, seconds) {
11
+ var callback = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
12
+ start: null,
13
+ end: null
14
+ };
15
+ if (AnimateMap[key]) {
16
+ window.clearTimeout(AnimateMap[key].id);
17
+ }
18
+ AnimateMap[key] = {};
19
+ callback.start && callback.start();
20
+ AnimateMap[key].id = window.setTimeout(function() {
21
+ callback.end && callback.end();
22
+ window.clearTimeout(AnimateMap[key].id);
23
+ delete AnimateMap[key];
24
+ }, seconds);
25
+ return AnimateMap[key].id;
26
+ }
27
+ function clearAnimation(id) {
28
+ if (id) {
29
+ window.clearTimeout(id);
30
+ return;
31
+ }
32
+ Object.keys(AnimateMap).map(function(key) {
33
+ window.clearTimeout(AnimateMap[key].id);
34
+ delete AnimateMap[key];
35
+ });
36
+ }
37
+ var Start = /* @__PURE__ */ function(_Plugin) {
38
+ _inherits(Start2, _Plugin);
39
+ var _super = _createSuper(Start2);
40
+ function Start2(args) {
41
+ var _this;
42
+ _classCallCheck(this, Start2);
43
+ _this = _super.call(this, args);
44
+ _defineProperty(_assertThisInitialized(_this), "onPlayerReset", function() {
45
+ _this.autoPlayStart = false;
46
+ var className = _this.config.mode === "auto" ? "auto-hide" : "hide";
47
+ _this.setAttr("data-state", "play");
48
+ util.removeClass(_this.root, className);
49
+ _this.show();
50
+ });
51
+ _defineProperty(_assertThisInitialized(_this), "onAutoplayStart", function() {
52
+ if (_this.autoPlayStart) {
53
+ return;
54
+ }
55
+ var className = _this.config.mode === "auto" ? "auto-hide" : "hide";
56
+ util.addClass(_this.root, className);
57
+ _this.autoPlayStart = true;
58
+ _this.onPlayPause("play");
59
+ });
60
+ _this.autoPlayStart = false;
61
+ return _this;
62
+ }
63
+ _createClass(Start2, [{
64
+ key: "afterCreate",
65
+ value: function afterCreate() {
66
+ var _this2 = this;
67
+ var player = this.player, playerConfig = this.playerConfig;
68
+ this.initIcons();
69
+ this.once(READY, function() {
70
+ if (playerConfig) {
71
+ if (playerConfig.lang && playerConfig.lang === "en") {
72
+ util.addClass(player.root, "lang-is-en");
73
+ } else if (playerConfig.lang === "jp") {
74
+ util.addClass(player.root, "lang-is-jp");
75
+ }
76
+ }
77
+ });
78
+ this.on(AUTOPLAY_STARTED, this.onAutoplayStart);
79
+ if (!playerConfig.autoplay) {
80
+ this.show();
81
+ }
82
+ this.on(AUTOPLAY_PREVENTED, function() {
83
+ var className = _this2.config.mode === "auto" ? "auto-hide" : "hide";
84
+ _this2.setAttr("data-state", "play");
85
+ util.removeClass(_this2.root, className);
86
+ _this2.show();
87
+ });
88
+ this.on(PLAY, function() {
89
+ _this2.onPlayPause("play");
90
+ });
91
+ this.on(PAUSE, function() {
92
+ _this2.onPlayPause("pause");
93
+ });
94
+ this.on(RESET, function() {
95
+ _this2.onPlayerReset();
96
+ });
97
+ this.clickHandler = this.hook("startClick", this.switchPausePlay, {
98
+ pre: function pre(e) {
99
+ e.cancelable && e.preventDefault();
100
+ e.stopPropagation();
101
+ var paused = _this2.player.paused;
102
+ _this2.emitUserAction(e, "switch_play_pause", {
103
+ props: "paused",
104
+ from: paused,
105
+ to: !paused
106
+ });
107
+ }
108
+ });
109
+ this.bind(["click", "touchend"], this.clickHandler);
110
+ }
111
+ }, {
112
+ key: "registerIcons",
113
+ value: function registerIcons() {
114
+ return {
115
+ startPlay: {
116
+ icon: PlaySvg,
117
+ class: "xg-icon-play"
118
+ },
119
+ startPause: {
120
+ icon: PauseSvg,
121
+ class: "xg-icon-pause"
122
+ }
123
+ };
124
+ }
125
+ }, {
126
+ key: "initIcons",
127
+ value: function initIcons() {
128
+ var icons = this.icons;
129
+ this.appendChild("xg-start-inner", icons.startPlay);
130
+ this.appendChild("xg-start-inner", icons.startPause);
131
+ }
132
+ }, {
133
+ key: "hide",
134
+ value: function hide() {
135
+ util.addClass(this.root, "hide");
136
+ }
137
+ }, {
138
+ key: "show",
139
+ value: function show() {
140
+ util.removeClass(this.root, "hide");
141
+ }
142
+ }, {
143
+ key: "focusHide",
144
+ value: function focusHide() {
145
+ util.addClass(this.root, "focus-hide");
146
+ }
147
+ }, {
148
+ key: "recover",
149
+ value: function recover() {
150
+ util.removeClass(this.root, "focus-hide");
151
+ }
152
+ }, {
153
+ key: "switchStatus",
154
+ value: function switchStatus(isAnimate) {
155
+ if (isAnimate) {
156
+ this.setAttr("data-state", !this.player.paused ? "play" : "pause");
157
+ } else {
158
+ this.setAttr("data-state", this.player.paused ? "play" : "pause");
159
+ }
160
+ }
161
+ }, {
162
+ key: "animate",
163
+ value: function animate(endShow) {
164
+ var _this3 = this;
165
+ this._animateId = addAnimate("pauseplay", 400, {
166
+ start: function start() {
167
+ util.addClass(_this3.root, "interact");
168
+ _this3.show();
169
+ _this3.switchStatus(true);
170
+ },
171
+ end: function end() {
172
+ util.removeClass(_this3.root, "interact");
173
+ !endShow && _this3.hide();
174
+ _this3._animateId = null;
175
+ }
176
+ });
177
+ }
178
+ }, {
179
+ key: "endAnimate",
180
+ value: function endAnimate() {
181
+ util.removeClass(this.root, "interact");
182
+ clearAnimation(this._animateId);
183
+ this._animateId = null;
184
+ }
185
+ }, {
186
+ key: "switchPausePlay",
187
+ value: function switchPausePlay(e) {
188
+ var player = this.player;
189
+ e.cancelable && e.preventDefault();
190
+ e.stopPropagation();
191
+ if (player.state < STATES.READY) {
192
+ return;
193
+ }
194
+ var paused = this.player.paused;
195
+ if (!paused && player.state === STATES.RUNNING) {
196
+ player.pause();
197
+ } else {
198
+ player.play();
199
+ }
200
+ }
201
+ }, {
202
+ key: "onPlayPause",
203
+ value: function onPlayPause(status) {
204
+ var config = this.config, player = this.player;
205
+ if (!player || player.state < STATES.RUNNING || !this.autoPlayStart) {
206
+ return;
207
+ }
208
+ if (config.mode === "show") {
209
+ this.switchStatus();
210
+ this.show();
211
+ return;
212
+ }
213
+ if (config.mode === "auto") {
214
+ this.switchStatus();
215
+ return;
216
+ }
217
+ if (config.isShowPause && player.paused && !player.ended || config.isShowEnd && player.ended) {
218
+ this.switchStatus();
219
+ this.show();
220
+ this.endAnimate();
221
+ return;
222
+ }
223
+ if (config.disableAnimate) {
224
+ this.switchStatus();
225
+ this.hide();
226
+ return;
227
+ }
228
+ if (status === "play") {
229
+ this.autoPlayStart ? this.animate() : this.hide();
230
+ } else {
231
+ if (!this.autoPlayStart || player.ended) {
232
+ return;
233
+ }
234
+ this.animate();
235
+ }
236
+ }
237
+ }, {
238
+ key: "destroy",
239
+ value: function destroy() {
240
+ this.unbind(["click", "touchend"], this.clickHandler);
241
+ clearAnimation(this._animateId);
242
+ }
243
+ }, {
244
+ key: "render",
245
+ value: function render() {
246
+ var className = this.playerConfig.autoplay ? this.config.mode === "auto" ? "auto-hide" : "hide" : "";
247
+ return '\n <xg-start class="xgplayer-start '.concat(className, '">\n <xg-start-inner></xg-start-inner>\n </xg-start>');
248
+ }
249
+ }], [{
250
+ key: "pluginName",
251
+ get: function get() {
252
+ return "start";
253
+ }
254
+ }, {
255
+ key: "defaultConfig",
256
+ get: function get() {
257
+ return {
258
+ isShowPause: false,
259
+ isShowEnd: false,
260
+ disableAnimate: false,
261
+ mode: "hide"
262
+ };
263
+ }
264
+ }]);
265
+ return Start2;
266
+ }(Plugin);
267
+ export { Start as default };
@@ -0,0 +1,115 @@
1
+ @import "../../style/variable";
2
+
3
+ .xgplayer {
4
+ @keyframes playPause {
5
+ 0%{
6
+ transform: scale(1);
7
+ opacity:1;
8
+ }
9
+ 99%{
10
+ transform: scale(1.3);
11
+ opacity:0;
12
+ }
13
+ to {
14
+ transform: scale(1);
15
+ opacity:0;
16
+ }
17
+ }
18
+ xg-start-inner {
19
+ display: block;
20
+ width: 100%;
21
+ height: 100%;
22
+ overflow: hidden;
23
+ border-radius: 50%;
24
+ background: $startBgColor;
25
+ }
26
+ .xgplayer-start {
27
+ width: 70px;
28
+ height: 70px;
29
+ position: absolute;
30
+ left: 50%;
31
+ top: 50%;
32
+ z-index: 5;
33
+ transform: translate(-50%, -50%);
34
+ cursor: pointer;
35
+ svg {
36
+ width: 100%;
37
+ height: 100%;
38
+ }
39
+ &.hide {
40
+ display: none;
41
+ pointer-events: none;
42
+ }
43
+ &.focus-hide {
44
+ display: none;
45
+ pointer-events: none;
46
+ }
47
+ &:hover{
48
+ opacity: 0.85;
49
+ }
50
+ .xg-icon-play {
51
+ display: block;
52
+ }
53
+ .xg-icon-pause {
54
+ display: none;
55
+ }
56
+ &[data-state=pause] {
57
+ .xg-icon-play {
58
+ display: none;
59
+ }
60
+ .xg-icon-pause {
61
+ display: block;
62
+ }
63
+ }
64
+ &.interact {
65
+ xg-start-inner {
66
+ animation: playPause .4s 0.1s ease-out forwards;
67
+ }
68
+ display: block;
69
+ }
70
+ // &.hide {
71
+ // display: none;
72
+ // }
73
+ &.show {
74
+ display: block;
75
+ }
76
+ }
77
+ &.xgplayer-mobile {
78
+ xg-start-inner {
79
+ background: initial;
80
+ border-radius: 0;
81
+ }
82
+ .xgplayer-start {
83
+ height: 50px;
84
+ width: 50px;
85
+ &:hover{
86
+ opacity: 1;
87
+ }
88
+ }
89
+ }
90
+ // &.xgplayer-ended {
91
+ // .xgplayer-start {
92
+ // display: none;
93
+ // }
94
+ // }
95
+ &.xgplayer-inactive, &.xgplayer-is-enter {
96
+ .xgplayer-start {
97
+ &.auto-hide {
98
+ display: none;
99
+ }
100
+ }
101
+ }
102
+ &.xgplayer-isloading.xgplayer-playing {
103
+ .xgplayer-start {
104
+ display: none;
105
+ }
106
+ }
107
+ &.xgplayer-is-enter, &.xgplayer-is-error {
108
+ .xgplayer-start {
109
+ display: none;
110
+ &.show {
111
+ display: none;
112
+ }
113
+ }
114
+ }
115
+ }