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,269 @@
|
|
|
1
|
+
import util from "../../utils/util.js";
|
|
2
|
+
import { DURATION_CHANGE, VIDEO_RESIZE } from "../../events.js";
|
|
3
|
+
import "../../utils/debug.js";
|
|
4
|
+
import "delegate";
|
|
5
|
+
var ISPOT = {
|
|
6
|
+
time: 0,
|
|
7
|
+
text: "",
|
|
8
|
+
id: 1,
|
|
9
|
+
duration: 1,
|
|
10
|
+
color: "#fff",
|
|
11
|
+
style: {},
|
|
12
|
+
width: 6,
|
|
13
|
+
height: 6
|
|
14
|
+
};
|
|
15
|
+
function mergeISPOT(iSpot) {
|
|
16
|
+
Object.keys(ISPOT).map(function(key) {
|
|
17
|
+
if (iSpot[key] === void 0) {
|
|
18
|
+
iSpot[key] = ISPOT[key];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
var APIS = {
|
|
23
|
+
_updateDotDom: function _updateDotDom(iSpot, dotDom) {
|
|
24
|
+
if (!dotDom) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
var ret = this.calcuPosition(iSpot.time, iSpot.duration);
|
|
28
|
+
var style = iSpot.style || {};
|
|
29
|
+
style.left = "".concat(ret.left, "%");
|
|
30
|
+
style.width = "".concat(ret.width, "%");
|
|
31
|
+
dotDom.setAttribute("data-text", iSpot.text);
|
|
32
|
+
dotDom.setAttribute("data-time", iSpot.time);
|
|
33
|
+
if (ret.isMini) {
|
|
34
|
+
util.addClass(dotDom, "mini");
|
|
35
|
+
} else {
|
|
36
|
+
util.removeClass(dotDom, "mini");
|
|
37
|
+
}
|
|
38
|
+
Object.keys(style).map(function(key) {
|
|
39
|
+
dotDom.style[key] = style[key];
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
initDots: function initDots() {
|
|
43
|
+
var _this = this;
|
|
44
|
+
this._ispots.map(function(item) {
|
|
45
|
+
_this.createDot(item, false);
|
|
46
|
+
});
|
|
47
|
+
this.ispotsInit = true;
|
|
48
|
+
},
|
|
49
|
+
createDot: function createDot(iSpot) {
|
|
50
|
+
var isNew = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
51
|
+
var progress = this.player.plugins.progress;
|
|
52
|
+
if (!progress) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (isNew) {
|
|
56
|
+
mergeISPOT(iSpot);
|
|
57
|
+
this._ispots.push(iSpot);
|
|
58
|
+
}
|
|
59
|
+
if (!this.ispotsInit && isNew) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
var ret = this.calcuPosition(iSpot.time, iSpot.duration);
|
|
63
|
+
var style = iSpot.style || {};
|
|
64
|
+
style.left = "".concat(ret.left, "%");
|
|
65
|
+
style.width = "".concat(ret.width, "%");
|
|
66
|
+
var className = "xgspot_".concat(iSpot.id, " xgplayer-spot");
|
|
67
|
+
ret.isMini && (className += " mini");
|
|
68
|
+
var _t = iSpot.template ? '<div class="xgplayer-spot-pop">'.concat(iSpot.template, "</div>") : "";
|
|
69
|
+
var dotDom = util.createDom("xg-spot", _t, {
|
|
70
|
+
"data-text": iSpot.text,
|
|
71
|
+
"data-time": iSpot.time,
|
|
72
|
+
"data-id": iSpot.id
|
|
73
|
+
}, className);
|
|
74
|
+
Object.keys(style).map(function(key) {
|
|
75
|
+
dotDom.style[key] = style[key];
|
|
76
|
+
});
|
|
77
|
+
progress.outer && progress.outer.appendChild(dotDom);
|
|
78
|
+
this.positionDot(dotDom, iSpot.id);
|
|
79
|
+
},
|
|
80
|
+
findDot: function findDot(id) {
|
|
81
|
+
if (!this.player.plugins.progress) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
var ret = this._ispots.filter(function(cur, index) {
|
|
85
|
+
return cur.id === id;
|
|
86
|
+
});
|
|
87
|
+
return ret.length > 0 ? ret[0] : null;
|
|
88
|
+
},
|
|
89
|
+
updateDot: function updateDot(iSpot) {
|
|
90
|
+
var needShow = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
91
|
+
var progress = this.player.plugins.progress;
|
|
92
|
+
if (!progress) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
var dot = this.findDot(iSpot.id);
|
|
96
|
+
if (dot) {
|
|
97
|
+
Object.keys(iSpot).map(function(key) {
|
|
98
|
+
dot[key] = iSpot[key];
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (!this.ispotsInit) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
var dotDom = progress.find('xg-spot[data-id="'.concat(iSpot.id, '"]'));
|
|
105
|
+
if (!dotDom) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
this._updateDotDom(iSpot, dotDom);
|
|
109
|
+
if (needShow) {
|
|
110
|
+
this.showDot(iSpot.id);
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
deleteDot: function deleteDot(id) {
|
|
114
|
+
var _ispots = this._ispots;
|
|
115
|
+
var progress = this.player.plugins.progress;
|
|
116
|
+
if (!progress) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
var del = [];
|
|
120
|
+
for (var i = 0; i < _ispots.length; i++) {
|
|
121
|
+
if (_ispots[i].id === id) {
|
|
122
|
+
del.push(i);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
var len = del.length;
|
|
126
|
+
for (var _i = len - 1; _i >= 0; _i--) {
|
|
127
|
+
_ispots.splice(del[_i], 1);
|
|
128
|
+
if (this.ispotsInit) {
|
|
129
|
+
var dotDom = progress.find('xg-spot[data-id="'.concat(id, '"]'));
|
|
130
|
+
if (dotDom) {
|
|
131
|
+
dotDom.parentElement.removeChild(dotDom);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
deleteAllDots: function deleteAllDots() {
|
|
137
|
+
var progress = this.player.plugins.progress;
|
|
138
|
+
if (!progress) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (!this.ispotsInit) {
|
|
142
|
+
this._ispots = [];
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
var dotDoms = progress.root.getElementsByTagName("xg-spot");
|
|
146
|
+
for (var i = dotDoms.length - 1; i >= 0; i--) {
|
|
147
|
+
progress.outer.removeChild(dotDoms[i]);
|
|
148
|
+
}
|
|
149
|
+
this._ispots = [];
|
|
150
|
+
},
|
|
151
|
+
updateAllDots: function updateAllDots() {
|
|
152
|
+
var _this2 = this;
|
|
153
|
+
var iSpots = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
154
|
+
var progress = this.player.plugins.progress;
|
|
155
|
+
if (!progress) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (!this.ispotsInit) {
|
|
159
|
+
this._ispots = iSpots;
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
this._ispots = [];
|
|
163
|
+
var dotDoms = progress.root.getElementsByTagName("xg-spot");
|
|
164
|
+
var len = dotDoms.length;
|
|
165
|
+
if (len > iSpots.length) {
|
|
166
|
+
for (var i = len - 1; i > iSpots.length - 1; i--) {
|
|
167
|
+
progress.outer.removeChild(dotDoms[i]);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
iSpots.forEach(function(ispot, index) {
|
|
171
|
+
if (index < len) {
|
|
172
|
+
dotDoms[index].setAttribute("data-id", "".concat(ispot.id));
|
|
173
|
+
_this2._ispots.push(ispot);
|
|
174
|
+
_this2.updateDot(ispot);
|
|
175
|
+
} else {
|
|
176
|
+
_this2.createDot(ispot);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
},
|
|
180
|
+
positionDots: function positionDots() {
|
|
181
|
+
var _this3 = this;
|
|
182
|
+
var _ispots = this._ispots, playerSize = this.playerSize;
|
|
183
|
+
var sizeInfo = this.player.sizeInfo;
|
|
184
|
+
var progress = this.player.plugins.progress;
|
|
185
|
+
if (!progress || sizeInfo.width === playerSize.width) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
playerSize.width = sizeInfo.width;
|
|
189
|
+
playerSize.left = sizeInfo.left;
|
|
190
|
+
_ispots.forEach(function(item) {
|
|
191
|
+
var dotDom = progress.find('xg-spot[data-id="'.concat(item.id, '"]'));
|
|
192
|
+
dotDom && _this3.positionDot(dotDom, item.id);
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
positionDot: function positionDot(dotDom, id) {
|
|
196
|
+
var _pop = util.findDom(dotDom, ".xgplayer-spot-pop");
|
|
197
|
+
if (!_pop) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
var pRect = this.playerSize;
|
|
201
|
+
var rect1 = dotDom.getBoundingClientRect();
|
|
202
|
+
var rect = _pop.getBoundingClientRect();
|
|
203
|
+
var _left = rect1.left - pRect.left;
|
|
204
|
+
var _diff = pRect.width - _left - rect1.width / 2;
|
|
205
|
+
if (_left < rect.width / 2 || pRect.width < rect.width) {
|
|
206
|
+
var t = rect.width / 2 - _left;
|
|
207
|
+
_pop.style.left = "".concat(t, "px");
|
|
208
|
+
} else if (_diff < rect.width / 2) {
|
|
209
|
+
var _t2 = _diff - rect.width / 2 + rect1.width / 2;
|
|
210
|
+
_pop.style.left = "".concat(_t2, "px");
|
|
211
|
+
} else {
|
|
212
|
+
_pop.style.left = "50%";
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
updateDuration: function updateDuration() {
|
|
216
|
+
var _this4 = this;
|
|
217
|
+
var progress = this.player.plugins.progress;
|
|
218
|
+
if (!progress) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
var _ispots = this._ispots;
|
|
222
|
+
_ispots.forEach(function(item) {
|
|
223
|
+
var dotDom = progress.find('xg-spot[data-id="'.concat(item.id, '"]'));
|
|
224
|
+
_this4._updateDotDom(item, dotDom);
|
|
225
|
+
});
|
|
226
|
+
},
|
|
227
|
+
getAllDotsDom: function getAllDotsDom() {
|
|
228
|
+
var progress = this.player.plugins.progress;
|
|
229
|
+
if (!progress) {
|
|
230
|
+
return [];
|
|
231
|
+
}
|
|
232
|
+
var dotDoms = progress.root.getElementsByTagName("xg-spot");
|
|
233
|
+
return dotDoms;
|
|
234
|
+
},
|
|
235
|
+
getDotDom: function getDotDom(id) {
|
|
236
|
+
var progress = this.player.plugins.progress;
|
|
237
|
+
if (!progress) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
return progress.find('xg-spot[data-id="'.concat(id, '"]'));
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
function initDotsAPI(plugin) {
|
|
244
|
+
var config = plugin.config, player = plugin.player;
|
|
245
|
+
Object.keys(APIS).map(function(item) {
|
|
246
|
+
plugin[item] = APIS[item].bind(plugin);
|
|
247
|
+
});
|
|
248
|
+
var ispots = player.config.progressDot || config.ispots || [];
|
|
249
|
+
plugin._ispots = ispots.map(function(item) {
|
|
250
|
+
mergeISPOT(item);
|
|
251
|
+
return item;
|
|
252
|
+
});
|
|
253
|
+
plugin.ispotsInit = false;
|
|
254
|
+
plugin.playerSize = {
|
|
255
|
+
left: player.sizeInfo.left,
|
|
256
|
+
width: player.sizeInfo.width
|
|
257
|
+
};
|
|
258
|
+
plugin.on(DURATION_CHANGE, function() {
|
|
259
|
+
if (!plugin.ispotsInit) {
|
|
260
|
+
plugin.initDots();
|
|
261
|
+
} else {
|
|
262
|
+
plugin.updateDuration();
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
plugin.on(VIDEO_RESIZE, function() {
|
|
266
|
+
plugin.positionDots();
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
export { initDotsAPI as default };
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
.xgplayer {
|
|
3
|
+
/** xg-spot-info start**/
|
|
4
|
+
/* 时间预览样式 */
|
|
5
|
+
/** xg-spot-info end**/
|
|
6
|
+
}
|
|
7
|
+
.xgplayer .xgplayer-spot {
|
|
8
|
+
position: absolute;
|
|
9
|
+
top: 0;
|
|
10
|
+
left: 0;
|
|
11
|
+
height: 100%;
|
|
12
|
+
background: #fff;
|
|
13
|
+
border-radius: 12px;
|
|
14
|
+
}
|
|
15
|
+
.xgplayer .xgplayer-spot.mini {
|
|
16
|
+
min-width: 6px;
|
|
17
|
+
transform: translate(-50%, 0);
|
|
18
|
+
}
|
|
19
|
+
.xgplayer .xgplayer-spot.active .xgplayer-spot-pop {
|
|
20
|
+
display: block;
|
|
21
|
+
opacity: 1;
|
|
22
|
+
pointer-events: initial;
|
|
23
|
+
}
|
|
24
|
+
.xgplayer .xgplayer-spot-pop {
|
|
25
|
+
display: block;
|
|
26
|
+
opacity: 0;
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
position: absolute;
|
|
29
|
+
left: 50%;
|
|
30
|
+
bottom: 5px;
|
|
31
|
+
padding-bottom: 5px;
|
|
32
|
+
transform: translateX(-50%);
|
|
33
|
+
}
|
|
34
|
+
.xgplayer-mobile .xgplayer-spot {
|
|
35
|
+
height: 3px;
|
|
36
|
+
min-width: 3px;
|
|
37
|
+
top: 50%;
|
|
38
|
+
opacity: 1;
|
|
39
|
+
transform: translate(0, -50%);
|
|
40
|
+
}
|
|
41
|
+
.xgplayer-mobile .xgplayer-spot.mini {
|
|
42
|
+
min-width: 3px;
|
|
43
|
+
transform: translate(-50%, -50%);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.xgplayer .xgplayer-progress.active .xgplayer-spot {
|
|
47
|
+
opacity: 1;
|
|
48
|
+
transition: opacity 0.3s;
|
|
49
|
+
visibility: visible;
|
|
50
|
+
}
|
|
51
|
+
.xgplayer .xg-spot-info {
|
|
52
|
+
position: absolute;
|
|
53
|
+
left: 0;
|
|
54
|
+
bottom: 100%;
|
|
55
|
+
display: none;
|
|
56
|
+
}
|
|
57
|
+
.xgplayer .xg-spot-info.short-line .xg-spot-line {
|
|
58
|
+
height: 6px;
|
|
59
|
+
}
|
|
60
|
+
.xgplayer .xg-spot-info.short-line .xg-spot-content {
|
|
61
|
+
bottom: -4px;
|
|
62
|
+
}
|
|
63
|
+
.xgplayer .xg-spot-info.no-thumbnail .xg-spot-thumbnail {
|
|
64
|
+
display: none;
|
|
65
|
+
}
|
|
66
|
+
.xgplayer .xg-spot-info.no-thumbnail .xgplayer-progress-point {
|
|
67
|
+
display: block;
|
|
68
|
+
}
|
|
69
|
+
.xgplayer .xg-spot-info.no-timepoint .xgplayer-progress-point {
|
|
70
|
+
display: none;
|
|
71
|
+
}
|
|
72
|
+
.xgplayer .xg-spot-info.hide {
|
|
73
|
+
display: none;
|
|
74
|
+
}
|
|
75
|
+
.xgplayer .xgplayer-progress.active .xg-spot-info {
|
|
76
|
+
display: block;
|
|
77
|
+
}
|
|
78
|
+
.xgplayer .xgplayer-progress.active .xg-spot-info.hide {
|
|
79
|
+
display: none;
|
|
80
|
+
}
|
|
81
|
+
.xgplayer .xg-spot-line {
|
|
82
|
+
position: relative;
|
|
83
|
+
bottom: -7px;
|
|
84
|
+
margin-left: 50%;
|
|
85
|
+
display: block;
|
|
86
|
+
width: 1px;
|
|
87
|
+
height: 41px;
|
|
88
|
+
background-color: #FFF;
|
|
89
|
+
pointer-events: none;
|
|
90
|
+
}
|
|
91
|
+
.xgplayer .xgplayer-progress-point {
|
|
92
|
+
display: none;
|
|
93
|
+
position: relative;
|
|
94
|
+
bottom: -4px;
|
|
95
|
+
left: 50%;
|
|
96
|
+
transform: translateX(-50%);
|
|
97
|
+
background: rgba(0, 0, 0, 0.54);
|
|
98
|
+
font-size: 11px;
|
|
99
|
+
color: #fff;
|
|
100
|
+
padding: 4px 6px;
|
|
101
|
+
border-radius: 4px;
|
|
102
|
+
text-align: center;
|
|
103
|
+
opacity: 0.85;
|
|
104
|
+
white-space: nowrap;
|
|
105
|
+
}
|
|
106
|
+
.xgplayer .xg-spot-content {
|
|
107
|
+
position: relative;
|
|
108
|
+
bottom: -7px;
|
|
109
|
+
color: #fff;
|
|
110
|
+
border-radius: 2px 2px 0px 0px;
|
|
111
|
+
}
|
|
112
|
+
.xgplayer .xg-spot-ext-text {
|
|
113
|
+
position: relative;
|
|
114
|
+
bottom: -7px;
|
|
115
|
+
}
|
|
116
|
+
.xgplayer .xg-spot-thumbnail {
|
|
117
|
+
position: relative;
|
|
118
|
+
background-color: rgb(17, 16, 16);
|
|
119
|
+
pointer-events: none;
|
|
120
|
+
border-radius: 2px 2px 0 0;
|
|
121
|
+
}
|
|
122
|
+
.xgplayer .xg-spot-time {
|
|
123
|
+
position: absolute;
|
|
124
|
+
left: 50%;
|
|
125
|
+
bottom: 2px;
|
|
126
|
+
font-size: 12px;
|
|
127
|
+
line-height: 16.8px;
|
|
128
|
+
left: 50%;
|
|
129
|
+
transform: translateX(-50%);
|
|
130
|
+
pointer-events: none;
|
|
131
|
+
}
|
|
132
|
+
.xgplayer .progress-thumbnail {
|
|
133
|
+
margin: 0 auto;
|
|
134
|
+
display: block;
|
|
135
|
+
}
|
|
136
|
+
.xgplayer .xg-spot-text {
|
|
137
|
+
display: none;
|
|
138
|
+
padding: 5px 8px;
|
|
139
|
+
background: rgba(0, 0, 0, 0.8);
|
|
140
|
+
border-radius: 0px 0px 2px 2px;
|
|
141
|
+
pointer-events: none;
|
|
142
|
+
box-sizing: border-box;
|
|
143
|
+
}
|
|
144
|
+
.xgplayer .spot-inner-text {
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
text-overflow: ellipsis;
|
|
147
|
+
display: -webkit-box;
|
|
148
|
+
-webkit-line-clamp: 2;
|
|
149
|
+
-webkit-box-orient: vertical;
|
|
150
|
+
line-height: 20px;
|
|
151
|
+
font-size: 12px;
|
|
152
|
+
max-height: 40px;
|
|
153
|
+
}
|
|
154
|
+
.xgplayer .xg-spot-content.show-text .xg-spot-text {
|
|
155
|
+
display: block;
|
|
156
|
+
}
|
|
157
|
+
.xgplayer .product .xg-spot-text {
|
|
158
|
+
background: #3370FF;
|
|
159
|
+
}
|
|
160
|
+
.xgplayer .product .xg-spot-line {
|
|
161
|
+
border-left: 10px solid transparent;
|
|
162
|
+
border-right: 10px solid transparent;
|
|
163
|
+
border-top: 7px solid #3370FF;
|
|
164
|
+
width: 0;
|
|
165
|
+
height: 15px;
|
|
166
|
+
left: -10px;
|
|
167
|
+
background: none;
|
|
168
|
+
}
|
|
169
|
+
.xgplayer .xgvideo-preview {
|
|
170
|
+
position: absolute;
|
|
171
|
+
width: 100%;
|
|
172
|
+
height: 100%;
|
|
173
|
+
top: 0;
|
|
174
|
+
left: 0;
|
|
175
|
+
opacity: 0;
|
|
176
|
+
visibility: hidden;
|
|
177
|
+
transition: visibility 0.3s, opacity 0.3s;
|
|
178
|
+
background-color: #000;
|
|
179
|
+
}
|
|
180
|
+
.xgplayer .xgvideo-preview .xgvideo-thumbnail {
|
|
181
|
+
position: relative;
|
|
182
|
+
top: 50%;
|
|
183
|
+
left: 50%;
|
|
184
|
+
transform: translate(-50%, -50%);
|
|
185
|
+
border-radius: 0;
|
|
186
|
+
}
|
|
187
|
+
.xgplayer .xgvideo-preview.show {
|
|
188
|
+
opacity: 1;
|
|
189
|
+
visibility: visible;
|
|
190
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/** */
|
|
2
|
+
export default class ProgressPreview extends Plugin {
|
|
3
|
+
/**
|
|
4
|
+
* @type IProgressPreviewConfig
|
|
5
|
+
*/
|
|
6
|
+
static get defaultConfig(): IProgressPreviewConfig;
|
|
7
|
+
constructor(args: any);
|
|
8
|
+
_ispots: any[];
|
|
9
|
+
videoPreview: HTMLElement;
|
|
10
|
+
videothumbnail: any;
|
|
11
|
+
thumbnail: any;
|
|
12
|
+
timeStr: string;
|
|
13
|
+
_state: {
|
|
14
|
+
now: number;
|
|
15
|
+
f: boolean;
|
|
16
|
+
};
|
|
17
|
+
beforeCreate(args: any): void;
|
|
18
|
+
_curDot: any;
|
|
19
|
+
handlerSpotClick: any;
|
|
20
|
+
transformTimeHook: any;
|
|
21
|
+
extTextRoot: HTMLElement;
|
|
22
|
+
setConfig(config: any): void;
|
|
23
|
+
previewLine: HTMLElement;
|
|
24
|
+
timePoint: HTMLElement;
|
|
25
|
+
timeText: HTMLElement;
|
|
26
|
+
tipText: HTMLElement;
|
|
27
|
+
_hasThumnail: boolean;
|
|
28
|
+
bindEvents(): void;
|
|
29
|
+
handlerPreviewClick: (e: any) => void;
|
|
30
|
+
onMousemove: (e: any) => void;
|
|
31
|
+
onMousedown: (e: any) => void;
|
|
32
|
+
onMouseup: (e: any) => void;
|
|
33
|
+
onDotMouseLeave: (e: any) => void;
|
|
34
|
+
onProgressMouseOver: (data: any, e: any) => void;
|
|
35
|
+
onProgressMove(data: any, e: any): void;
|
|
36
|
+
onProgressDragStart(data: any): void;
|
|
37
|
+
isDrag: boolean;
|
|
38
|
+
onProgressDragEnd(data: any): void;
|
|
39
|
+
onProgressClick(data: any, e: any): void;
|
|
40
|
+
updateLinePos(offset: any, cwidth: any): void;
|
|
41
|
+
updateTimeText(timeStr: any): void;
|
|
42
|
+
updatePosition(offset: any, cwidth: any, time: any, e: any): void;
|
|
43
|
+
/**
|
|
44
|
+
* @description 设置自定义时间显示字符串
|
|
45
|
+
* @param {number} time
|
|
46
|
+
*/
|
|
47
|
+
setTimeContent(time: number): void;
|
|
48
|
+
updateThumbnails(time: any): void;
|
|
49
|
+
registerThumbnail(thumbnailConfig?: {}): void;
|
|
50
|
+
calcuPosition(time: any, duration: any): {
|
|
51
|
+
left: number;
|
|
52
|
+
width: number;
|
|
53
|
+
isMini: boolean;
|
|
54
|
+
};
|
|
55
|
+
showDot(id: any): void;
|
|
56
|
+
focusDot(target: any, id: any): void;
|
|
57
|
+
_activeDotId: any;
|
|
58
|
+
blurDot(target: any): void;
|
|
59
|
+
showTips(text: any, isDefault: any, timeStr?: string): void;
|
|
60
|
+
hideTips(): void;
|
|
61
|
+
show(): void;
|
|
62
|
+
enable(): void;
|
|
63
|
+
disable(): void;
|
|
64
|
+
render(): string;
|
|
65
|
+
}
|
|
66
|
+
export type IProgressPreviewConfig = {
|
|
67
|
+
[propName: string]: any;
|
|
68
|
+
miniWidth?: number;
|
|
69
|
+
ispots?: {
|
|
70
|
+
time?: number;
|
|
71
|
+
text?: string;
|
|
72
|
+
id?: number | string;
|
|
73
|
+
duration: number | null;
|
|
74
|
+
color?: string;
|
|
75
|
+
style?: {
|
|
76
|
+
[propName: string]: any;
|
|
77
|
+
};
|
|
78
|
+
width?: number;
|
|
79
|
+
height?: number;
|
|
80
|
+
}[];
|
|
81
|
+
defaultText?: '';
|
|
82
|
+
isFocusDots?: true;
|
|
83
|
+
isShowThumbnail?: true;
|
|
84
|
+
isShowCoverPreview?: false;
|
|
85
|
+
mode?: 'short' | 'production';
|
|
86
|
+
};
|
|
87
|
+
import Plugin from "../../plugin";
|