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,22 @@
1
+ export default class NativeSubTitle {
2
+ constructor(media: any);
3
+ _media: any;
4
+ _list: any[];
5
+ _languages: string;
6
+ curIndex: number;
7
+ _init(): void;
8
+ _onChange: (e: any) => void;
9
+ /**
10
+ * @description 切换字幕
11
+ * @param { null | {
12
+ * id: any,
13
+ * language: any
14
+ * }} data
15
+ */
16
+ switch(data: null | {
17
+ id: any;
18
+ language: any;
19
+ }): void;
20
+ switchOff(): void;
21
+ destroy(): void;
22
+ }
@@ -0,0 +1,94 @@
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 EventEmitter from "eventemitter3";
3
+ var NativeSubTitle = /* @__PURE__ */ function(_EventEmitter) {
4
+ _inherits(NativeSubTitle2, _EventEmitter);
5
+ var _super = _createSuper(NativeSubTitle2);
6
+ function NativeSubTitle2(media) {
7
+ var _this;
8
+ _classCallCheck(this, NativeSubTitle2);
9
+ _this = _super.call(this);
10
+ _defineProperty(_assertThisInitialized(_this), "_onChange", function(e) {
11
+ var _list = _this._media.textTracks;
12
+ if (!_list || _list.length === 0) {
13
+ return;
14
+ }
15
+ var retList = [];
16
+ var langs = [];
17
+ var curIndex = -1;
18
+ for (var i = 0; i < _list.length; i++) {
19
+ var item = _list[i];
20
+ if (item.kind === "subtitles") {
21
+ retList.push({
22
+ id: item.id || item.language,
23
+ language: item.language,
24
+ text: item.label,
25
+ isDefault: item.mode === "showing"
26
+ });
27
+ if (curIndex === -1 && item.mode === "showing") {
28
+ curIndex = i;
29
+ }
30
+ langs.push(item.language);
31
+ }
32
+ }
33
+ if (langs.join("|") !== _this._languages) {
34
+ _this._languages = langs.join("|");
35
+ _this.emit("reset", {
36
+ list: retList,
37
+ isOpen: curIndex > -1
38
+ });
39
+ } else if (curIndex === -1) {
40
+ _this.emit("off");
41
+ } else if (_this.curIndex !== curIndex) {
42
+ _this.emit("change", retList[curIndex]);
43
+ }
44
+ _this.curIndex = curIndex;
45
+ });
46
+ _this._media = media;
47
+ _this._list = [];
48
+ _this._languages = "";
49
+ _this.curIndex = -1;
50
+ _this._init();
51
+ return _this;
52
+ }
53
+ _createClass(NativeSubTitle2, [{
54
+ key: "_init",
55
+ value: function _init() {
56
+ var _list = this._media.textTracks;
57
+ _list.addEventListener("change", this._onChange);
58
+ }
59
+ }, {
60
+ key: "switch",
61
+ value: function _switch(data) {
62
+ var _tracks = this._media.textTracks;
63
+ for (var i = 0; i < _tracks.length; i++) {
64
+ var item = _tracks[i];
65
+ if (item.language === data.language) {
66
+ item.mode = "showing";
67
+ } else if (item.mode === "showing") {
68
+ item.mode = "disabled";
69
+ }
70
+ }
71
+ }
72
+ }, {
73
+ key: "switchOff",
74
+ value: function switchOff() {
75
+ var _tracks = this._media.textTracks;
76
+ for (var i = 0; i < _tracks.length; i++) {
77
+ _tracks[i].mode = "disabled";
78
+ }
79
+ this.curIndex = -1;
80
+ }
81
+ }, {
82
+ key: "destroy",
83
+ value: function destroy() {
84
+ var _list = this._media.textTracks;
85
+ _list.removeEventListener("change", this._onChange);
86
+ this._media = null;
87
+ this._list = [];
88
+ this._languages = "";
89
+ this.curIndex = -1;
90
+ }
91
+ }]);
92
+ return NativeSubTitle2;
93
+ }(EventEmitter);
94
+ export { NativeSubTitle as default };
@@ -0,0 +1,95 @@
1
+ .xgplayer .xgplayer-volume.slide-show .xgplayer-slider {
2
+ display: block;
3
+ }
4
+ .xgplayer .xgplayer-slider {
5
+ display: none;
6
+ position: absolute;
7
+ width: 28px;
8
+ height: 92px;
9
+ background: rgba(0, 0, 0, 0.54);
10
+ border-radius: 1px;
11
+ bottom: 40px;
12
+ outline: none;
13
+ }
14
+ .xgplayer .xgplayer-slider:after {
15
+ content: " ";
16
+ display: block;
17
+ height: 15px;
18
+ width: 28px;
19
+ position: absolute;
20
+ bottom: -15px;
21
+ left: 0;
22
+ z-index: 20;
23
+ cursor: initial;
24
+ }
25
+ .xgplayer .xgplayer-value-label {
26
+ position: absolute;
27
+ left: 0;
28
+ right: 0;
29
+ bottom: 100%;
30
+ padding: 5px 0 0 0;
31
+ font-size: 12px;
32
+ background-color: rgba(0, 0, 0, 0.54);
33
+ color: #fff;
34
+ text-align: center;
35
+ }
36
+ .xgplayer .xgplayer-bar, .xgplayer .xgplayer-drag {
37
+ display: block;
38
+ position: absolute;
39
+ bottom: 6px;
40
+ left: 12px;
41
+ background: rgba(255, 255, 255, 0.3);
42
+ border-radius: 100px;
43
+ width: 4px;
44
+ height: 76px;
45
+ outline: none;
46
+ cursor: pointer;
47
+ }
48
+ .xgplayer .xgplayer-drag {
49
+ bottom: 0;
50
+ left: 0;
51
+ background: #FA1F41;
52
+ max-height: 76px;
53
+ }
54
+ .xgplayer .xgplayer-drag:after {
55
+ content: " ";
56
+ display: inline-block;
57
+ width: 8px;
58
+ height: 8px;
59
+ background: #fff;
60
+ box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.26);
61
+ position: absolute;
62
+ border-radius: 50%;
63
+ left: -2px;
64
+ top: -4px;
65
+ }
66
+ .xgplayer .xgplayer-volume[data-state=normal] .xg-volume {
67
+ display: block;
68
+ }
69
+ .xgplayer .xgplayer-volume[data-state=normal] .xg-volume-small {
70
+ display: none;
71
+ }
72
+ .xgplayer .xgplayer-volume[data-state=normal] .xg-volume-mute {
73
+ display: none;
74
+ }
75
+ .xgplayer .xgplayer-volume[data-state=small] .xg-volume {
76
+ display: none;
77
+ }
78
+ .xgplayer .xgplayer-volume[data-state=small] .xg-volume-small {
79
+ display: block;
80
+ }
81
+ .xgplayer .xgplayer-volume[data-state=small] .xg-volume-mute {
82
+ display: none;
83
+ }
84
+ .xgplayer .xgplayer-volume[data-state=mute] .xg-volume {
85
+ display: none;
86
+ }
87
+ .xgplayer .xgplayer-volume[data-state=mute] .xg-volume-small {
88
+ display: none;
89
+ }
90
+ .xgplayer .xgplayer-volume[data-state=mute] .xg-volume-mute {
91
+ display: block;
92
+ }
93
+ .xgplayer.xgplayer-mobile .xgplayer-volume .xgplayer-slider {
94
+ display: none;
95
+ }
@@ -0,0 +1,88 @@
1
+ export default Volume;
2
+ export type IVolumeConfig = {
3
+ [propName: string]: any;
4
+ position?: string;
5
+ index?: number;
6
+ disable?: boolean;
7
+ showValueLabel?: boolean;
8
+ default?: number;
9
+ };
10
+ /**
11
+ * @typedef {{
12
+ * position?: string, // [可选]插件挂载的dom
13
+ * index?: number // [可选]插件在播放器中挂载的位置
14
+ * disable?: boolean, // [可选]是否禁用插件交互行为
15
+ * showValueLabel?: boolean, // [可选]是否显示当前滑动的音量数值
16
+ * default?: number // [可选]默认
17
+ * [propName: string]: any
18
+ * }} IVolumeConfig
19
+ */
20
+ declare class Volume extends Plugin {
21
+ /**
22
+ * @type IVolumeConfig
23
+ */
24
+ static get defaultConfig(): IVolumeConfig;
25
+ registerIcons(): {
26
+ volumeSmall: {
27
+ icon: any;
28
+ class: string;
29
+ };
30
+ volumeLarge: {
31
+ icon: any;
32
+ class: string;
33
+ };
34
+ volumeMuted: {
35
+ icon: any;
36
+ class: string;
37
+ };
38
+ };
39
+ _timerId: any;
40
+ _d: {
41
+ isStart: boolean;
42
+ isMoving: boolean;
43
+ isActive: boolean;
44
+ };
45
+ changeMutedHandler: any;
46
+ _onMouseenterHandler: any;
47
+ _onMouseleaveHandler: any;
48
+ onBarMousedown: (e: any) => boolean;
49
+ pos: {
50
+ x: number;
51
+ y: number;
52
+ clientX: number;
53
+ clientY: number;
54
+ offsetX: number;
55
+ offsetY: number;
56
+ pageX: number;
57
+ pageY: number;
58
+ };
59
+ onBarMouseMove: (e: any) => void;
60
+ onBarMouseUp: (e: any) => void;
61
+ updateVolumePos(height: any, event: any): void;
62
+ /**
63
+ * 修改音量数值标签
64
+ *
65
+ * @memberof Volume
66
+ */
67
+ updateVolumeValue(): void;
68
+ /**
69
+ * @desc 聚焦
70
+ */
71
+ focus(): void;
72
+ /**
73
+ * 失去焦点
74
+ * @param { number } delay 延迟隐藏时长,ms
75
+ * @param { boolean } isForce 是否立即隐藏控制栏
76
+ * @param { Event} [e] 事件
77
+ * @returns
78
+ */
79
+ unFocus(delay?: number, isForce?: boolean, e?: Event): void;
80
+ onMouseenter: (e: any) => void;
81
+ onMouseleave: (e: any) => void;
82
+ changeMuted(e: any): void;
83
+ onVolumeChange: (e: any) => void;
84
+ animate(muted: any, volume: any): void;
85
+ initIcons(): void;
86
+ render(): string;
87
+ }
88
+ import Plugin from "../../plugin";
@@ -0,0 +1,319 @@
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 { VOLUME_CHANGE, LOADED_DATA } from "../../events.js";
5
+ import "../../utils/debug.js";
6
+ import Plugin, { POSITIONS } from "../../plugin/plugin.js";
7
+ import volumeLargeSvg from "../assets/volumeLarge.js";
8
+ import volumeSmallSvg from "../assets/volumeSmall.js";
9
+ import volumeMutedSvg from "../assets/volumeMuted.js";
10
+ var Volume = /* @__PURE__ */ function(_Plugin) {
11
+ _inherits(Volume2, _Plugin);
12
+ var _super = _createSuper(Volume2);
13
+ function Volume2() {
14
+ var _this;
15
+ _classCallCheck(this, Volume2);
16
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
17
+ args[_key] = arguments[_key];
18
+ }
19
+ _this = _super.call.apply(_super, [this].concat(args));
20
+ _defineProperty(_assertThisInitialized(_this), "onBarMousedown", function(e) {
21
+ var _assertThisInitialize = _assertThisInitialized(_this), player = _assertThisInitialize.player;
22
+ var bar = _this.find(".xgplayer-bar");
23
+ util.event(e);
24
+ var barRect = bar.getBoundingClientRect();
25
+ var pos = util.getEventPos(e, player.zoom);
26
+ var height = barRect.height - (pos.clientY - barRect.top);
27
+ pos.h = height;
28
+ pos.barH = barRect.height;
29
+ _this.pos = pos;
30
+ if (height < -2) {
31
+ return;
32
+ }
33
+ _this.updateVolumePos(height, e);
34
+ document.addEventListener("mouseup", _this.onBarMouseUp);
35
+ _this._d.isStart = true;
36
+ return false;
37
+ });
38
+ _defineProperty(_assertThisInitialized(_this), "onBarMouseMove", function(e) {
39
+ var _assertThisInitialize2 = _assertThisInitialized(_this), _d = _assertThisInitialize2._d;
40
+ if (!_d.isStart) {
41
+ return;
42
+ }
43
+ var _assertThisInitialize3 = _assertThisInitialized(_this), pos = _assertThisInitialize3.pos, player = _assertThisInitialize3.player;
44
+ e.preventDefault();
45
+ e.stopPropagation();
46
+ util.event(e);
47
+ var _ePos = util.getEventPos(e, player.zoom);
48
+ _d.isMoving = true;
49
+ var w = pos.h - _ePos.clientY + pos.clientY;
50
+ if (w > pos.barH) {
51
+ return;
52
+ }
53
+ _this.updateVolumePos(w, e);
54
+ });
55
+ _defineProperty(_assertThisInitialized(_this), "onBarMouseUp", function(e) {
56
+ util.event(e);
57
+ document.removeEventListener("mouseup", _this.onBarMouseUp);
58
+ var _assertThisInitialize4 = _assertThisInitialized(_this), _d = _assertThisInitialize4._d;
59
+ _d.isStart = false;
60
+ _d.isMoving = false;
61
+ });
62
+ _defineProperty(_assertThisInitialized(_this), "onMouseenter", function(e) {
63
+ _this._d.isActive = true;
64
+ _this.focus();
65
+ _this.emit("icon_mouseenter", {
66
+ pluginName: _this.pluginName
67
+ });
68
+ });
69
+ _defineProperty(_assertThisInitialized(_this), "onMouseleave", function(e) {
70
+ _this._d.isActive = false;
71
+ _this.unFocus(100, false, e);
72
+ _this.emit("icon_mouseleave", {
73
+ pluginName: _this.pluginName
74
+ });
75
+ });
76
+ _defineProperty(_assertThisInitialized(_this), "onVolumeChange", function(e) {
77
+ if (!_this.player) {
78
+ return;
79
+ }
80
+ var _this$player = _this.player, muted = _this$player.muted, volume = _this$player.volume;
81
+ if (!_this._d.isMoving) {
82
+ _this.find(".xgplayer-drag").style.height = muted || volume === 0 ? "4px" : "".concat(volume * 100, "%");
83
+ if (_this.config.showValueLabel) {
84
+ _this.updateVolumeValue();
85
+ }
86
+ }
87
+ _this.animate(muted, volume);
88
+ });
89
+ return _this;
90
+ }
91
+ _createClass(Volume2, [{
92
+ key: "registerIcons",
93
+ value: function registerIcons() {
94
+ return {
95
+ volumeSmall: {
96
+ icon: volumeSmallSvg,
97
+ class: "xg-volume-small"
98
+ },
99
+ volumeLarge: {
100
+ icon: volumeLargeSvg,
101
+ class: "xg-volume"
102
+ },
103
+ volumeMuted: {
104
+ icon: volumeMutedSvg,
105
+ class: "xg-volume-mute"
106
+ }
107
+ };
108
+ }
109
+ }, {
110
+ key: "afterCreate",
111
+ value: function afterCreate() {
112
+ var _this2 = this;
113
+ this._timerId = null;
114
+ this._d = {
115
+ isStart: false,
116
+ isMoving: false,
117
+ isActive: false
118
+ };
119
+ if (this.config.disable) {
120
+ return;
121
+ }
122
+ this.initIcons();
123
+ var _this$playerConfig = this.playerConfig, commonStyle = _this$playerConfig.commonStyle, volume = _this$playerConfig.volume;
124
+ if (commonStyle.volumeColor) {
125
+ this.find(".xgplayer-drag").style.backgroundColor = commonStyle.volumeColor;
126
+ }
127
+ this.changeMutedHandler = this.hook("mutedChange", function(e) {
128
+ _this2.changeMuted(e);
129
+ }, {
130
+ pre: function pre(e) {
131
+ e.preventDefault();
132
+ e.stopPropagation();
133
+ }
134
+ });
135
+ this._onMouseenterHandler = this.hook("mouseenter", this.onMouseenter);
136
+ this._onMouseleaveHandler = this.hook("mouseleave", this.onMouseleave);
137
+ if (!(sniffer.device === "mobile") && this.playerConfig.isMobileSimulateMode !== "mobile") {
138
+ this.bind("mouseenter", this._onMouseenterHandler);
139
+ this.bind(["blur", "mouseleave"], this._onMouseleaveHandler);
140
+ this.bind(".xgplayer-slider", "mousedown", this.onBarMousedown);
141
+ this.bind(".xgplayer-slider", "mousemove", this.onBarMouseMove);
142
+ this.bind(".xgplayer-slider", "mouseup", this.onBarMouseUp);
143
+ }
144
+ this.bind(".xgplayer-icon", ["touchend", "click"], this.changeMutedHandler);
145
+ this.on(VOLUME_CHANGE, this.onVolumeChange);
146
+ this.once(LOADED_DATA, this.onVolumeChange);
147
+ if (util.typeOf(volume) !== "Number") {
148
+ this.player.volume = this.config.default;
149
+ }
150
+ this.onVolumeChange();
151
+ }
152
+ }, {
153
+ key: "updateVolumePos",
154
+ value: function updateVolumePos(height, event) {
155
+ var player = this.player;
156
+ var drag = this.find(".xgplayer-drag");
157
+ var bar = this.find(".xgplayer-bar");
158
+ if (!bar || !drag) {
159
+ return;
160
+ }
161
+ var now = parseInt(height / bar.getBoundingClientRect().height * 1e3, 10);
162
+ drag.style.height = "".concat(height, "px");
163
+ var to = Math.max(Math.min(now / 1e3, 1), 0);
164
+ var props = {
165
+ volume: {
166
+ from: player.volume,
167
+ to
168
+ }
169
+ };
170
+ if (player.muted) {
171
+ props.muted = {
172
+ from: true,
173
+ to: false
174
+ };
175
+ }
176
+ this.emitUserAction(event, "change_volume", {
177
+ muted: player.muted,
178
+ volume: player.volume,
179
+ props
180
+ });
181
+ player.volume = Math.max(Math.min(now / 1e3, 1), 0);
182
+ player.muted && (player.muted = false);
183
+ if (this.config.showValueLabel) {
184
+ this.updateVolumeValue();
185
+ }
186
+ }
187
+ }, {
188
+ key: "updateVolumeValue",
189
+ value: function updateVolumeValue() {
190
+ var _this$player2 = this.player, volume = _this$player2.volume, muted = _this$player2.muted;
191
+ var $labelValue = this.find(".xgplayer-value-label");
192
+ var vol = Math.max(Math.min(volume, 1), 0);
193
+ $labelValue.innerText = muted ? 0 : Math.ceil(vol * 100);
194
+ }
195
+ }, {
196
+ key: "focus",
197
+ value: function focus() {
198
+ var player = this.player;
199
+ player.focus({
200
+ autoHide: false
201
+ });
202
+ if (this._timerId) {
203
+ util.clearTimeout(this, this._timerId);
204
+ this._timerId = null;
205
+ }
206
+ util.addClass(this.root, "slide-show");
207
+ }
208
+ }, {
209
+ key: "unFocus",
210
+ value: function unFocus() {
211
+ var _this3 = this;
212
+ var delay = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 100;
213
+ var isForce = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
214
+ var e = arguments.length > 2 ? arguments[2] : void 0;
215
+ var _d = this._d, player = this.player;
216
+ if (_d.isActive) {
217
+ return;
218
+ }
219
+ if (this._timerId) {
220
+ util.clearTimeout(this, this._timerId);
221
+ this._timerId = null;
222
+ }
223
+ this._timerId = util.setTimeout(this, function() {
224
+ if (!_d.isActive) {
225
+ isForce ? player.blur() : player.focus();
226
+ util.removeClass(_this3.root, "slide-show");
227
+ _d.isStart && _this3.onBarMouseUp(e);
228
+ }
229
+ _this3._timerId = null;
230
+ }, delay);
231
+ }
232
+ }, {
233
+ key: "changeMuted",
234
+ value: function changeMuted(e) {
235
+ e && e.stopPropagation();
236
+ var player = this.player, _d = this._d;
237
+ _d.isStart && this.onBarMouseUp(e);
238
+ this.emitUserAction(e, "change_muted", {
239
+ muted: player.muted,
240
+ volume: player.volume,
241
+ props: {
242
+ muted: {
243
+ from: player.muted,
244
+ to: !player.muted
245
+ }
246
+ }
247
+ });
248
+ if (player.volume > 0) {
249
+ player.muted = !player.muted;
250
+ }
251
+ if (player.volume < 0.01) {
252
+ player.volume = this.config.miniVolume;
253
+ }
254
+ }
255
+ }, {
256
+ key: "animate",
257
+ value: function animate(muted, volume) {
258
+ if (muted || volume === 0) {
259
+ this.setAttr("data-state", "mute");
260
+ } else if (volume < 0.5 && this.icons.volumeSmall) {
261
+ this.setAttr("data-state", "small");
262
+ } else {
263
+ this.setAttr("data-state", "normal");
264
+ }
265
+ }
266
+ }, {
267
+ key: "initIcons",
268
+ value: function initIcons() {
269
+ var icons = this.icons;
270
+ this.appendChild(".xgplayer-icon", icons.volumeSmall);
271
+ this.appendChild(".xgplayer-icon", icons.volumeLarge);
272
+ this.appendChild(".xgplayer-icon", icons.volumeMuted);
273
+ }
274
+ }, {
275
+ key: "destroy",
276
+ value: function destroy() {
277
+ if (this._timerId) {
278
+ util.clearTimeout(this, this._timerId);
279
+ this._timerId = null;
280
+ }
281
+ this.unbind("mouseenter", this.onMouseenter);
282
+ this.unbind(["blur", "mouseleave"], this.onMouseleave);
283
+ this.unbind(".xgplayer-slider", "mousedown", this.onBarMousedown);
284
+ this.unbind(".xgplayer-slider", "mousemove", this.onBarMouseMove);
285
+ this.unbind(".xgplayer-slider", "mouseup", this.onBarMouseUp);
286
+ document.removeEventListener("mouseup", this.onBarMouseUp);
287
+ this.unbind(".xgplayer-icon", sniffer.device === "mobile" ? "touchend" : "click", this.changeMutedHandler);
288
+ }
289
+ }, {
290
+ key: "render",
291
+ value: function render() {
292
+ if (this.config.disable) {
293
+ return;
294
+ }
295
+ var volume = this.config.default || this.player.volume;
296
+ var isShowVolumeValue = this.config.showValueLabel;
297
+ return '\n <xg-icon class="xgplayer-volume" data-state="normal">\n <div class="xgplayer-icon">\n </div>\n <xg-slider class="xgplayer-slider">\n '.concat(isShowVolumeValue ? '<div class="xgplayer-value-label">'.concat(volume * 100, "</div>") : "", '\n <div class="xgplayer-bar">\n <xg-drag class="xgplayer-drag" style="height: ').concat(volume * 100, '%"></xg-drag>\n </div>\n </xg-slider>\n </xg-icon>');
298
+ }
299
+ }], [{
300
+ key: "pluginName",
301
+ get: function get() {
302
+ return "volume";
303
+ }
304
+ }, {
305
+ key: "defaultConfig",
306
+ get: function get() {
307
+ return {
308
+ position: POSITIONS.CONTROLS_RIGHT,
309
+ index: 1,
310
+ disable: false,
311
+ showValueLabel: false,
312
+ default: 0.6,
313
+ miniVolume: 0.2
314
+ };
315
+ }
316
+ }]);
317
+ return Volume2;
318
+ }(Plugin);
319
+ export { Volume as default };