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,687 @@
|
|
|
1
|
+
import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, defineProperty as _defineProperty, assertThisInitialized as _assertThisInitialized, createClass as _createClass, objectSpread2 as _objectSpread2, typeof as _typeof } from "../../_virtual/_rollupPluginBabelHelpers.js";
|
|
2
|
+
import util from "../../utils/util.js";
|
|
3
|
+
import sniffer from "../../utils/sniffer.js";
|
|
4
|
+
import { DURATION_CHANGE, TIME_UPDATE, SEEKED, PROGRESS, ENDED, EMPTIED, VIDEO_RESIZE } from "../../events.js";
|
|
5
|
+
import "../../utils/debug.js";
|
|
6
|
+
import Plugin, { POSITIONS } from "../../plugin/plugin.js";
|
|
7
|
+
import InnerList from "./innerList.js";
|
|
8
|
+
var FRAGMENT_FOCUS_CLASS = {
|
|
9
|
+
POINT: "inner-focus-point",
|
|
10
|
+
HIGHLIGHT: "inner-focus-highlight"
|
|
11
|
+
};
|
|
12
|
+
var Progress = /* @__PURE__ */ function(_Plugin) {
|
|
13
|
+
_inherits(Progress2, _Plugin);
|
|
14
|
+
var _super = _createSuper(Progress2);
|
|
15
|
+
function Progress2(args) {
|
|
16
|
+
var _this;
|
|
17
|
+
_classCallCheck(this, Progress2);
|
|
18
|
+
_this = _super.call(this, args);
|
|
19
|
+
_defineProperty(_assertThisInitialized(_this), "onMoveOnly", function(e, data) {
|
|
20
|
+
var _assertThisInitialize = _assertThisInitialized(_this), pos = _assertThisInitialize.pos, config = _assertThisInitialize.config, player = _assertThisInitialize.player;
|
|
21
|
+
var ret = data;
|
|
22
|
+
if (e) {
|
|
23
|
+
util.event(e);
|
|
24
|
+
var _ePos = util.getEventPos(e, player.zoom);
|
|
25
|
+
var x = player.rotateDeg === 90 ? _ePos.clientY : _ePos.clientX;
|
|
26
|
+
if (pos.moving && Math.abs(pos.x - x) < config.miniMoveStep) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
pos.moving = true;
|
|
30
|
+
pos.x = x;
|
|
31
|
+
ret = _this.computeTime(e, x);
|
|
32
|
+
}
|
|
33
|
+
_this.triggerCallbacks("dragmove", ret, e);
|
|
34
|
+
_this._updateInnerFocus(ret);
|
|
35
|
+
});
|
|
36
|
+
_defineProperty(_assertThisInitialized(_this), "onBodyClick", function(e) {
|
|
37
|
+
if (!_this.pos.isLocked) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
_this.pos.isLocked = false;
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
e.stopPropagation();
|
|
43
|
+
});
|
|
44
|
+
_defineProperty(_assertThisInitialized(_this), "_mouseDownHandler", function(event, data) {
|
|
45
|
+
_this._state.time = data.currentTime;
|
|
46
|
+
_this.updateWidth(data.currentTime, data.seekTime, data.percent, 0);
|
|
47
|
+
_this._updateInnerFocus(data);
|
|
48
|
+
});
|
|
49
|
+
_defineProperty(_assertThisInitialized(_this), "_mouseUpHandler", function(e, data) {
|
|
50
|
+
var _assertThisInitialize2 = _assertThisInitialized(_this), pos = _assertThisInitialize2.pos;
|
|
51
|
+
pos.moving && _this.updateWidth(data.currentTime, data.seekTime, data.percent, 2);
|
|
52
|
+
});
|
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "_mouseMoveHandler", function(e, data) {
|
|
54
|
+
var _assertThisInitialize3 = _assertThisInitialized(_this), _state = _assertThisInitialize3._state, pos = _assertThisInitialize3.pos, config = _assertThisInitialize3.config, player = _assertThisInitialize3.player;
|
|
55
|
+
if (_state.time < data.currentTime) {
|
|
56
|
+
data.forward = true;
|
|
57
|
+
} else {
|
|
58
|
+
data.forward = false;
|
|
59
|
+
}
|
|
60
|
+
_state.time = data.currentTime;
|
|
61
|
+
if (pos.isDown && !pos.moving) {
|
|
62
|
+
pos.moving = true;
|
|
63
|
+
config.isPauseMoving && player.pause();
|
|
64
|
+
_this.triggerCallbacks("dragstart", data, e);
|
|
65
|
+
_this.emitUserAction("drag", "dragstart", data);
|
|
66
|
+
}
|
|
67
|
+
_this.updateWidth(data.currentTime, data.seekTime, data.percent, 1);
|
|
68
|
+
_this.triggerCallbacks("dragmove", data, e);
|
|
69
|
+
_this._updateInnerFocus(data);
|
|
70
|
+
});
|
|
71
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseDown", function(e) {
|
|
72
|
+
var _assertThisInitialize4 = _assertThisInitialized(_this), _state = _assertThisInitialize4._state, player = _assertThisInitialize4.player, pos = _assertThisInitialize4.pos, config = _assertThisInitialize4.config, playerConfig = _assertThisInitialize4.playerConfig;
|
|
73
|
+
var _ePos = util.getEventPos(e, player.zoom);
|
|
74
|
+
var x = player.rotateDeg === 90 ? _ePos.clientY : _ePos.clientX;
|
|
75
|
+
if (player.isMini || config.closeMoveSeek || !playerConfig.allowSeekAfterEnded && player.ended) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (!player.duration && !player.isPlaying) {
|
|
79
|
+
player.play();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
e.stopPropagation();
|
|
83
|
+
_this.focus();
|
|
84
|
+
util.checkIsFunction(playerConfig.disableSwipeHandler) && playerConfig.disableSwipeHandler();
|
|
85
|
+
util.checkIsFunction(config.onMoveStart) && config.onMoveStart();
|
|
86
|
+
util.event(e);
|
|
87
|
+
pos.x = x;
|
|
88
|
+
pos.isDown = true;
|
|
89
|
+
pos.moving = false;
|
|
90
|
+
_state.prePlayTime = player.currentTime;
|
|
91
|
+
player.focus({
|
|
92
|
+
autoHide: false
|
|
93
|
+
});
|
|
94
|
+
_this.isProgressMoving = true;
|
|
95
|
+
util.addClass(_this.progressBtn, "active");
|
|
96
|
+
var ret = _this.computeTime(e, x);
|
|
97
|
+
ret.prePlayTime = _state.prePlayTime;
|
|
98
|
+
_this._mouseDownHandlerHook(e, ret);
|
|
99
|
+
var eventType = e.type;
|
|
100
|
+
if (eventType === "touchstart") {
|
|
101
|
+
_this.root.addEventListener("touchmove", _this.onMouseMove);
|
|
102
|
+
_this.root.addEventListener("touchend", _this.onMouseUp);
|
|
103
|
+
} else {
|
|
104
|
+
_this.unbind("mousemove", _this.onMoveOnly);
|
|
105
|
+
document.addEventListener("mousemove", _this.onMouseMove, false);
|
|
106
|
+
document.addEventListener("mouseup", _this.onMouseUp, false);
|
|
107
|
+
}
|
|
108
|
+
return true;
|
|
109
|
+
});
|
|
110
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseUp", function(e) {
|
|
111
|
+
var _assertThisInitialize5 = _assertThisInitialized(_this), player = _assertThisInitialize5.player, config = _assertThisInitialize5.config, pos = _assertThisInitialize5.pos, playerConfig = _assertThisInitialize5.playerConfig, _state = _assertThisInitialize5._state;
|
|
112
|
+
e.stopPropagation();
|
|
113
|
+
e.preventDefault();
|
|
114
|
+
util.checkIsFunction(playerConfig.enableSwipeHandler) && playerConfig.enableSwipeHandler();
|
|
115
|
+
util.checkIsFunction(config.onMoveEnd) && config.onMoveEnd();
|
|
116
|
+
util.event(e);
|
|
117
|
+
util.removeClass(_this.progressBtn, "active");
|
|
118
|
+
var ret = _this.computeTime(e, pos.x);
|
|
119
|
+
ret.prePlayTime = _state.prePlayTime;
|
|
120
|
+
if (pos.moving) {
|
|
121
|
+
_this.triggerCallbacks("dragend", ret, e);
|
|
122
|
+
_this.emitUserAction("drag", "dragend", ret);
|
|
123
|
+
} else {
|
|
124
|
+
_this.triggerCallbacks("click", ret, e);
|
|
125
|
+
_this.emitUserAction("click", "click", ret);
|
|
126
|
+
}
|
|
127
|
+
_this._mouseUpHandlerHook(e, ret);
|
|
128
|
+
pos.moving = false;
|
|
129
|
+
pos.isDown = false;
|
|
130
|
+
pos.x = 0;
|
|
131
|
+
pos.y = 0;
|
|
132
|
+
pos.isLocked = true;
|
|
133
|
+
_state.prePlayTime = 0;
|
|
134
|
+
_state.time = 0;
|
|
135
|
+
var eventType = e.type;
|
|
136
|
+
if (eventType === "touchend") {
|
|
137
|
+
_this.root.removeEventListener("touchmove", _this.onMouseMove);
|
|
138
|
+
_this.root.removeEventListener("touchend", _this.onMouseUp);
|
|
139
|
+
_this.blur();
|
|
140
|
+
} else {
|
|
141
|
+
document.removeEventListener("mousemove", _this.onMouseMove, false);
|
|
142
|
+
document.removeEventListener("mouseup", _this.onMouseUp, false);
|
|
143
|
+
if (!pos.isEnter) {
|
|
144
|
+
_this.onMouseLeave(e);
|
|
145
|
+
} else {
|
|
146
|
+
playerConfig.isMobileSimulateMode !== "mobile" && _this.bind("mousemove", _this.onMoveOnly);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
util.setTimeout(_assertThisInitialized(_this), function() {
|
|
150
|
+
_this.resetSeekState();
|
|
151
|
+
}, 10);
|
|
152
|
+
player.focus();
|
|
153
|
+
});
|
|
154
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseMove", function(e) {
|
|
155
|
+
var _assertThisInitialize6 = _assertThisInitialized(_this), _state = _assertThisInitialize6._state, pos = _assertThisInitialize6.pos, player = _assertThisInitialize6.player, config = _assertThisInitialize6.config;
|
|
156
|
+
if (util.checkTouchSupport()) {
|
|
157
|
+
e.preventDefault();
|
|
158
|
+
}
|
|
159
|
+
util.event(e);
|
|
160
|
+
var _ePos = util.getEventPos(e, player.zoom);
|
|
161
|
+
var x = player.rotateDeg === 90 ? _ePos.clientY : _ePos.clientX;
|
|
162
|
+
var diff = Math.abs(pos.x - x);
|
|
163
|
+
if (pos.moving && diff < config.miniMoveStep || !pos.moving && diff < config.miniStartStep) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
pos.x = x;
|
|
167
|
+
var ret = _this.computeTime(e, x);
|
|
168
|
+
ret.prePlayTime = _state.prePlayTime;
|
|
169
|
+
_this._mouseMoveHandlerHook(e, ret);
|
|
170
|
+
});
|
|
171
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseOut", function(e) {
|
|
172
|
+
_this.triggerCallbacks("mouseout", null, e);
|
|
173
|
+
});
|
|
174
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseOver", function(e) {
|
|
175
|
+
_this.triggerCallbacks("mouseover", null, e);
|
|
176
|
+
});
|
|
177
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseEnter", function(e) {
|
|
178
|
+
var _assertThisInitialize7 = _assertThisInitialized(_this), player = _assertThisInitialize7.player, pos = _assertThisInitialize7.pos;
|
|
179
|
+
if (pos.isDown || pos.isEnter || player.isMini || !player.config.allowSeekAfterEnded && player.ended) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
pos.isEnter = true;
|
|
183
|
+
_this.bind("mousemove", _this.onMoveOnly);
|
|
184
|
+
_this.bind("mouseleave", _this.onMouseLeave);
|
|
185
|
+
util.event(e);
|
|
186
|
+
var _ePos = util.getEventPos(e, player.zoom);
|
|
187
|
+
var x = player.rotateDeg === 90 ? _ePos.clientY : _ePos.clientX;
|
|
188
|
+
var ret = _this.computeTime(e, x);
|
|
189
|
+
_this.triggerCallbacks("mouseenter", ret, e);
|
|
190
|
+
_this.focus();
|
|
191
|
+
});
|
|
192
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseLeave", function(e) {
|
|
193
|
+
_this.triggerCallbacks("mouseleave", null, e);
|
|
194
|
+
_this.unlock();
|
|
195
|
+
_this._updateInnerFocus(null);
|
|
196
|
+
});
|
|
197
|
+
_defineProperty(_assertThisInitialized(_this), "onVideoResize", function() {
|
|
198
|
+
var _this$pos = _this.pos, x = _this$pos.x, isDown = _this$pos.isDown, isEnter = _this$pos.isEnter;
|
|
199
|
+
if (isEnter && !isDown) {
|
|
200
|
+
var ret = _this.computeTime(null, x);
|
|
201
|
+
_this.onMoveOnly(null, ret);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
_this.useable = false;
|
|
205
|
+
_this.isProgressMoving = false;
|
|
206
|
+
_this.__dragCallBacks = [];
|
|
207
|
+
_this._state = {
|
|
208
|
+
now: -1,
|
|
209
|
+
direc: 0,
|
|
210
|
+
time: 0,
|
|
211
|
+
prePlayTime: -1
|
|
212
|
+
};
|
|
213
|
+
_this._disableBlur = false;
|
|
214
|
+
return _this;
|
|
215
|
+
}
|
|
216
|
+
_createClass(Progress2, [{
|
|
217
|
+
key: "offsetDuration",
|
|
218
|
+
get: function get() {
|
|
219
|
+
return this.playerConfig.customDuration || this.player.offsetDuration || this.player.duration;
|
|
220
|
+
}
|
|
221
|
+
}, {
|
|
222
|
+
key: "duration",
|
|
223
|
+
get: function get() {
|
|
224
|
+
return this.playerConfig.customDuration || this.player.duration;
|
|
225
|
+
}
|
|
226
|
+
}, {
|
|
227
|
+
key: "timeOffset",
|
|
228
|
+
get: function get() {
|
|
229
|
+
return this.playerConfig.timeOffset || 0;
|
|
230
|
+
}
|
|
231
|
+
}, {
|
|
232
|
+
key: "currentTime",
|
|
233
|
+
get: function get() {
|
|
234
|
+
var _this$player = this.player, offsetCurrentTime = _this$player.offsetCurrentTime, currentTime = _this$player.currentTime;
|
|
235
|
+
return offsetCurrentTime >= 0 ? offsetCurrentTime : currentTime + this.timeOffset;
|
|
236
|
+
}
|
|
237
|
+
}, {
|
|
238
|
+
key: "changeState",
|
|
239
|
+
value: function changeState() {
|
|
240
|
+
var useable = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
241
|
+
this.useable = useable;
|
|
242
|
+
}
|
|
243
|
+
}, {
|
|
244
|
+
key: "show",
|
|
245
|
+
value: function show() {
|
|
246
|
+
this.root && (this.root.style.display = "flex");
|
|
247
|
+
}
|
|
248
|
+
}, {
|
|
249
|
+
key: "_initInner",
|
|
250
|
+
value: function _initInner() {
|
|
251
|
+
var _this2 = this;
|
|
252
|
+
var fragments = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
253
|
+
var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
254
|
+
if (!fragments || fragments.length === 0) {
|
|
255
|
+
fragments = [{
|
|
256
|
+
percent: 1
|
|
257
|
+
}];
|
|
258
|
+
}
|
|
259
|
+
var _c = _objectSpread2(_objectSpread2({
|
|
260
|
+
fragments
|
|
261
|
+
}, config), {}, {
|
|
262
|
+
actionCallback: function actionCallback(data) {
|
|
263
|
+
_this2.emitUserAction("fragment_focus", "fragment_focus", data);
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
if (!this.innerList) {
|
|
267
|
+
this.innerList = new InnerList(_c);
|
|
268
|
+
this.outer.insertBefore(this.innerList.render(), this.outer.children[0]);
|
|
269
|
+
["findHightLight", "unHightLight", "setHightLight", "findFragment"].map(function(item) {
|
|
270
|
+
_this2[item] = _this2.innerList[item].bind(_this2.innerList);
|
|
271
|
+
});
|
|
272
|
+
} else {
|
|
273
|
+
this.innerList.reset(_c);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}, {
|
|
277
|
+
key: "_updateInnerFocus",
|
|
278
|
+
value: function _updateInnerFocus(data) {
|
|
279
|
+
this.innerList && this.innerList.updateFocus(data);
|
|
280
|
+
}
|
|
281
|
+
}, {
|
|
282
|
+
key: "afterCreate",
|
|
283
|
+
value: function afterCreate() {
|
|
284
|
+
var _this3 = this;
|
|
285
|
+
if (this.config.disable || this.playerConfig.isLive) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
this.pos = {
|
|
289
|
+
x: 0,
|
|
290
|
+
y: 0,
|
|
291
|
+
moving: false,
|
|
292
|
+
isDown: false,
|
|
293
|
+
isEnter: false,
|
|
294
|
+
isLocked: false
|
|
295
|
+
};
|
|
296
|
+
this.outer = this.find("xg-outer");
|
|
297
|
+
var _this$config = this.config, fragFocusClass = _this$config.fragFocusClass, fragAutoFocus = _this$config.fragAutoFocus, fragClass = _this$config.fragClass;
|
|
298
|
+
this._initInner(this.config.fragments, {
|
|
299
|
+
fragFocusClass,
|
|
300
|
+
fragAutoFocus,
|
|
301
|
+
fragClass,
|
|
302
|
+
style: this.playerConfig.commonStyle || {}
|
|
303
|
+
});
|
|
304
|
+
if (sniffer.device === "mobile") {
|
|
305
|
+
this.config.isDragingSeek = false;
|
|
306
|
+
this.isMobile = true;
|
|
307
|
+
}
|
|
308
|
+
this.progressBtn = this.find(".xgplayer-progress-btn");
|
|
309
|
+
this.on(DURATION_CHANGE, function() {
|
|
310
|
+
_this3.onMouseLeave();
|
|
311
|
+
});
|
|
312
|
+
this.on(TIME_UPDATE, function() {
|
|
313
|
+
_this3.onTimeupdate();
|
|
314
|
+
});
|
|
315
|
+
this.on(SEEKED, function() {
|
|
316
|
+
_this3.onTimeupdate();
|
|
317
|
+
_this3.onCacheUpdate();
|
|
318
|
+
});
|
|
319
|
+
this.on(PROGRESS, function() {
|
|
320
|
+
_this3.onCacheUpdate();
|
|
321
|
+
});
|
|
322
|
+
this.on(ENDED, function() {
|
|
323
|
+
_this3.onCacheUpdate(true);
|
|
324
|
+
_this3.onTimeupdate(true);
|
|
325
|
+
_this3._state.now = 0;
|
|
326
|
+
});
|
|
327
|
+
this.on(EMPTIED, function() {
|
|
328
|
+
_this3.onReset();
|
|
329
|
+
});
|
|
330
|
+
this.on(VIDEO_RESIZE, function() {
|
|
331
|
+
_this3.onVideoResize();
|
|
332
|
+
});
|
|
333
|
+
this.bindDomEvents();
|
|
334
|
+
this.initCustomStyle();
|
|
335
|
+
}
|
|
336
|
+
}, {
|
|
337
|
+
key: "setConfig",
|
|
338
|
+
value: function setConfig(config) {
|
|
339
|
+
var _this4 = this;
|
|
340
|
+
var frags = null;
|
|
341
|
+
Object.keys(config).forEach(function(key) {
|
|
342
|
+
_this4.config[key] = config[key];
|
|
343
|
+
if (key === "fragments") {
|
|
344
|
+
frags = config[key];
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
if (frags) {
|
|
348
|
+
this._initInner(frags, config);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}, {
|
|
352
|
+
key: "initCustomStyle",
|
|
353
|
+
value: function initCustomStyle() {
|
|
354
|
+
var _ref = this.playerConfig || {}, commonStyle = _ref.commonStyle;
|
|
355
|
+
var sliderBtnStyle = commonStyle.sliderBtnStyle;
|
|
356
|
+
var progressBtn = this.progressBtn;
|
|
357
|
+
if (sliderBtnStyle) {
|
|
358
|
+
if (typeof sliderBtnStyle === "string") {
|
|
359
|
+
progressBtn.style.boxShadow = sliderBtnStyle;
|
|
360
|
+
} else if (_typeof(sliderBtnStyle) === "object") {
|
|
361
|
+
Object.keys(sliderBtnStyle).map(function(key) {
|
|
362
|
+
progressBtn.style[key] = sliderBtnStyle[key];
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}, {
|
|
368
|
+
key: "triggerCallbacks",
|
|
369
|
+
value: function triggerCallbacks(type, data, event) {
|
|
370
|
+
if (this.__dragCallBacks.length > 0) {
|
|
371
|
+
this.__dragCallBacks.map(function(item) {
|
|
372
|
+
if (item && item.handler && item.type === type) {
|
|
373
|
+
try {
|
|
374
|
+
item.handler(data, event);
|
|
375
|
+
} catch (error) {
|
|
376
|
+
console.error("[XGPLAYER][triggerCallbacks] ".concat(item, " error"), error);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}, {
|
|
383
|
+
key: "addCallBack",
|
|
384
|
+
value: function addCallBack(type, handle) {
|
|
385
|
+
if (handle && typeof handle === "function") {
|
|
386
|
+
this.__dragCallBacks.push({
|
|
387
|
+
type,
|
|
388
|
+
handler: handle
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}, {
|
|
393
|
+
key: "removeCallBack",
|
|
394
|
+
value: function removeCallBack(type, event) {
|
|
395
|
+
var __dragCallBacks = this.__dragCallBacks;
|
|
396
|
+
var _index = -1;
|
|
397
|
+
__dragCallBacks.map(function(item, index) {
|
|
398
|
+
if (item && item.type === type && item.handler === event) {
|
|
399
|
+
_index = index;
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
if (_index > -1) {
|
|
403
|
+
__dragCallBacks.splice(_index, 1);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}, {
|
|
407
|
+
key: "unlock",
|
|
408
|
+
value: function unlock() {
|
|
409
|
+
var player = this.player, pos = this.pos;
|
|
410
|
+
pos.isEnter = false;
|
|
411
|
+
if (player.isMini) {
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
this.unbind("mousemove", this.onMoveOnly);
|
|
415
|
+
if (pos.isDown) {
|
|
416
|
+
this.unbind("mouseleave", this.onMouseLeave);
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
this.blur();
|
|
420
|
+
}
|
|
421
|
+
}, {
|
|
422
|
+
key: "bindDomEvents",
|
|
423
|
+
value: function bindDomEvents() {
|
|
424
|
+
var _this$player2 = this.player, controls = _this$player2.controls, config = _this$player2.config;
|
|
425
|
+
this._mouseDownHandlerHook = this.hook("dragstart", this._mouseDownHandler);
|
|
426
|
+
this._mouseUpHandlerHook = this.hook("dragend", this._mouseUpHandler);
|
|
427
|
+
this._mouseMoveHandlerHook = this.hook("drag", this._mouseMoveHandler);
|
|
428
|
+
if (this.domEventType === "touch" || this.domEventType === "compatible") {
|
|
429
|
+
this.root.addEventListener("touchstart", this.onMouseDown);
|
|
430
|
+
if (controls) {
|
|
431
|
+
controls.root && controls.root.addEventListener("touchmove", util.stopPropagation);
|
|
432
|
+
controls.center && controls.center.addEventListener("touchend", util.stopPropagation);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
if (this.domEventType === "mouse" || this.domEventType === "compatible") {
|
|
436
|
+
this.bind("mousedown", this.onMouseDown);
|
|
437
|
+
config.isMobileSimulateMode !== "mobile" && this.bind("mouseenter", this.onMouseEnter);
|
|
438
|
+
this.bind("mouseover", this.onMouseOver);
|
|
439
|
+
this.bind("mouseout", this.onMouseOut);
|
|
440
|
+
this.player.root.addEventListener("click", this.onBodyClick, true);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}, {
|
|
444
|
+
key: "focus",
|
|
445
|
+
value: function focus() {
|
|
446
|
+
this.player.controls.pauseAutoHide();
|
|
447
|
+
util.addClass(this.root, "active");
|
|
448
|
+
}
|
|
449
|
+
}, {
|
|
450
|
+
key: "blur",
|
|
451
|
+
value: function blur() {
|
|
452
|
+
if (this._disableBlur) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
this.player.controls.recoverAutoHide();
|
|
456
|
+
util.removeClass(this.root, "active");
|
|
457
|
+
}
|
|
458
|
+
}, {
|
|
459
|
+
key: "disableBlur",
|
|
460
|
+
value: function disableBlur() {
|
|
461
|
+
this._disableBlur = true;
|
|
462
|
+
}
|
|
463
|
+
}, {
|
|
464
|
+
key: "enableBlur",
|
|
465
|
+
value: function enableBlur() {
|
|
466
|
+
this._disableBlur = false;
|
|
467
|
+
}
|
|
468
|
+
}, {
|
|
469
|
+
key: "updateWidth",
|
|
470
|
+
value: function updateWidth(currentTime, seekTime, percent, type) {
|
|
471
|
+
var config = this.config, player = this.player;
|
|
472
|
+
if (config.isCloseClickSeek && type === 0) {
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
var realTime = seekTime = seekTime >= player.duration ? player.duration - config.endedDiff : Number(seekTime).toFixed(1);
|
|
476
|
+
this.updatePercent(percent);
|
|
477
|
+
this.updateTime(currentTime);
|
|
478
|
+
if (type === 1 && (!config.isDragingSeek || player.config.mediaType === "audio")) {
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
this._state.now = realTime;
|
|
482
|
+
this._state.direc = realTime > player.currentTime ? 0 : 1;
|
|
483
|
+
player.seek(realTime);
|
|
484
|
+
}
|
|
485
|
+
}, {
|
|
486
|
+
key: "computeTime",
|
|
487
|
+
value: function computeTime(e, x) {
|
|
488
|
+
var player = this.player;
|
|
489
|
+
var _this$root$getBoundin = this.root.getBoundingClientRect(), width = _this$root$getBoundin.width, height = _this$root$getBoundin.height, top = _this$root$getBoundin.top, left = _this$root$getBoundin.left;
|
|
490
|
+
var rWidth, rLeft;
|
|
491
|
+
var clientX = x;
|
|
492
|
+
if (player.rotateDeg === 90) {
|
|
493
|
+
rWidth = height;
|
|
494
|
+
rLeft = top;
|
|
495
|
+
} else {
|
|
496
|
+
rWidth = width;
|
|
497
|
+
rLeft = left;
|
|
498
|
+
}
|
|
499
|
+
var offset = clientX - rLeft;
|
|
500
|
+
offset = offset > rWidth ? rWidth : offset < 0 ? 0 : offset;
|
|
501
|
+
var percent = offset / rWidth;
|
|
502
|
+
percent = percent < 0 ? 0 : percent > 1 ? 1 : percent;
|
|
503
|
+
var currentTime = parseInt(percent * this.offsetDuration * 1e3, 10) / 1e3;
|
|
504
|
+
var seekTime = util.getCurrentTimeByOffset(currentTime, player.timeSegments);
|
|
505
|
+
return {
|
|
506
|
+
percent,
|
|
507
|
+
currentTime,
|
|
508
|
+
seekTime,
|
|
509
|
+
offset,
|
|
510
|
+
width: rWidth,
|
|
511
|
+
left: rLeft,
|
|
512
|
+
e
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
}, {
|
|
516
|
+
key: "updateTime",
|
|
517
|
+
value: function updateTime(time) {
|
|
518
|
+
var player = this.player, duration = this.duration;
|
|
519
|
+
if (time > duration) {
|
|
520
|
+
time = duration;
|
|
521
|
+
} else if (time < 0) {
|
|
522
|
+
time = 0;
|
|
523
|
+
}
|
|
524
|
+
var timeIcon = player.plugins.time;
|
|
525
|
+
if (timeIcon) {
|
|
526
|
+
timeIcon.updateTime(time);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}, {
|
|
530
|
+
key: "resetSeekState",
|
|
531
|
+
value: function resetSeekState() {
|
|
532
|
+
this.isProgressMoving = false;
|
|
533
|
+
var timeIcon = this.player.plugins.time;
|
|
534
|
+
timeIcon && timeIcon.resetActive();
|
|
535
|
+
}
|
|
536
|
+
}, {
|
|
537
|
+
key: "updatePercent",
|
|
538
|
+
value: function updatePercent(percent, notSeek) {
|
|
539
|
+
this.isProgressMoving = true;
|
|
540
|
+
if (this.config.disable) {
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
percent = percent > 1 ? 1 : percent < 0 ? 0 : percent;
|
|
544
|
+
this.progressBtn.style.left = "".concat(percent * 100, "%");
|
|
545
|
+
this.innerList.update({
|
|
546
|
+
played: percent * this.offsetDuration
|
|
547
|
+
}, this.offsetDuration);
|
|
548
|
+
var miniprogress = this.player.plugins.miniprogress;
|
|
549
|
+
miniprogress && miniprogress.update({
|
|
550
|
+
played: percent * this.offsetDuration
|
|
551
|
+
}, this.offsetDuration);
|
|
552
|
+
}
|
|
553
|
+
}, {
|
|
554
|
+
key: "onTimeupdate",
|
|
555
|
+
value: function onTimeupdate(isEnded) {
|
|
556
|
+
var player = this.player, _state = this._state, offsetDuration = this.offsetDuration;
|
|
557
|
+
if (player.isSeeking || this.isProgressMoving) {
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
if (_state.now > -1) {
|
|
561
|
+
var abs = parseInt(_state.now * 1e3, 10) - parseInt(player.currentTime * 1e3, 10);
|
|
562
|
+
if (_state.direc === 0 && abs > 300 || _state.direc === 1 && abs > -300) {
|
|
563
|
+
_state.now = -1;
|
|
564
|
+
return;
|
|
565
|
+
} else {
|
|
566
|
+
_state.now = -1;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
var time = this.currentTime;
|
|
570
|
+
time = util.adjustTimeByDuration(time, offsetDuration, isEnded);
|
|
571
|
+
this.innerList.update({
|
|
572
|
+
played: time
|
|
573
|
+
}, offsetDuration);
|
|
574
|
+
this.progressBtn.style.left = "".concat(time / offsetDuration * 100, "%");
|
|
575
|
+
var miniprogress = this.player.plugins.miniprogress;
|
|
576
|
+
miniprogress && miniprogress.update({
|
|
577
|
+
played: time
|
|
578
|
+
}, offsetDuration);
|
|
579
|
+
}
|
|
580
|
+
}, {
|
|
581
|
+
key: "onCacheUpdate",
|
|
582
|
+
value: function onCacheUpdate(isEnded) {
|
|
583
|
+
var player = this.player, duration = this.duration;
|
|
584
|
+
if (!player) {
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
var _end = player.bufferedPoint.end;
|
|
588
|
+
_end = util.adjustTimeByDuration(_end, duration, isEnded);
|
|
589
|
+
this.innerList.update({
|
|
590
|
+
cached: _end
|
|
591
|
+
}, duration);
|
|
592
|
+
var miniprogress = this.player.plugins.miniprogress;
|
|
593
|
+
miniprogress && miniprogress.update({
|
|
594
|
+
cached: _end
|
|
595
|
+
}, duration);
|
|
596
|
+
}
|
|
597
|
+
}, {
|
|
598
|
+
key: "onReset",
|
|
599
|
+
value: function onReset() {
|
|
600
|
+
this.innerList.update({
|
|
601
|
+
played: 0,
|
|
602
|
+
cached: 0
|
|
603
|
+
}, 0);
|
|
604
|
+
var miniprogress = this.player.plugins.miniprogress;
|
|
605
|
+
miniprogress && miniprogress.update({
|
|
606
|
+
cached: 0,
|
|
607
|
+
played: 0
|
|
608
|
+
}, 0);
|
|
609
|
+
}
|
|
610
|
+
}, {
|
|
611
|
+
key: "destroy",
|
|
612
|
+
value: function destroy() {
|
|
613
|
+
var player = this.player;
|
|
614
|
+
var controls = player.controls;
|
|
615
|
+
this.thumbnailPlugin = null;
|
|
616
|
+
this.innerList.destroy();
|
|
617
|
+
this.innerList = null;
|
|
618
|
+
var domEventType = this.domEventType;
|
|
619
|
+
if (domEventType === "touch" || domEventType === "compatible") {
|
|
620
|
+
this.root.removeEventListener("touchstart", this.onMouseDown);
|
|
621
|
+
this.root.removeEventListener("touchmove", this.onMouseMove);
|
|
622
|
+
this.root.removeEventListener("touchend", this.onMouseUp);
|
|
623
|
+
if (controls) {
|
|
624
|
+
controls.root && controls.root.removeEventListener("touchmove", util.stopPropagation);
|
|
625
|
+
controls.center && controls.center.removeEventListener("touchend", util.stopPropagation);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
if (domEventType === "mouse" || domEventType === "compatible") {
|
|
629
|
+
this.unbind("mousedown", this.onMouseDown);
|
|
630
|
+
this.unbind("mouseenter", this.onMouseEnter);
|
|
631
|
+
this.unbind("mousemove", this.onMoveOnly);
|
|
632
|
+
this.unbind("mouseleave", this.onMouseLeave);
|
|
633
|
+
document.removeEventListener("mousemove", this.onMouseMove, false);
|
|
634
|
+
document.removeEventListener("mouseup", this.onMouseUp, false);
|
|
635
|
+
player.root.removeEventListener("click", this.onBodyClick, true);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}, {
|
|
639
|
+
key: "render",
|
|
640
|
+
value: function render() {
|
|
641
|
+
if (this.config.disable || this.playerConfig.isLive) {
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
var controlsMode = this.player.controls ? this.player.controls.config.mode : "";
|
|
645
|
+
var className = controlsMode === "bottom" ? "xgplayer-progress-bottom" : "";
|
|
646
|
+
return '\n <xg-progress class="xgplayer-progress '.concat(className, '">\n <xg-outer class="xgplayer-progress-outer">\n <xg-progress-btn class="xgplayer-progress-btn"></xg-progress-btn>\n </xg-outer>\n </xg-progress>\n ');
|
|
647
|
+
}
|
|
648
|
+
}], [{
|
|
649
|
+
key: "pluginName",
|
|
650
|
+
get: function get() {
|
|
651
|
+
return "progress";
|
|
652
|
+
}
|
|
653
|
+
}, {
|
|
654
|
+
key: "defaultConfig",
|
|
655
|
+
get: function get() {
|
|
656
|
+
return {
|
|
657
|
+
position: POSITIONS.CONTROLS_CENTER,
|
|
658
|
+
index: 0,
|
|
659
|
+
disable: false,
|
|
660
|
+
isDragingSeek: true,
|
|
661
|
+
closeMoveSeek: false,
|
|
662
|
+
isPauseMoving: false,
|
|
663
|
+
isCloseClickSeek: false,
|
|
664
|
+
fragments: [{
|
|
665
|
+
percent: 1
|
|
666
|
+
}],
|
|
667
|
+
fragFocusClass: FRAGMENT_FOCUS_CLASS.POINT,
|
|
668
|
+
fragClass: "",
|
|
669
|
+
fragAutoFocus: false,
|
|
670
|
+
miniMoveStep: 5,
|
|
671
|
+
miniStartStep: 2,
|
|
672
|
+
onMoveStart: function onMoveStart() {
|
|
673
|
+
},
|
|
674
|
+
onMoveEnd: function onMoveEnd() {
|
|
675
|
+
},
|
|
676
|
+
endedDiff: 0.2
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
}, {
|
|
680
|
+
key: "FRAGMENT_FOCUS_CLASS",
|
|
681
|
+
get: function get() {
|
|
682
|
+
return FRAGMENT_FOCUS_CLASS;
|
|
683
|
+
}
|
|
684
|
+
}]);
|
|
685
|
+
return Progress2;
|
|
686
|
+
}(Plugin);
|
|
687
|
+
export { Progress as default };
|