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.
- package/browser/controls/airplay.js +1 -1
- package/browser/controls/cssFullscreen.js +1 -1
- package/browser/controls/danmu.js +3 -1
- package/browser/controls/definition.js +1 -1
- package/browser/controls/download.js +1 -1
- package/browser/controls/enter.js +1 -1
- package/browser/controls/error.js +1 -1
- package/browser/controls/errorRetry.js +1 -1
- package/browser/controls/flex.js +1 -1
- package/browser/controls/fullscreen.js +1 -1
- package/browser/controls/loading.js +1 -1
- package/browser/controls/memoryPlay.js +1 -1
- package/browser/controls/miniplayer.js +9 -7
- package/browser/controls/mobile.js +1 -1
- package/browser/controls/nativeTextTrack.js +1 -1
- package/browser/controls/pc.js +1 -1
- package/browser/controls/pip.js +1 -1
- package/browser/controls/play.js +1 -1
- package/browser/controls/playNext.js +1 -1
- package/browser/controls/playbackRate.js +1 -1
- package/browser/controls/poster.js +1 -1
- package/browser/controls/progress.js +1 -1
- package/browser/controls/reload.js +1 -1
- package/browser/controls/replay.js +1 -1
- package/browser/controls/rotate.js +1 -1
- package/browser/controls/screenShot.js +1 -1
- package/browser/controls/start.js +1 -1
- package/browser/controls/textTrack.js +1 -1
- package/browser/controls/time.js +1 -1
- package/browser/controls/volume.js +1 -1
- package/browser/core_player.js +1 -1
- package/browser/core_player.js.map +1 -1
- package/browser/index.js +11 -7
- package/browser/index.js.map +1 -1
- package/browser/simple_player.js +1 -1
- package/browser/simple_player.js.map +1 -1
- package/dist/controls/airplay.js +1 -1
- package/dist/controls/cssFullscreen.js +1 -1
- package/dist/controls/danmu.js +3 -1
- package/dist/controls/definition.js +1 -1
- package/dist/controls/download.js +1 -1
- package/dist/controls/enter.js +1 -1
- package/dist/controls/error.js +1 -1
- package/dist/controls/errorRetry.js +1 -1
- package/dist/controls/flex.js +1 -1
- package/dist/controls/fullscreen.js +1 -1
- package/dist/controls/loading.js +1 -1
- package/dist/controls/memoryPlay.js +1 -1
- package/dist/controls/miniplayer.js +9 -7
- package/dist/controls/mobile.js +1 -1
- package/dist/controls/nativeTextTrack.js +1 -1
- package/dist/controls/pc.js +1 -1
- package/dist/controls/pip.js +1 -1
- package/dist/controls/play.js +1 -1
- package/dist/controls/playNext.js +1 -1
- package/dist/controls/playbackRate.js +1 -1
- package/dist/controls/poster.js +1 -1
- package/dist/controls/progress.js +1 -1
- package/dist/controls/reload.js +1 -1
- package/dist/controls/replay.js +1 -1
- package/dist/controls/rotate.js +1 -1
- package/dist/controls/screenShot.js +1 -1
- package/dist/controls/start.js +1 -1
- package/dist/controls/textTrack.js +1 -1
- package/dist/controls/time.js +1 -1
- package/dist/controls/volume.js +1 -1
- package/dist/core_player.js +2960 -2889
- package/dist/core_player.js.map +1 -1
- package/dist/index.js +1938 -3321
- package/dist/index.js.map +1 -1
- package/dist/index.min.css +1 -0
- package/dist/index.min.js +2 -0
- package/dist/index.min.js.map +1 -0
- package/dist/simple_player.js +274 -281
- package/dist/simple_player.js.map +1 -1
- package/es/_virtual/_rollupPluginBabelHelpers.js +216 -0
- package/es/constant.d.ts +4 -0
- package/es/constant.js +5 -0
- package/es/controls/airplay.js +1 -1
- package/es/controls/cssFullscreen.js +1 -1
- package/es/controls/danmu.js +3 -1
- package/es/controls/definition.js +1 -1
- package/es/controls/download.js +1 -1
- package/es/controls/enter.js +1 -1
- package/es/controls/error.js +1 -1
- package/es/controls/errorRetry.js +1 -1
- package/es/controls/flex.js +1 -1
- package/es/controls/fullscreen.js +1 -1
- package/es/controls/i18n.js +1 -1
- package/es/controls/keyboard.js +1 -1
- package/es/controls/loading.js +1 -1
- package/es/controls/localPreview.js +1 -1
- package/es/controls/memoryPlay.js +1 -1
- package/es/controls/miniplayer.js +9 -7
- package/es/controls/mobile.js +1 -1
- package/es/controls/nativeTextTrack.js +1 -1
- package/es/controls/pc.js +1 -1
- package/es/controls/pip.js +1 -1
- package/es/controls/play.js +1 -1
- package/es/controls/playNext.js +1 -1
- package/es/controls/playbackRate.js +1 -1
- package/es/controls/poster.js +1 -1
- package/es/controls/progress.js +1 -1
- package/es/controls/reload.js +1 -1
- package/es/controls/replay.js +1 -1
- package/es/controls/rotate.js +1 -1
- package/es/controls/screenShot.js +1 -1
- package/es/controls/start.js +1 -1
- package/es/controls/textTrack.js +1 -1
- package/es/controls/time.js +1 -1
- package/es/controls/volume.js +1 -1
- package/es/core_player.js +1 -1
- package/es/core_player.js.map +1 -1
- package/es/defaultConfig.d.ts +243 -0
- package/es/defaultConfig.js +85 -0
- package/es/error.d.ts +114 -0
- package/es/error.js +75 -0
- package/es/events.d.ts +61 -0
- package/es/events.js +62 -0
- package/es/icons.d.ts +2 -0
- package/es/index.css +499 -0
- package/es/index.d.ts +25 -0
- package/es/index.js +11 -7
- package/es/index.js.map +1 -1
- package/es/index.scss +29 -0
- package/es/index.umd.d.ts +60 -0
- package/es/index.umd.js +30 -0
- package/es/lang/en.d.ts +91 -0
- package/es/lang/en.js +77 -0
- package/es/lang/i18n.d.ts +36 -0
- package/es/lang/i18n.js +122 -0
- package/es/lang/index.d.ts +2 -0
- package/es/lang/jp.d.ts +91 -0
- package/es/lang/jp.js +77 -0
- package/es/lang/zh-cn.d.ts +91 -0
- package/es/lang/zh-cn.js +77 -0
- package/es/lang/zh-hk.d.ts +91 -0
- package/es/lang/zh-hk.js +77 -0
- package/es/mediaProxy.d.ts +334 -0
- package/es/mediaProxy.js +623 -0
- package/es/player.d.ts +825 -0
- package/es/player.js +1945 -0
- package/es/plugin/basePlugin.d.ts +180 -0
- package/es/plugin/basePlugin.js +259 -0
- package/es/plugin/hooksDescriptor.d.ts +60 -0
- package/es/plugin/hooksDescriptor.js +149 -0
- package/es/plugin/index.d.ts +13 -0
- package/es/plugin/plugin.d.ts +207 -0
- package/es/plugin/plugin.js +542 -0
- package/es/plugin/pluginsManager.d.ts +162 -0
- package/es/plugin/pluginsManager.js +362 -0
- package/es/plugin/preset.d.ts +1 -0
- package/es/plugin/preset.js +28 -0
- package/es/plugin/resizeObserver.d.ts +3 -0
- package/es/plugin/resizeObserver.js +108 -0
- package/es/plugins/assets/back.js +4 -0
- package/es/plugins/assets/download.js +4 -0
- package/es/plugins/assets/exitCssFull.js +4 -0
- package/es/plugins/assets/exitFull.js +4 -0
- package/es/plugins/assets/loading.js +4 -0
- package/es/plugins/assets/panel.js +4 -0
- package/es/plugins/assets/pause.js +4 -0
- package/es/plugins/assets/pipIcon.js +4 -0
- package/es/plugins/assets/pipIconExit.js +4 -0
- package/es/plugins/assets/play.js +4 -0
- package/es/plugins/assets/playNext.js +4 -0
- package/es/plugins/assets/replay.js +4 -0
- package/es/plugins/assets/requestCssFull.js +7 -0
- package/es/plugins/assets/requestFull.js +4 -0
- package/es/plugins/assets/rotate.js +4 -0
- package/es/plugins/assets/seekicon.js +4 -0
- package/es/plugins/assets/volumeLarge.js +4 -0
- package/es/plugins/assets/volumeMuted.js +4 -0
- package/es/plugins/assets/volumeSmall.js +4 -0
- package/es/plugins/common/iconPlugin.d.ts +5 -0
- package/es/plugins/common/iconPlugin.js +42 -0
- package/es/plugins/common/iconTools.d.ts +1 -0
- package/es/plugins/common/iconTools.js +8 -0
- package/es/plugins/common/index.scss +2 -0
- package/es/plugins/common/optionList.d.ts +15 -0
- package/es/plugins/common/optionList.js +120 -0
- package/es/plugins/common/optionsIcon.d.ts +40 -0
- package/es/plugins/common/optionsIcon.js +304 -0
- package/es/plugins/common/optionsIcon.scss +154 -0
- package/es/plugins/common/thumbnail.d.ts +62 -0
- package/es/plugins/common/thumbnail.js +191 -0
- package/es/plugins/common/thumbnail.scss +27 -0
- package/es/plugins/controls/index.css +132 -0
- package/es/plugins/controls/index.d.ts +73 -0
- package/es/plugins/controls/index.js +189 -0
- package/es/plugins/controls/index.scss +204 -0
- package/es/plugins/cssFullScreen/index.css +12 -0
- package/es/plugins/cssFullScreen/index.d.ts +40 -0
- package/es/plugins/cssFullScreen/index.js +136 -0
- package/es/plugins/cssFullScreen/index.scss +19 -0
- package/es/plugins/danmu/danmuIcon.d.ts +24 -0
- package/es/plugins/danmu/danmuIcon.js +98 -0
- package/es/plugins/danmu/danmuPanel.d.ts +39 -0
- package/es/plugins/danmu/danmuPanel.js +81 -0
- package/es/plugins/danmu/index.css +603 -0
- package/es/plugins/danmu/index.d.ts +96 -0
- package/es/plugins/danmu/index.js +313 -0
- package/es/plugins/danmu/index.scss +356 -0
- package/es/plugins/definition/index.css +4 -0
- package/es/plugins/definition/index.d.ts +38 -0
- package/es/plugins/definition/index.js +164 -0
- package/es/plugins/definition/index.scss +4 -0
- package/es/plugins/download/index.css +13 -0
- package/es/plugins/download/index.d.ts +31 -0
- package/es/plugins/download/index.js +107 -0
- package/es/plugins/download/index.scss +22 -0
- package/es/plugins/dynamicBg/index.css +16 -0
- package/es/plugins/dynamicBg/index.d.ts +83 -0
- package/es/plugins/dynamicBg/index.js +316 -0
- package/es/plugins/dynamicBg/index.scss +19 -0
- package/es/plugins/enter/index.css +104 -0
- package/es/plugins/enter/index.d.ts +19 -0
- package/es/plugins/enter/index.js +46 -0
- package/es/plugins/enter/index.scss +78 -0
- package/es/plugins/error/index.css +29 -0
- package/es/plugins/error/index.d.ts +8 -0
- package/es/plugins/error/index.js +75 -0
- package/es/plugins/error/index.scss +34 -0
- package/es/plugins/fpsDetect/index.d.ts +34 -0
- package/es/plugins/fpsDetect/index.js +149 -0
- package/es/plugins/fullscreen/backicon.d.ts +17 -0
- package/es/plugins/fullscreen/backicon.js +72 -0
- package/es/plugins/fullscreen/index.css +23 -0
- package/es/plugins/fullscreen/index.d.ts +58 -0
- package/es/plugins/fullscreen/index.js +202 -0
- package/es/plugins/fullscreen/index.scss +35 -0
- package/es/plugins/gapJump/index.d.ts +21 -0
- package/es/plugins/gapJump/index.js +142 -0
- package/es/plugins/keyboard/index.d.ts +89 -0
- package/es/plugins/keyboard/index.js +421 -0
- package/es/plugins/loading/index.css +58 -0
- package/es/plugins/loading/index.d.ts +11 -0
- package/es/plugins/loading/index.js +43 -0
- package/es/plugins/loading/index.scss +70 -0
- package/es/plugins/logger/index.d.ts +54 -0
- package/es/plugins/logger/index.js +311 -0
- package/es/plugins/miniScreen/index.css +179 -0
- package/es/plugins/miniScreen/index.d.ts +68 -0
- package/es/plugins/miniScreen/index.js +212 -0
- package/es/plugins/miniScreen/index.scss +198 -0
- package/es/plugins/miniScreen/miniScreenIcon.d.ts +11 -0
- package/es/plugins/miniScreen/miniScreenIcon.js +56 -0
- package/es/plugins/mobile/index.css +181 -0
- package/es/plugins/mobile/index.d.ts +125 -0
- package/es/plugins/mobile/index.js +631 -0
- package/es/plugins/mobile/index.scss +180 -0
- package/es/plugins/mobile/touch.d.ts +43 -0
- package/es/plugins/mobile/touch.js +214 -0
- package/es/plugins/netAdaption/index.d.ts +5 -0
- package/es/plugins/pc/index.css +3 -0
- package/es/plugins/pc/index.d.ts +14 -0
- package/es/plugins/pc/index.js +199 -0
- package/es/plugins/pc/index.scss +5 -0
- package/es/plugins/pip/index.css +12 -0
- package/es/plugins/pip/index.d.ts +37 -0
- package/es/plugins/pip/index.js +222 -0
- package/es/plugins/pip/index.scss +21 -0
- package/es/plugins/play/index.css +12 -0
- package/es/plugins/play/index.d.ts +23 -0
- package/es/plugins/play/index.js +127 -0
- package/es/plugins/play/index.scss +18 -0
- package/es/plugins/playNext/index.css +22 -0
- package/es/plugins/playNext/index.d.ts +19 -0
- package/es/plugins/playNext/index.js +104 -0
- package/es/plugins/playNext/index.scss +35 -0
- package/es/plugins/playbackRate/index.css +4 -0
- package/es/plugins/playbackRate/index.d.ts +31 -0
- package/es/plugins/playbackRate/index.js +140 -0
- package/es/plugins/playbackRate/index.scss +6 -0
- package/es/plugins/poster/index.css +39 -0
- package/es/plugins/poster/index.d.ts +27 -0
- package/es/plugins/poster/index.js +109 -0
- package/es/plugins/poster/index.scss +56 -0
- package/es/plugins/progress/index.css +234 -0
- package/es/plugins/progress/index.d.ts +178 -0
- package/es/plugins/progress/index.js +687 -0
- package/es/plugins/progress/index.scss +288 -0
- package/es/plugins/progress/innerList.d.ts +49 -0
- package/es/plugins/progress/innerList.js +285 -0
- package/es/plugins/progress/miniProgress.d.ts +9 -0
- package/es/plugins/progress/miniProgress.js +55 -0
- package/es/plugins/progressPreview/dotsApi.d.ts +1 -0
- package/es/plugins/progressPreview/dotsApi.js +269 -0
- package/es/plugins/progressPreview/index.css +190 -0
- package/es/plugins/progressPreview/index.d.ts +87 -0
- package/es/plugins/progressPreview/index.js +475 -0
- package/es/plugins/progressPreview/index.scss +235 -0
- package/es/plugins/prompt/index.css +47 -0
- package/es/plugins/prompt/index.d.ts +24 -0
- package/es/plugins/prompt/index.js +110 -0
- package/es/plugins/prompt/index.scss +53 -0
- package/es/plugins/replay/index.css +33 -0
- package/es/plugins/replay/index.d.ts +16 -0
- package/es/plugins/replay/index.js +109 -0
- package/es/plugins/replay/index.scss +41 -0
- package/es/plugins/rotate/index.css +0 -0
- package/es/plugins/rotate/index.d.ts +22 -0
- package/es/plugins/rotate/index.js +148 -0
- package/es/plugins/rotate/index.scss +0 -0
- package/es/plugins/rotate/index2.js +2 -0
- package/es/plugins/screenShot/index.css +3 -0
- package/es/plugins/screenShot/index.d.ts +30 -0
- package/es/plugins/screenShot/index.js +178 -0
- package/es/plugins/screenShot/index.scss +5 -0
- package/es/plugins/start/index.css +91 -0
- package/es/plugins/start/index.d.ts +41 -0
- package/es/plugins/start/index.js +267 -0
- package/es/plugins/start/index.scss +115 -0
- package/es/plugins/stats/index.d.ts +38 -0
- package/es/plugins/stats/index.js +194 -0
- package/es/plugins/testspeed/index.d.ts +26 -0
- package/es/plugins/testspeed/index.js +207 -0
- package/es/plugins/time/index.css +46 -0
- package/es/plugins/time/index.d.ts +28 -0
- package/es/plugins/time/index.js +225 -0
- package/es/plugins/time/index.scss +57 -0
- package/es/plugins/time/timesegments.d.ts +24 -0
- package/es/plugins/time/timesegments.js +216 -0
- package/es/plugins/track/index.css +91 -0
- package/es/plugins/track/index.d.ts +132 -0
- package/es/plugins/track/index.js +463 -0
- package/es/plugins/track/index.scss +111 -0
- package/es/plugins/track/nativeSubTitle.d.ts +22 -0
- package/es/plugins/track/nativeSubTitle.js +94 -0
- package/es/plugins/volume/index.css +95 -0
- package/es/plugins/volume/index.d.ts +88 -0
- package/es/plugins/volume/index.js +319 -0
- package/es/plugins/volume/index.scss +124 -0
- package/es/plugins/waitingTimeoutJump/index.d.ts +15 -0
- package/es/plugins/waitingTimeoutJump/index.js +88 -0
- package/es/presets/default-en.d.ts +33 -0
- package/es/presets/default-en.js +63 -0
- package/es/presets/default.d.ts +34 -0
- package/es/presets/default.js +70 -0
- package/es/presets/index.d.ts +4 -0
- package/es/presets/live.d.ts +94 -0
- package/es/presets/live.js +39 -0
- package/es/presets/mobile.d.ts +103 -0
- package/es/presets/mobile.js +34 -0
- package/es/simple_player.js +1 -1
- package/es/simple_player.js.map +1 -1
- package/es/state.d.ts +11 -0
- package/es/state.js +12 -0
- package/es/stateClassMap.d.ts +32 -0
- package/es/stateClassMap.js +32 -0
- package/es/style/common/animation.scss +16 -0
- package/es/style/common/svg-url.scss +70 -0
- package/es/style/common.scss +457 -0
- package/es/style/index.scss +4 -0
- package/es/style/variable.scss +76 -0
- package/es/utils/database.d.ts +31 -0
- package/es/utils/database.js +107 -0
- package/es/utils/debug.d.ts +10 -0
- package/es/utils/debug.js +43 -0
- package/es/utils/draggabilly.d.ts +54 -0
- package/es/utils/draggabilly.js +410 -0
- package/es/utils/sniffer.d.ts +28 -0
- package/es/utils/sniffer.js +150 -0
- package/es/utils/url.d.ts +1 -0
- package/es/utils/util.d.ts +304 -0
- package/es/utils/util.js +827 -0
- package/es/utils/xgplayerTimeRange.d.ts +7 -0
- package/es/utils/xgplayerTimeRange.js +25 -0
- package/es/version.d.ts +2 -0
- package/es/version.js +2 -0
- package/package.json +2 -3
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {{
|
|
3
|
+
* isShow?: boolean,
|
|
4
|
+
* urls?: Array<string>, // 有多张大图就多个url
|
|
5
|
+
* pic_num?: number, // 每张图含有几个雪碧图
|
|
6
|
+
* col?: number, // 截图列数
|
|
7
|
+
* row?: number, // 截图行数
|
|
8
|
+
* height?: number, // 缩略图高度
|
|
9
|
+
* width?: number, // 缩略图宽度
|
|
10
|
+
* scale?: number, // 缩放
|
|
11
|
+
* className?: string, // 额外添加在dom上的class
|
|
12
|
+
* hidePortrait?: boolean, // 是否在竖屏的时候隐藏
|
|
13
|
+
* [propName: string]: any
|
|
14
|
+
* }} IThumbnailConfig
|
|
15
|
+
*/
|
|
16
|
+
export default class Thumbnail extends BasePlugin {
|
|
17
|
+
/**
|
|
18
|
+
* @type IThumbnailConfig
|
|
19
|
+
*/
|
|
20
|
+
static get defaultConfig(): IThumbnailConfig;
|
|
21
|
+
constructor(args: any);
|
|
22
|
+
ratio: number;
|
|
23
|
+
interval: any;
|
|
24
|
+
_preloadMark: {};
|
|
25
|
+
setConfig(config: any): void;
|
|
26
|
+
get usable(): boolean;
|
|
27
|
+
initThumbnail(): void;
|
|
28
|
+
getUrlByIndex(index: any): any;
|
|
29
|
+
preload(index: any): void;
|
|
30
|
+
getPosition(now: any, containerWidth?: number, containerHeight?: number): {
|
|
31
|
+
urlIndex: number;
|
|
32
|
+
rowIndex: number;
|
|
33
|
+
colIndex: number;
|
|
34
|
+
url: any;
|
|
35
|
+
height: number;
|
|
36
|
+
width: number;
|
|
37
|
+
style: {
|
|
38
|
+
backgroundImage: string;
|
|
39
|
+
backgroundSize: string;
|
|
40
|
+
backgroundPosition: string;
|
|
41
|
+
width: string;
|
|
42
|
+
height: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
update(dom: any, now: any, containerWidth?: number, containerHeight?: number, customStyle?: string): void;
|
|
46
|
+
changeConfig(newConfig?: {}): void;
|
|
47
|
+
createThumbnail(root: any, className: any): HTMLElement;
|
|
48
|
+
}
|
|
49
|
+
export type IThumbnailConfig = {
|
|
50
|
+
[propName: string]: any;
|
|
51
|
+
isShow?: boolean;
|
|
52
|
+
urls?: Array<string>;
|
|
53
|
+
pic_num?: number;
|
|
54
|
+
col?: number;
|
|
55
|
+
row?: number;
|
|
56
|
+
height?: number;
|
|
57
|
+
width?: number;
|
|
58
|
+
scale?: number;
|
|
59
|
+
className?: string;
|
|
60
|
+
hidePortrait?: boolean;
|
|
61
|
+
};
|
|
62
|
+
import BasePlugin from "../../plugin";
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, createClass as _createClass } from "../../_virtual/_rollupPluginBabelHelpers.js";
|
|
2
|
+
import util from "../../utils/util.js";
|
|
3
|
+
import { DURATION_CHANGE } from "../../events.js";
|
|
4
|
+
import "../../utils/debug.js";
|
|
5
|
+
import Plugin from "../../plugin/plugin.js";
|
|
6
|
+
var Thumbnail = /* @__PURE__ */ function(_BasePlugin) {
|
|
7
|
+
_inherits(Thumbnail2, _BasePlugin);
|
|
8
|
+
var _super = _createSuper(Thumbnail2);
|
|
9
|
+
function Thumbnail2(args) {
|
|
10
|
+
var _this;
|
|
11
|
+
_classCallCheck(this, Thumbnail2);
|
|
12
|
+
_this = _super.call(this, args);
|
|
13
|
+
_this.ratio = 1;
|
|
14
|
+
_this.interval = null;
|
|
15
|
+
_this._preloadMark = {};
|
|
16
|
+
return _this;
|
|
17
|
+
}
|
|
18
|
+
_createClass(Thumbnail2, [{
|
|
19
|
+
key: "afterCreate",
|
|
20
|
+
value: function afterCreate() {
|
|
21
|
+
var _this2 = this;
|
|
22
|
+
if (this.usable) {
|
|
23
|
+
this.initThumbnail();
|
|
24
|
+
}
|
|
25
|
+
this.on([DURATION_CHANGE], function() {
|
|
26
|
+
var _this2$config = _this2.config, pic_num = _this2$config.pic_num, interval = _this2$config.interval;
|
|
27
|
+
_this2.usable && (_this2.interval = interval > 0 ? interval : Math.round(_this2.player.duration * 1e3 / pic_num) / 1e3);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}, {
|
|
31
|
+
key: "setConfig",
|
|
32
|
+
value: function setConfig(config) {
|
|
33
|
+
var _this3 = this;
|
|
34
|
+
if (!config) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
var keys = Object.keys(config);
|
|
38
|
+
if (keys.length < 1) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
keys.forEach(function(key) {
|
|
42
|
+
_this3.config[key] = config[key];
|
|
43
|
+
});
|
|
44
|
+
this.usable && this.initThumbnail();
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "usable",
|
|
48
|
+
get: function get() {
|
|
49
|
+
var _this$config = this.config, urls = _this$config.urls, pic_num = _this$config.pic_num;
|
|
50
|
+
return urls && urls.length > 0 && pic_num > 0;
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "initThumbnail",
|
|
54
|
+
value: function initThumbnail() {
|
|
55
|
+
var _this$config2 = this.config, width = _this$config2.width, height = _this$config2.height, pic_num = _this$config2.pic_num, interval = _this$config2.interval;
|
|
56
|
+
this.ratio = width / height * 100;
|
|
57
|
+
this.interval = interval || Math.round(this.player.duration / pic_num);
|
|
58
|
+
this._preloadMark = {};
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "getUrlByIndex",
|
|
62
|
+
value: function getUrlByIndex(index) {
|
|
63
|
+
return index >= 0 && index < this.config.urls.length ? this.config.urls[index] : "";
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
key: "preload",
|
|
67
|
+
value: function preload(index) {
|
|
68
|
+
var _this4 = this;
|
|
69
|
+
if (this._preloadMark[index]) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
var urls = this.config.urls;
|
|
73
|
+
var len = urls.length;
|
|
74
|
+
var arr = [];
|
|
75
|
+
index > 0 && arr.push(index - 1);
|
|
76
|
+
arr.push(index);
|
|
77
|
+
index > 0 && index < len - 1 && arr.push(index + 1);
|
|
78
|
+
arr.map(function(item) {
|
|
79
|
+
if (!_this4._preloadMark[item] && item >= 0 && item < len) {
|
|
80
|
+
_this4._preloadMark[item] = 1;
|
|
81
|
+
util.preloadImg(urls[item], function() {
|
|
82
|
+
_this4._preloadMark[item] = 2;
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
key: "getPosition",
|
|
89
|
+
value: function getPosition(now) {
|
|
90
|
+
var containerWidth = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
91
|
+
var containerHeight = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
|
|
92
|
+
var _this$config3 = this.config, pic_num = _this$config3.pic_num, row = _this$config3.row, col = _this$config3.col, width = _this$config3.width, height = _this$config3.height;
|
|
93
|
+
this.interval = Math.round(this.player.duration / pic_num);
|
|
94
|
+
var index = Math.ceil(now / this.interval);
|
|
95
|
+
index = index > pic_num ? pic_num : index;
|
|
96
|
+
var urlIndex = index < row * col ? 0 : Math.ceil(index / (row * col)) - 1;
|
|
97
|
+
var indexInPage = index - urlIndex * (col * row);
|
|
98
|
+
var rowIndex = indexInPage > 0 ? Math.ceil(indexInPage / col) - 1 : 0;
|
|
99
|
+
var colIndex = indexInPage > 0 ? indexInPage - rowIndex * col - 1 : 0;
|
|
100
|
+
var swidth = 0;
|
|
101
|
+
var sHeight = 0;
|
|
102
|
+
if (containerWidth && containerHeight) {
|
|
103
|
+
var per = containerWidth / containerHeight;
|
|
104
|
+
if (per < width / height) {
|
|
105
|
+
sHeight = containerHeight;
|
|
106
|
+
swidth = sHeight * (width / height);
|
|
107
|
+
} else {
|
|
108
|
+
swidth = containerWidth;
|
|
109
|
+
sHeight = swidth / (width / height);
|
|
110
|
+
}
|
|
111
|
+
} else if (!containerHeight) {
|
|
112
|
+
swidth = containerWidth || width;
|
|
113
|
+
sHeight = swidth / (width / height);
|
|
114
|
+
} else if (!containerWidth) {
|
|
115
|
+
sHeight = containerHeight || height;
|
|
116
|
+
swidth = sHeight * (width / height);
|
|
117
|
+
}
|
|
118
|
+
var url = this.getUrlByIndex(urlIndex);
|
|
119
|
+
return {
|
|
120
|
+
urlIndex,
|
|
121
|
+
rowIndex,
|
|
122
|
+
colIndex,
|
|
123
|
+
url,
|
|
124
|
+
height: sHeight,
|
|
125
|
+
width: swidth,
|
|
126
|
+
style: {
|
|
127
|
+
backgroundImage: "url(".concat(url, ")"),
|
|
128
|
+
backgroundSize: "".concat(swidth * col, "px auto"),
|
|
129
|
+
backgroundPosition: "-".concat(colIndex * swidth, "px -").concat(rowIndex * sHeight, "px"),
|
|
130
|
+
width: "".concat(swidth, "px"),
|
|
131
|
+
height: "".concat(sHeight, "px")
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}, {
|
|
136
|
+
key: "update",
|
|
137
|
+
value: function update(dom, now) {
|
|
138
|
+
var containerWidth = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
|
|
139
|
+
var containerHeight = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
|
|
140
|
+
var customStyle = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : "";
|
|
141
|
+
var _this$config4 = this.config, pic_num = _this$config4.pic_num, urls = _this$config4.urls;
|
|
142
|
+
if (pic_num <= 0 || !urls || urls.length === 0) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
var pos = this.getPosition(now, containerWidth, containerHeight);
|
|
146
|
+
this.preload(pos.urlIndex);
|
|
147
|
+
Object.keys(pos.style).map(function(key) {
|
|
148
|
+
dom.style[key] = pos.style[key];
|
|
149
|
+
});
|
|
150
|
+
Object.keys(customStyle).map(function(key) {
|
|
151
|
+
dom.style[key] = customStyle[key];
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}, {
|
|
155
|
+
key: "changeConfig",
|
|
156
|
+
value: function changeConfig() {
|
|
157
|
+
var newConfig = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
158
|
+
this.setConfig(newConfig);
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
key: "createThumbnail",
|
|
162
|
+
value: function createThumbnail(root, className) {
|
|
163
|
+
var dom = util.createDom("xg-thumbnail", "", {}, "thumbnail ".concat(className));
|
|
164
|
+
root && root.appendChild(dom);
|
|
165
|
+
return dom;
|
|
166
|
+
}
|
|
167
|
+
}], [{
|
|
168
|
+
key: "pluginName",
|
|
169
|
+
get: function get() {
|
|
170
|
+
return "thumbnail";
|
|
171
|
+
}
|
|
172
|
+
}, {
|
|
173
|
+
key: "defaultConfig",
|
|
174
|
+
get: function get() {
|
|
175
|
+
return {
|
|
176
|
+
isShow: false,
|
|
177
|
+
urls: [],
|
|
178
|
+
pic_num: 0,
|
|
179
|
+
col: 0,
|
|
180
|
+
row: 0,
|
|
181
|
+
height: 90,
|
|
182
|
+
width: 160,
|
|
183
|
+
scale: 1,
|
|
184
|
+
className: "",
|
|
185
|
+
hidePortrait: false
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}]);
|
|
189
|
+
return Thumbnail2;
|
|
190
|
+
}(Plugin);
|
|
191
|
+
export { Thumbnail as default };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
.xgplayer {
|
|
3
|
+
xg-thumbnail {
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
// .xgplayer {
|
|
8
|
+
// xg-thumbnail {
|
|
9
|
+
// display: none;
|
|
10
|
+
// position: relative;
|
|
11
|
+
// width: 160px;
|
|
12
|
+
// height: 90px;
|
|
13
|
+
// &.show {
|
|
14
|
+
// display: block;
|
|
15
|
+
// }
|
|
16
|
+
// }
|
|
17
|
+
|
|
18
|
+
// @media only screen and (max-width: 480px) {
|
|
19
|
+
// .xgplayer-mobile xg-thumbnail {
|
|
20
|
+
// width: 120px;
|
|
21
|
+
// height: 67px;
|
|
22
|
+
// &.portrait {
|
|
23
|
+
// display: none;
|
|
24
|
+
// }
|
|
25
|
+
// }
|
|
26
|
+
// }
|
|
27
|
+
// }
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
.xgplayer.not-allow-autoplay .xgplayer-controls, .xgplayer.xgplayer-nostart .xgplayer-controls {
|
|
2
|
+
pointer-events: none;
|
|
3
|
+
visibility: hidden;
|
|
4
|
+
cursor: default;
|
|
5
|
+
opacity: 0;
|
|
6
|
+
}
|
|
7
|
+
.xgplayer.xgplayer-inactive .controls-autohide {
|
|
8
|
+
pointer-events: none;
|
|
9
|
+
visibility: hidden;
|
|
10
|
+
cursor: default;
|
|
11
|
+
opacity: 0;
|
|
12
|
+
}
|
|
13
|
+
.xgplayer.not-allow-autoplay .xgplayer-controls-initshow, .xgplayer.xgplayer-nostart .xgplayer-controls-initshow {
|
|
14
|
+
pointer-events: auto;
|
|
15
|
+
visibility: visible;
|
|
16
|
+
opacity: 1;
|
|
17
|
+
}
|
|
18
|
+
.xgplayer .xgplayer-controls {
|
|
19
|
+
display: block;
|
|
20
|
+
position: absolute;
|
|
21
|
+
visibility: visible;
|
|
22
|
+
height: 48px;
|
|
23
|
+
left: 0;
|
|
24
|
+
right: 0;
|
|
25
|
+
bottom: 0;
|
|
26
|
+
opacity: 1;
|
|
27
|
+
z-index: 10;
|
|
28
|
+
background-image: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.37), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.75));
|
|
29
|
+
transition: opacity 0.5s ease, visibility 0.5s ease;
|
|
30
|
+
}
|
|
31
|
+
.xgplayer .xgplayer-controls.show {
|
|
32
|
+
display: block;
|
|
33
|
+
opacity: 1;
|
|
34
|
+
visibility: visible;
|
|
35
|
+
pointer-events: auto;
|
|
36
|
+
}
|
|
37
|
+
.xgplayer .xg-inner-controls {
|
|
38
|
+
position: absolute;
|
|
39
|
+
height: 40px;
|
|
40
|
+
bottom: 0;
|
|
41
|
+
justify-content: space-between;
|
|
42
|
+
display: flex;
|
|
43
|
+
}
|
|
44
|
+
.xgplayer .xg-left-grid, .xgplayer .xg-right-grid {
|
|
45
|
+
position: relative;
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-wrap: wrap;
|
|
48
|
+
flex-shrink: 1;
|
|
49
|
+
height: 100%;
|
|
50
|
+
z-index: 1;
|
|
51
|
+
}
|
|
52
|
+
.xgplayer .xg-right-grid {
|
|
53
|
+
flex-direction: row-reverse;
|
|
54
|
+
}
|
|
55
|
+
.xgplayer .xg-right-grid > :first-child {
|
|
56
|
+
margin-right: 0;
|
|
57
|
+
}
|
|
58
|
+
.xgplayer .xg-right-grid xg-icon {
|
|
59
|
+
margin-left: 0;
|
|
60
|
+
}
|
|
61
|
+
.xgplayer .xg-left-grid > :first-child {
|
|
62
|
+
margin-left: 0;
|
|
63
|
+
}
|
|
64
|
+
.xgplayer .xg-left-grid xg-icon {
|
|
65
|
+
margin-right: 0;
|
|
66
|
+
}
|
|
67
|
+
.xgplayer .xg-center-grid {
|
|
68
|
+
display: block;
|
|
69
|
+
position: absolute;
|
|
70
|
+
left: 0;
|
|
71
|
+
right: 0;
|
|
72
|
+
outline: none;
|
|
73
|
+
top: -20px;
|
|
74
|
+
padding: 5px 0;
|
|
75
|
+
text-align: center;
|
|
76
|
+
}
|
|
77
|
+
.xgplayer .flex-controls .xg-inner-controls {
|
|
78
|
+
justify-content: space-around;
|
|
79
|
+
display: flex;
|
|
80
|
+
bottom: 8px;
|
|
81
|
+
}
|
|
82
|
+
.xgplayer .flex-controls .xg-center-grid {
|
|
83
|
+
display: flex;
|
|
84
|
+
flex: 1;
|
|
85
|
+
position: relative;
|
|
86
|
+
top: 0;
|
|
87
|
+
height: 100%;
|
|
88
|
+
justify-content: space-between;
|
|
89
|
+
align-items: center;
|
|
90
|
+
left: 0;
|
|
91
|
+
right: 0;
|
|
92
|
+
padding: 0 16px;
|
|
93
|
+
}
|
|
94
|
+
.xgplayer.xgplayer-mobile .xg-center-grid {
|
|
95
|
+
z-index: 2;
|
|
96
|
+
}
|
|
97
|
+
.xgplayer.xgplayer-mobile .flex-controls .xg-center-grid {
|
|
98
|
+
padding: 0 8px;
|
|
99
|
+
}
|
|
100
|
+
.xgplayer .bottom-controls .xg-center-grid {
|
|
101
|
+
top: 20px;
|
|
102
|
+
padding: 0;
|
|
103
|
+
}
|
|
104
|
+
.xgplayer .bottom-controls .xg-left-grid, .xgplayer .bottom-controls .xg-right-grid {
|
|
105
|
+
bottom: 10px;
|
|
106
|
+
}
|
|
107
|
+
.xgplayer .mini-controls {
|
|
108
|
+
background-image: none;
|
|
109
|
+
}
|
|
110
|
+
.xgplayer .mini-controls .xg-inner-controls {
|
|
111
|
+
bottom: 0;
|
|
112
|
+
left: 0;
|
|
113
|
+
right: 0;
|
|
114
|
+
}
|
|
115
|
+
.xgplayer .mini-controls .xg-center-grid {
|
|
116
|
+
bottom: -28px;
|
|
117
|
+
top: auto;
|
|
118
|
+
padding: 0;
|
|
119
|
+
}
|
|
120
|
+
.xgplayer .mini-controls .xg-left-grid, .xgplayer .mini-controls .xg-right-grid {
|
|
121
|
+
display: none;
|
|
122
|
+
}
|
|
123
|
+
.xgplayer .controls-follow {
|
|
124
|
+
bottom: 70px;
|
|
125
|
+
transition: bottom 0.3s ease;
|
|
126
|
+
}
|
|
127
|
+
.xgplayer.flex-controls .controls-follow {
|
|
128
|
+
bottom: 45px;
|
|
129
|
+
}
|
|
130
|
+
.xgplayer.xgplayer-inactive .controls-follow, .xgplayer.no-controls .controls-follow, .xgplayer.mini-controls .controls-follow {
|
|
131
|
+
bottom: 10px;
|
|
132
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export default Controls;
|
|
2
|
+
export type IControlsConfig = {
|
|
3
|
+
[propName: string]: any;
|
|
4
|
+
disable?: boolean;
|
|
5
|
+
autoHide?: boolean;
|
|
6
|
+
mode?: "flex" | "normal" | "bottom";
|
|
7
|
+
initShow?: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {{
|
|
11
|
+
* disable?: boolean,
|
|
12
|
+
* autoHide?: boolean,
|
|
13
|
+
* mode?: "flex"|"normal"|"bottom",
|
|
14
|
+
* initShow?: boolean,
|
|
15
|
+
* [propName: string]: any
|
|
16
|
+
* }} IControlsConfig
|
|
17
|
+
*/
|
|
18
|
+
declare class Controls extends Plugin {
|
|
19
|
+
/**
|
|
20
|
+
* @type IControlsConfig
|
|
21
|
+
*/
|
|
22
|
+
static get defaultConfig(): IControlsConfig;
|
|
23
|
+
beforeCreate(args: any): void;
|
|
24
|
+
/**
|
|
25
|
+
* @type { HTMLElement}
|
|
26
|
+
* @readonly
|
|
27
|
+
*/
|
|
28
|
+
readonly left: HTMLElement;
|
|
29
|
+
/**
|
|
30
|
+
* @type { HTMLElement}
|
|
31
|
+
* @readonly
|
|
32
|
+
*/
|
|
33
|
+
readonly center: HTMLElement;
|
|
34
|
+
/**
|
|
35
|
+
* @type { HTMLElement}
|
|
36
|
+
* @readonly
|
|
37
|
+
*/
|
|
38
|
+
readonly right: HTMLElement;
|
|
39
|
+
/**
|
|
40
|
+
* @type { HTMLElement}
|
|
41
|
+
* @readonly
|
|
42
|
+
*/
|
|
43
|
+
readonly innerRoot: HTMLElement;
|
|
44
|
+
onMouseEnter: (e: any) => void;
|
|
45
|
+
onMouseLeave: (e: any) => void;
|
|
46
|
+
focus(): void;
|
|
47
|
+
focusAwhile(): void;
|
|
48
|
+
blur(): void;
|
|
49
|
+
recoverAutoHide(): void;
|
|
50
|
+
pauseAutoHide(): void;
|
|
51
|
+
show(): void;
|
|
52
|
+
/**
|
|
53
|
+
* @type {string}
|
|
54
|
+
*/
|
|
55
|
+
get mode(): string;
|
|
56
|
+
/**
|
|
57
|
+
*
|
|
58
|
+
* @param {} plugin
|
|
59
|
+
* @param { {config?: {[propName: string]: any}, position?:string, root?: HTMLElement, pluginName?: string}} options
|
|
60
|
+
* @param { string } name
|
|
61
|
+
* @returns { any }
|
|
62
|
+
*/
|
|
63
|
+
registerPlugin(plugin: any, options: {
|
|
64
|
+
config?: {
|
|
65
|
+
[propName: string]: any;
|
|
66
|
+
};
|
|
67
|
+
position?: string;
|
|
68
|
+
root?: HTMLElement;
|
|
69
|
+
pluginName?: string;
|
|
70
|
+
}, name: string): any;
|
|
71
|
+
render(): string;
|
|
72
|
+
}
|
|
73
|
+
import Plugin from "../../plugin";
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, defineProperty as _defineProperty, assertThisInitialized as _assertThisInitialized, createClass as _createClass, get as _get, getPrototypeOf as _getPrototypeOf } from "../../_virtual/_rollupPluginBabelHelpers.js";
|
|
2
|
+
import util from "../../utils/util.js";
|
|
3
|
+
import sniffer from "../../utils/sniffer.js";
|
|
4
|
+
import { MINI_STATE_CHANGE } from "../../events.js";
|
|
5
|
+
import "../../utils/debug.js";
|
|
6
|
+
import Plugin, { POSITIONS } from "../../plugin/plugin.js";
|
|
7
|
+
import STATE_CLASS from "../../stateClassMap.js";
|
|
8
|
+
var Controls = /* @__PURE__ */ function(_Plugin) {
|
|
9
|
+
_inherits(Controls2, _Plugin);
|
|
10
|
+
var _super = _createSuper(Controls2);
|
|
11
|
+
function Controls2() {
|
|
12
|
+
var _this;
|
|
13
|
+
_classCallCheck(this, Controls2);
|
|
14
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
|
+
args[_key] = arguments[_key];
|
|
16
|
+
}
|
|
17
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
18
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseEnter", function(e) {
|
|
19
|
+
var _assertThisInitialize = _assertThisInitialized(_this), player = _assertThisInitialize.player, playerConfig = _assertThisInitialize.playerConfig;
|
|
20
|
+
playerConfig.closeControlsBlur && player.focus({
|
|
21
|
+
autoHide: false
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseLeave", function(e) {
|
|
25
|
+
var _assertThisInitialize2 = _assertThisInitialized(_this), player = _assertThisInitialize2.player;
|
|
26
|
+
player.focus();
|
|
27
|
+
});
|
|
28
|
+
return _this;
|
|
29
|
+
}
|
|
30
|
+
_createClass(Controls2, [{
|
|
31
|
+
key: "beforeCreate",
|
|
32
|
+
value: function beforeCreate(args) {
|
|
33
|
+
if (!args.config.mode && sniffer.device === "mobile") {
|
|
34
|
+
args.config.mode = "flex";
|
|
35
|
+
}
|
|
36
|
+
if (args.player.config.marginControls) {
|
|
37
|
+
args.config.autoHide = false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "afterCreate",
|
|
42
|
+
value: function afterCreate() {
|
|
43
|
+
var _this2 = this;
|
|
44
|
+
var _this$config = this.config, disable = _this$config.disable, height = _this$config.height, mode = _this$config.mode;
|
|
45
|
+
if (disable) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
mode === "flex" && this.player.addClass(STATE_CLASS.FLEX_CONTROLS);
|
|
49
|
+
var style = {
|
|
50
|
+
height: "".concat(height, "px")
|
|
51
|
+
};
|
|
52
|
+
Object.keys(style).map(function(key) {
|
|
53
|
+
_this2.root.style[key] = style[key];
|
|
54
|
+
});
|
|
55
|
+
this.left = this.find("xg-left-grid");
|
|
56
|
+
this.center = this.find("xg-center-grid");
|
|
57
|
+
this.right = this.find("xg-right-grid");
|
|
58
|
+
this.innerRoot = this.find("xg-inner-controls");
|
|
59
|
+
this.on(MINI_STATE_CHANGE, function(isMini) {
|
|
60
|
+
isMini ? util.addClass(_this2.root, "mini-controls") : util.removeClass(_this2.root, "mini-controls");
|
|
61
|
+
});
|
|
62
|
+
var isMobileSimulateMode = this.playerConfig.isMobileSimulateMode;
|
|
63
|
+
if (sniffer.device !== "mobile" && isMobileSimulateMode !== "mobile") {
|
|
64
|
+
this.bind("mouseenter", this.onMouseEnter);
|
|
65
|
+
this.bind("mouseleave", this.onMouseLeave);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "focus",
|
|
70
|
+
value: function focus() {
|
|
71
|
+
this.player.focus({
|
|
72
|
+
autoHide: false
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
key: "focusAwhile",
|
|
77
|
+
value: function focusAwhile() {
|
|
78
|
+
this.player.focus({
|
|
79
|
+
autoHide: true
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
83
|
+
key: "blur",
|
|
84
|
+
value: function blur() {
|
|
85
|
+
this.player.blur({
|
|
86
|
+
ignorePaused: true
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
key: "recoverAutoHide",
|
|
91
|
+
value: function recoverAutoHide() {
|
|
92
|
+
this.config.autoHide && util.addClass(this.root, STATE_CLASS.CONTROLS_AUTOHIDE);
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "pauseAutoHide",
|
|
96
|
+
value: function pauseAutoHide() {
|
|
97
|
+
util.removeClass(this.root, STATE_CLASS.CONTROLS_AUTOHIDE);
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "show",
|
|
101
|
+
value: function show() {
|
|
102
|
+
this.root.style.display = "";
|
|
103
|
+
this.player.focus();
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
key: "hide",
|
|
107
|
+
value: function hide() {
|
|
108
|
+
this.root.style.display = "none";
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "mode",
|
|
112
|
+
get: function get() {
|
|
113
|
+
return this.config.mode;
|
|
114
|
+
}
|
|
115
|
+
}, {
|
|
116
|
+
key: "registerPlugin",
|
|
117
|
+
value: function registerPlugin(plugin) {
|
|
118
|
+
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
119
|
+
var name = arguments.length > 2 ? arguments[2] : void 0;
|
|
120
|
+
if (!this.root) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
var defaultConfig = plugin.defaultConfig || {};
|
|
124
|
+
if (!options.root) {
|
|
125
|
+
var position = options.position ? options.position : options.config && options.config.position ? options.config.position : defaultConfig.position;
|
|
126
|
+
switch (position) {
|
|
127
|
+
case POSITIONS.CONTROLS_LEFT:
|
|
128
|
+
options.root = this.left;
|
|
129
|
+
break;
|
|
130
|
+
case POSITIONS.CONTROLS_RIGHT:
|
|
131
|
+
options.root = this.right;
|
|
132
|
+
break;
|
|
133
|
+
case POSITIONS.CONTROLS_CENTER:
|
|
134
|
+
options.root = this.center;
|
|
135
|
+
break;
|
|
136
|
+
case POSITIONS.CONTROLS:
|
|
137
|
+
options.root = this.root;
|
|
138
|
+
break;
|
|
139
|
+
default:
|
|
140
|
+
options.root = this.left;
|
|
141
|
+
}
|
|
142
|
+
return _get(_getPrototypeOf(Controls2.prototype), "registerPlugin", this).call(this, plugin, options, name);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
key: "destroy",
|
|
147
|
+
value: function destroy() {
|
|
148
|
+
if (sniffer.device !== "mobile") {
|
|
149
|
+
this.unbind("mouseenter", this.onMouseEnter);
|
|
150
|
+
this.unbind("mouseleave", this.onMouseLeave);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}, {
|
|
154
|
+
key: "render",
|
|
155
|
+
value: function render() {
|
|
156
|
+
var _this$config2 = this.config, mode = _this$config2.mode, autoHide = _this$config2.autoHide, initShow = _this$config2.initShow, disable = _this$config2.disable;
|
|
157
|
+
if (disable) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
var className = util.classNames({
|
|
161
|
+
"xgplayer-controls": true
|
|
162
|
+
}, {
|
|
163
|
+
"flex-controls": mode === "flex"
|
|
164
|
+
}, {
|
|
165
|
+
"bottom-controls": mode === "bottom"
|
|
166
|
+
}, _defineProperty({}, STATE_CLASS.CONTROLS_AUTOHIDE, autoHide), {
|
|
167
|
+
"xgplayer-controls-initshow": initShow || !autoHide
|
|
168
|
+
});
|
|
169
|
+
return '<xg-controls class="'.concat(className, '" unselectable="on">\n <xg-inner-controls class="xg-inner-controls xg-pos">\n <xg-left-grid class="xg-left-grid">\n </xg-left-grid>\n <xg-center-grid class="xg-center-grid"></xg-center-grid>\n <xg-right-grid class="xg-right-grid">\n </xg-right-grid>\n </xg-inner-controls>\n </xg-controls>');
|
|
170
|
+
}
|
|
171
|
+
}], [{
|
|
172
|
+
key: "pluginName",
|
|
173
|
+
get: function get() {
|
|
174
|
+
return "controls";
|
|
175
|
+
}
|
|
176
|
+
}, {
|
|
177
|
+
key: "defaultConfig",
|
|
178
|
+
get: function get() {
|
|
179
|
+
return {
|
|
180
|
+
disable: false,
|
|
181
|
+
autoHide: true,
|
|
182
|
+
mode: "",
|
|
183
|
+
initShow: false
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}]);
|
|
187
|
+
return Controls2;
|
|
188
|
+
}(Plugin);
|
|
189
|
+
export { Controls as default };
|