@byteplus/veplayer-plugin 2.8.0-rc.0 → 2.8.0-rc.10
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/esm/index.d.ts +2 -0
- package/esm/index.development.js +76618 -35156
- package/esm/index.production.js +8 -7
- package/esm/veplayer.plugin.ad.development.js +1412 -1398
- package/esm/veplayer.plugin.ad.production.js +2 -2
- package/esm/veplayer.plugin.drm.development.js +147 -63
- package/esm/veplayer.plugin.drm.production.js +1 -1
- package/esm/veplayer.plugin.hlsjs.development.js +32501 -10992
- package/esm/veplayer.plugin.hlsjs.production.js +1 -1
- package/esm/veplayer.plugin.rtm.development.js +165 -70
- package/esm/veplayer.plugin.rtm.production.js +1 -1
- package/esm/veplayer.strategy.base.development.js +1 -1
- package/esm/veplayer.strategy.base.production.js +1 -1
- package/package.json +1 -1
- package/umd/index.d.ts +2 -0
- package/umd/veplayer.plugin.ad.development.js +1412 -1398
- package/umd/veplayer.plugin.ad.production.js +1 -1
- package/umd/veplayer.plugin.drm.development.js +148 -64
- package/umd/veplayer.plugin.drm.production.js +1 -1
- package/umd/veplayer.plugin.hlsjs.development.js +32478 -10969
- package/umd/veplayer.plugin.hlsjs.production.js +1 -1
- package/umd/veplayer.plugin.rtm.development.js +165 -70
- package/umd/veplayer.plugin.rtm.production.js +1 -1
|
@@ -1811,6 +1811,8 @@ var __publicField = (obj, key, value) => {
|
|
|
1811
1811
|
var ua = navigator.userAgent;
|
|
1812
1812
|
var isWindowsPhone = /(?:Windows Phone)/.test(ua);
|
|
1813
1813
|
var isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone;
|
|
1814
|
+
var isTizen = /(?:Tizen)/ig.test(ua);
|
|
1815
|
+
var isWebOS = /(?:Web0S)/ig.test(ua);
|
|
1814
1816
|
var isAndroid = /(?:Android)/.test(ua);
|
|
1815
1817
|
var isFireFox = /(?:Firefox)/.test(ua);
|
|
1816
1818
|
var isIpad = /(?:iPad|PlayBook)/.test(ua) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
@@ -1826,7 +1828,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1826
1828
|
isPc,
|
|
1827
1829
|
isSymbian,
|
|
1828
1830
|
isWindowsPhone,
|
|
1829
|
-
isFireFox
|
|
1831
|
+
isFireFox,
|
|
1832
|
+
isTizen,
|
|
1833
|
+
isWebOS
|
|
1830
1834
|
};
|
|
1831
1835
|
},
|
|
1832
1836
|
get osVersion() {
|
|
@@ -2552,6 +2556,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2552
2556
|
this.icons = {};
|
|
2553
2557
|
this.root = null;
|
|
2554
2558
|
this.parent = null;
|
|
2559
|
+
this.extraEls = [];
|
|
2555
2560
|
var _orgicons = this.registerIcons() || {};
|
|
2556
2561
|
registerIconsObj(_orgicons, this);
|
|
2557
2562
|
this.langText = {};
|
|
@@ -2894,6 +2899,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2894
2899
|
["root", "parent"].map(function(item) {
|
|
2895
2900
|
_this7[item] = null;
|
|
2896
2901
|
});
|
|
2902
|
+
this.extraEls = [];
|
|
2897
2903
|
}
|
|
2898
2904
|
}], [{
|
|
2899
2905
|
key: "insert",
|
|
@@ -3010,12 +3016,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3010
3016
|
ENDED: 7,
|
|
3011
3017
|
DESTROYED: 8
|
|
3012
3018
|
};
|
|
3013
|
-
function PlaySvg() {
|
|
3014
|
-
return new DOMParser().parseFromString('<svg class="play" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M576,363L810,512L576,661zM342,214L576,363L576,661L342,810z"></path>\n</svg>\n', "image/svg+xml").firstChild;
|
|
3015
|
-
}
|
|
3016
|
-
function PauseSvg() {
|
|
3017
|
-
return new DOMParser().parseFromString('<svg class="pause" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598,214h170v596h-170v-596zM256 810v-596h170v596h-170z"></path>\n</svg>\n', "image/svg+xml").firstChild;
|
|
3018
|
-
}
|
|
3019
3019
|
function xgIconTips(plugin2, textKey, isShow) {
|
|
3020
3020
|
try {
|
|
3021
3021
|
return ' <div class="xg-tips '.concat(isShow ? "hide" : " ", '" lang-key="').concat(plugin2.i18nKeys[textKey], '">\n ').concat(plugin2.i18n[textKey], "\n </div>");
|
|
@@ -3023,1400 +3023,1547 @@ var __publicField = (obj, key, value) => {
|
|
|
3023
3023
|
return '<div class="xg-tips hide"></div>';
|
|
3024
3024
|
}
|
|
3025
3025
|
}
|
|
3026
|
-
var
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3026
|
+
var Icon = /* @__PURE__ */ function(_Plugin) {
|
|
3027
|
+
_inherits(Icon2, _Plugin);
|
|
3028
|
+
var _super = _createSuper(Icon2);
|
|
3029
|
+
function Icon2() {
|
|
3030
|
+
var _this;
|
|
3031
|
+
_classCallCheck$1(this, Icon2);
|
|
3032
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3033
|
+
args[_key] = arguments[_key];
|
|
3034
|
+
}
|
|
3035
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
3036
|
+
_defineProperty$1(_assertThisInitialized(_this), "_onMouseenter", function(e2) {
|
|
3037
|
+
_this.emit("icon_mouseenter", {
|
|
3038
|
+
pluginName: _this.pluginName
|
|
3039
|
+
});
|
|
3040
|
+
});
|
|
3041
|
+
_defineProperty$1(_assertThisInitialized(_this), "_onMouseLeave", function(e2) {
|
|
3042
|
+
_this.emit("icon_mouseleave", {
|
|
3043
|
+
pluginName: _this.pluginName
|
|
3042
3044
|
});
|
|
3045
|
+
});
|
|
3046
|
+
return _this;
|
|
3047
|
+
}
|
|
3048
|
+
_createClass$1(Icon2, [{
|
|
3049
|
+
key: "afterCreate",
|
|
3050
|
+
value: function afterCreate() {
|
|
3051
|
+
this.bind("mouseenter", this._onMouseenter);
|
|
3052
|
+
this.bind("mouseleave", this._onMouseLeave);
|
|
3053
|
+
if (this.config.disable) {
|
|
3054
|
+
this.disable();
|
|
3055
|
+
}
|
|
3043
3056
|
}
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
}
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3057
|
+
}, {
|
|
3058
|
+
key: "destroy",
|
|
3059
|
+
value: function destroy() {
|
|
3060
|
+
this.unbind("mouseenter", this._onMouseenter);
|
|
3061
|
+
this.unbind("mouseleave", this._onMouseLeave);
|
|
3062
|
+
}
|
|
3063
|
+
}]);
|
|
3064
|
+
return Icon2;
|
|
3065
|
+
}(Plugin);
|
|
3066
|
+
function CssFullSceenSvg() {
|
|
3067
|
+
return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">
|
|
3068
|
+
<path fill="#fff" transform="scale(1.3, 1.3)" class='path_full' d="M9,10v1a.9.9,0,0,1-1,1,.9.9,0,0,1-1-1V9A.9.9,0,0,1,8,8h2a.9.9,0,0,1,1,1,.9.9,0,0,1-1,1Zm6,4V13a1,1,0,0,1,2,0v2a.9.9,0,0,1-1,1H14a1,1,0,0,1,0-2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>
|
|
3069
|
+
</svg>
|
|
3070
|
+
`, "image/svg+xml").firstChild;
|
|
3071
|
+
}
|
|
3072
|
+
function ExitCssFullSceenSvg() {
|
|
3073
|
+
return new DOMParser().parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">\n <path fill="#fff" transform="scale(1.3, 1.3)" d="M9,10V9a.9.9,0,0,1,1-1,.9.9,0,0,1,1,1v2a.9.9,0,0,1-1,1H8a.9.9,0,0,1-1-1,.9.9,0,0,1,1-1Zm6,4v1a1,1,0,0,1-2,0V13a.9.9,0,0,1,1-1h2a1,1,0,0,1,0,2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>\n</svg>\n', "image/svg+xml").firstChild;
|
|
3074
|
+
}
|
|
3075
|
+
var CssFullScreen = /* @__PURE__ */ function(_IconPlugin) {
|
|
3076
|
+
_inherits(CssFullScreen2, _IconPlugin);
|
|
3077
|
+
var _super = _createSuper(CssFullScreen2);
|
|
3078
|
+
function CssFullScreen2() {
|
|
3079
|
+
_classCallCheck$1(this, CssFullScreen2);
|
|
3080
|
+
return _super.apply(this, arguments);
|
|
3059
3081
|
}
|
|
3060
|
-
_createClass$1(
|
|
3061
|
-
key: "
|
|
3062
|
-
value: function
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
var fragments = this.fragments;
|
|
3067
|
-
this.fragments = fragments.map(function(item) {
|
|
3068
|
-
item.start = parseInt(start, 10);
|
|
3069
|
-
item.end = parseInt(start + item.percent * _this.duration, 10);
|
|
3070
|
-
item.duration = parseInt(item.percent * _this.duration, 10);
|
|
3071
|
-
start += item.percent * _this.duration;
|
|
3072
|
-
return item;
|
|
3073
|
-
});
|
|
3082
|
+
_createClass$1(CssFullScreen2, [{
|
|
3083
|
+
key: "beforeCreate",
|
|
3084
|
+
value: function beforeCreate(args) {
|
|
3085
|
+
if (typeof args.player.config.cssFullscreen === "boolean") {
|
|
3086
|
+
args.config.disable = !args.player.config.cssFullscreen;
|
|
3087
|
+
}
|
|
3074
3088
|
}
|
|
3075
3089
|
}, {
|
|
3076
|
-
key: "
|
|
3077
|
-
value: function
|
|
3078
|
-
var
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
curIndex: 0,
|
|
3082
|
-
millisecond: 0
|
|
3083
|
-
};
|
|
3084
|
-
var progressList = this.progressList, fragments = this.fragments;
|
|
3085
|
-
if (progressList.length < 1) {
|
|
3090
|
+
key: "afterCreate",
|
|
3091
|
+
value: function afterCreate() {
|
|
3092
|
+
var _this = this;
|
|
3093
|
+
_get(_getPrototypeOf(CssFullScreen2.prototype), "afterCreate", this).call(this);
|
|
3094
|
+
if (this.config.disable) {
|
|
3086
3095
|
return;
|
|
3087
3096
|
}
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
progressList.map(function(item, index2) {
|
|
3091
|
-
if (index2 < newIndex) {
|
|
3092
|
-
item[type].style.width = "100%";
|
|
3093
|
-
} else if (index2 > newIndex) {
|
|
3094
|
-
item[type].style.width = 0;
|
|
3095
|
-
}
|
|
3096
|
-
});
|
|
3097
|
+
if (this.config.target) {
|
|
3098
|
+
this.playerConfig.fullscreenTarget = this.config.target;
|
|
3097
3099
|
}
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3100
|
+
this.initIcons();
|
|
3101
|
+
this.on(CSS_FULLSCREEN_CHANGE, function(isCssfullScreen) {
|
|
3102
|
+
_this.animate(isCssfullScreen);
|
|
3103
|
+
});
|
|
3104
|
+
this.btnClick = this.btnClick.bind(this);
|
|
3105
|
+
this.handleCssFullscreen = this.hook("cssFullscreen_change", this.btnClick, {
|
|
3106
|
+
pre: function pre(e2) {
|
|
3107
|
+
e2.preventDefault();
|
|
3108
|
+
e2.stopPropagation();
|
|
3109
|
+
}
|
|
3110
|
+
});
|
|
3111
|
+
this.bind(["click", "touchend"], this.handleCssFullscreen);
|
|
3101
3112
|
}
|
|
3102
3113
|
}, {
|
|
3103
|
-
key: "
|
|
3104
|
-
value: function
|
|
3105
|
-
|
|
3114
|
+
key: "initIcons",
|
|
3115
|
+
value: function initIcons() {
|
|
3116
|
+
var icons = this.icons;
|
|
3117
|
+
var contentIcon = this.find(".xgplayer-icon");
|
|
3118
|
+
contentIcon.appendChild(icons.cssFullscreen);
|
|
3119
|
+
contentIcon.appendChild(icons.exitCssFullscreen);
|
|
3120
|
+
}
|
|
3121
|
+
}, {
|
|
3122
|
+
key: "btnClick",
|
|
3123
|
+
value: function btnClick(e2) {
|
|
3124
|
+
e2.preventDefault();
|
|
3125
|
+
e2.stopPropagation();
|
|
3126
|
+
var isCssfullScreen = this.player.isCssfullScreen;
|
|
3127
|
+
this.emitUserAction(e2, "switch_cssfullscreen", {
|
|
3128
|
+
cssfullscreen: isCssfullScreen
|
|
3129
|
+
});
|
|
3130
|
+
if (!isCssfullScreen) {
|
|
3131
|
+
this.player.getCssFullscreen();
|
|
3132
|
+
} else {
|
|
3133
|
+
this.player.exitCssFullscreen();
|
|
3134
|
+
}
|
|
3135
|
+
}
|
|
3136
|
+
}, {
|
|
3137
|
+
key: "animate",
|
|
3138
|
+
value: function animate(isFullScreen) {
|
|
3139
|
+
if (!this.root) {
|
|
3106
3140
|
return;
|
|
3107
3141
|
}
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3142
|
+
isFullScreen ? this.setAttr("data-state", "full") : this.setAttr("data-state", "normal");
|
|
3143
|
+
this.switchTips(isFullScreen);
|
|
3144
|
+
}
|
|
3145
|
+
}, {
|
|
3146
|
+
key: "switchTips",
|
|
3147
|
+
value: function switchTips(isFullScreen) {
|
|
3148
|
+
var i18nKeys = this.i18nKeys;
|
|
3149
|
+
var tipDom = this.find(".xg-tips");
|
|
3150
|
+
tipDom && this.changeLangTextKey(tipDom, isFullScreen ? i18nKeys.EXITCSSFULLSCREEN_TIPS : i18nKeys.CSSFULLSCREEN_TIPS);
|
|
3151
|
+
}
|
|
3152
|
+
}, {
|
|
3153
|
+
key: "registerIcons",
|
|
3154
|
+
value: function registerIcons() {
|
|
3155
|
+
return {
|
|
3156
|
+
cssFullscreen: {
|
|
3157
|
+
icon: CssFullSceenSvg,
|
|
3158
|
+
class: "xg-get-cssfull"
|
|
3159
|
+
},
|
|
3160
|
+
exitCssFullscreen: {
|
|
3161
|
+
icon: ExitCssFullSceenSvg,
|
|
3162
|
+
class: "xg-exit-cssfull"
|
|
3118
3163
|
}
|
|
3164
|
+
};
|
|
3165
|
+
}
|
|
3166
|
+
}, {
|
|
3167
|
+
key: "destroy",
|
|
3168
|
+
value: function destroy() {
|
|
3169
|
+
_get(_getPrototypeOf(CssFullScreen2.prototype), "destroy", this).call(this);
|
|
3170
|
+
this.unbind(["click", "touchend"], this.btnClick);
|
|
3171
|
+
}
|
|
3172
|
+
}, {
|
|
3173
|
+
key: "render",
|
|
3174
|
+
value: function render() {
|
|
3175
|
+
if (this.config.disable) {
|
|
3119
3176
|
return;
|
|
3120
3177
|
}
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
this.focusIndex = newPIndex;
|
|
3131
|
-
this._callBack && this._callBack(_data2);
|
|
3132
|
-
}
|
|
3178
|
+
return `<xg-icon class='xgplayer-cssfullscreen'>
|
|
3179
|
+
<div class="xgplayer-icon">
|
|
3180
|
+
</div>
|
|
3181
|
+
`.concat(xgIconTips(this, "CSSFULLSCREEN_TIPS", this.playerConfig.isHideTips), "\n </xg-icon>");
|
|
3182
|
+
}
|
|
3183
|
+
}], [{
|
|
3184
|
+
key: "pluginName",
|
|
3185
|
+
get: function get() {
|
|
3186
|
+
return "cssFullscreen";
|
|
3133
3187
|
}
|
|
3134
3188
|
}, {
|
|
3135
|
-
key: "
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3189
|
+
key: "defaultConfig",
|
|
3190
|
+
get: function get() {
|
|
3191
|
+
return {
|
|
3192
|
+
position: POSITIONS.CONTROLS_RIGHT,
|
|
3193
|
+
index: 1,
|
|
3194
|
+
disable: false,
|
|
3195
|
+
target: null
|
|
3140
3196
|
};
|
|
3141
|
-
var duration = arguments.length > 1 ? arguments[1] : void 0;
|
|
3142
|
-
if (!this.duration || parseInt(duration * 1e3, 10) !== this.duration) {
|
|
3143
|
-
if (!duration && duration !== 0) {
|
|
3144
|
-
return;
|
|
3145
|
-
}
|
|
3146
|
-
this.updateDuration(parseInt(duration * 1e3, 10));
|
|
3147
|
-
}
|
|
3148
|
-
var playedIndex = this.playedIndex, cachedIndex = this.cachedIndex;
|
|
3149
|
-
if (util$3.typeOf(data.played) !== "Undefined") {
|
|
3150
|
-
var newPIndex = this.findIndex(data.played * 1e3, playedIndex);
|
|
3151
|
-
if (newPIndex < 0) {
|
|
3152
|
-
return;
|
|
3153
|
-
}
|
|
3154
|
-
this.updateProgress("played", {
|
|
3155
|
-
newIndex: newPIndex,
|
|
3156
|
-
curIndex: playedIndex,
|
|
3157
|
-
millisecond: parseInt(data.played * 1e3, 10)
|
|
3158
|
-
});
|
|
3159
|
-
this.playedIndex = newPIndex;
|
|
3160
|
-
}
|
|
3161
|
-
if (util$3.typeOf(data.cached) !== "Undefined") {
|
|
3162
|
-
var newCIndex = this.findIndex(data.cached * 1e3, cachedIndex);
|
|
3163
|
-
if (newCIndex < 0) {
|
|
3164
|
-
return;
|
|
3165
|
-
}
|
|
3166
|
-
this.updateProgress("cached", {
|
|
3167
|
-
newIndex: newCIndex,
|
|
3168
|
-
curIndex: cachedIndex,
|
|
3169
|
-
millisecond: parseInt(data.cached * 1e3, 10)
|
|
3170
|
-
});
|
|
3171
|
-
this.cachedIndex = newCIndex;
|
|
3172
|
-
}
|
|
3173
|
-
}
|
|
3174
|
-
}, {
|
|
3175
|
-
key: "findIndex",
|
|
3176
|
-
value: function findIndex(time, curIndex) {
|
|
3177
|
-
var fragments = this.fragments;
|
|
3178
|
-
if (!fragments || fragments.length === 0) {
|
|
3179
|
-
return -1;
|
|
3180
|
-
}
|
|
3181
|
-
if (fragments.length === 1) {
|
|
3182
|
-
return 0;
|
|
3183
|
-
}
|
|
3184
|
-
if (curIndex > -1 && curIndex < fragments.length && time > fragments[curIndex].start && time < fragments[curIndex].end) {
|
|
3185
|
-
return curIndex;
|
|
3186
|
-
}
|
|
3187
|
-
if (time > fragments[fragments.length - 1].start) {
|
|
3188
|
-
return fragments.length - 1;
|
|
3189
|
-
}
|
|
3190
|
-
for (var i2 = 0; i2 < fragments.length; i2++) {
|
|
3191
|
-
if (time > fragments[i2].start && time <= fragments[i2].end) {
|
|
3192
|
-
curIndex = i2;
|
|
3193
|
-
break;
|
|
3194
|
-
}
|
|
3195
|
-
}
|
|
3196
|
-
return curIndex;
|
|
3197
3197
|
}
|
|
3198
|
-
}
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3198
|
+
}]);
|
|
3199
|
+
return CssFullScreen2;
|
|
3200
|
+
}(Icon);
|
|
3201
|
+
function BackSVG() {
|
|
3202
|
+
return new DOMParser().parseFromString('<svg width="32px" height="40px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">\n <path d="M11.2374369,14 L17.6187184,7.61871843 C17.9604272,7.27700968 17.9604272,6.72299032 17.6187184,6.38128157 C17.2770097,6.03957281 16.7229903,6.03957281 16.3812816,6.38128157 L9.38128157,13.3812816 C9.03957281,13.7229903 9.03957281,14.2770097 9.38128157,14.6187184 L16.3812816,21.6187184 C16.7229903,21.9604272 17.2770097,21.9604272 17.6187184,21.6187184 C17.9604272,21.2770097 17.9604272,20.7229903 17.6187184,20.3812816 L11.2374369,14 L11.2374369,14 Z" fill="#FFFFFF"></path>\n </g>\n</svg>', "image/svg+xml").firstChild;
|
|
3203
|
+
}
|
|
3204
|
+
var TopBackIcon = /* @__PURE__ */ function(_Plugin) {
|
|
3205
|
+
_inherits(TopBackIcon2, _Plugin);
|
|
3206
|
+
var _super = _createSuper(TopBackIcon2);
|
|
3207
|
+
function TopBackIcon2() {
|
|
3208
|
+
_classCallCheck$1(this, TopBackIcon2);
|
|
3209
|
+
return _super.apply(this, arguments);
|
|
3210
|
+
}
|
|
3211
|
+
_createClass$1(TopBackIcon2, [{
|
|
3212
|
+
key: "afterCreate",
|
|
3213
|
+
value: function afterCreate() {
|
|
3214
|
+
var _this = this;
|
|
3215
|
+
this.initIcons();
|
|
3216
|
+
this.onClick = function(e2) {
|
|
3217
|
+
e2.preventDefault();
|
|
3218
|
+
e2.stopPropagation();
|
|
3219
|
+
_this.config.onClick(e2);
|
|
3220
|
+
};
|
|
3221
|
+
this.bind(["click", "touchend"], this.onClick);
|
|
3210
3222
|
}
|
|
3211
3223
|
}, {
|
|
3212
|
-
key: "
|
|
3213
|
-
value: function
|
|
3214
|
-
var children = this.root.children;
|
|
3215
|
-
if (index2 < 0 || index2 >= children.length) {
|
|
3216
|
-
return null;
|
|
3217
|
-
}
|
|
3224
|
+
key: "registerIcons",
|
|
3225
|
+
value: function registerIcons() {
|
|
3218
3226
|
return {
|
|
3219
|
-
|
|
3220
|
-
|
|
3227
|
+
screenBack: {
|
|
3228
|
+
icon: BackSVG,
|
|
3229
|
+
class: "xg-fullscreen-back"
|
|
3230
|
+
}
|
|
3221
3231
|
};
|
|
3222
3232
|
}
|
|
3223
3233
|
}, {
|
|
3224
|
-
key: "
|
|
3225
|
-
value: function
|
|
3226
|
-
var
|
|
3227
|
-
|
|
3228
|
-
util$3.removeClass(children[i2], this.fragConfig.fragFocusClass);
|
|
3229
|
-
}
|
|
3230
|
-
}
|
|
3231
|
-
}, {
|
|
3232
|
-
key: "setHightLight",
|
|
3233
|
-
value: function setHightLight(index2) {
|
|
3234
|
-
var children = this.root.children;
|
|
3235
|
-
if (index2 < children.length) {
|
|
3236
|
-
util$3.addClass(children[index2], this.fragConfig.fragFocusClass);
|
|
3237
|
-
return {
|
|
3238
|
-
dom: children[index2],
|
|
3239
|
-
pos: children[index2].getBoundingClientRect()
|
|
3240
|
-
};
|
|
3241
|
-
}
|
|
3234
|
+
key: "initIcons",
|
|
3235
|
+
value: function initIcons() {
|
|
3236
|
+
var icons = this.icons;
|
|
3237
|
+
this.appendChild(this.root, icons.screenBack);
|
|
3242
3238
|
}
|
|
3243
3239
|
}, {
|
|
3244
|
-
key: "
|
|
3245
|
-
value: function
|
|
3246
|
-
this.
|
|
3247
|
-
this.fragments = null;
|
|
3248
|
-
this.root.innerHTML = "";
|
|
3240
|
+
key: "show",
|
|
3241
|
+
value: function show() {
|
|
3242
|
+
util$3.addClass(this.root, "show");
|
|
3249
3243
|
}
|
|
3250
3244
|
}, {
|
|
3251
|
-
key: "
|
|
3252
|
-
value: function
|
|
3253
|
-
|
|
3254
|
-
Object.keys(this.fragConfig).forEach(function(key) {
|
|
3255
|
-
if (newOptions[key] !== void 0) {
|
|
3256
|
-
_this2.fragConfig[key] = newOptions[key];
|
|
3257
|
-
}
|
|
3258
|
-
});
|
|
3259
|
-
if (newOptions.fragments) {
|
|
3260
|
-
this.fragments = newOptions.fragments.length === 0 ? [{
|
|
3261
|
-
percent: 1
|
|
3262
|
-
}] : newOptions.fragments;
|
|
3263
|
-
this.updateDuration(this.duration);
|
|
3264
|
-
this.playedIndex = 0;
|
|
3265
|
-
this.cachedIndex = 0;
|
|
3266
|
-
if (this.root) {
|
|
3267
|
-
var _c = this.root.children;
|
|
3268
|
-
while (_c.length > 0) {
|
|
3269
|
-
this.root.removeChild(_c[0]);
|
|
3270
|
-
}
|
|
3271
|
-
}
|
|
3272
|
-
this.render();
|
|
3273
|
-
}
|
|
3245
|
+
key: "hide",
|
|
3246
|
+
value: function hide() {
|
|
3247
|
+
util$3.removeClass(this.root, "show");
|
|
3274
3248
|
}
|
|
3275
3249
|
}, {
|
|
3276
3250
|
key: "render",
|
|
3277
3251
|
value: function render() {
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
style: item2.styleKey ? "background: ".concat(_this3.style[item2.styleKey], "; width:0;") : "width:0;"
|
|
3293
|
-
}, item2.className));
|
|
3294
|
-
});
|
|
3295
|
-
return {
|
|
3296
|
-
cached: inner.children[0],
|
|
3297
|
-
played: inner.children[1]
|
|
3298
|
-
};
|
|
3299
|
-
});
|
|
3300
|
-
}
|
|
3301
|
-
return this.root;
|
|
3252
|
+
return '<xg-icon class="xgplayer-back">\n </xg-icon>';
|
|
3253
|
+
}
|
|
3254
|
+
}], [{
|
|
3255
|
+
key: "pluginName",
|
|
3256
|
+
get: function get() {
|
|
3257
|
+
return "topbackicon";
|
|
3258
|
+
}
|
|
3259
|
+
}, {
|
|
3260
|
+
key: "defaultConfig",
|
|
3261
|
+
get: function get() {
|
|
3262
|
+
return {
|
|
3263
|
+
position: POSITIONS.ROOT_TOP,
|
|
3264
|
+
index: 0
|
|
3265
|
+
};
|
|
3302
3266
|
}
|
|
3303
3267
|
}]);
|
|
3304
|
-
return
|
|
3305
|
-
}();
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3268
|
+
return TopBackIcon2;
|
|
3269
|
+
}(Plugin);
|
|
3270
|
+
function FullScreenSvg() {
|
|
3271
|
+
return new DOMParser().parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598 214h212v212h-84v-128h-128v-84zM726 726v-128h84v212h-212v-84h128zM214 426v-212h212v84h-128v128h-84zM298 598v128h128v84h-212v-212h84z"></path>\n</svg>\n', "image/svg+xml").firstChild;
|
|
3272
|
+
}
|
|
3273
|
+
function ExitFullScreenSvg() {
|
|
3274
|
+
return new DOMParser().parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M682 342h128v84h-212v-212h84v128zM598 810v-212h212v84h-128v128h-84zM342 342v-128h84v212h-212v-84h128zM214 682v-84h212v212h-84v-128h-128z"></path>\n</svg>\n', "image/svg+xml").firstChild;
|
|
3275
|
+
}
|
|
3276
|
+
var Fullscreen = /* @__PURE__ */ function(_IconPlugin) {
|
|
3277
|
+
_inherits(Fullscreen2, _IconPlugin);
|
|
3278
|
+
var _super = _createSuper(Fullscreen2);
|
|
3279
|
+
function Fullscreen2() {
|
|
3314
3280
|
var _this;
|
|
3315
|
-
_classCallCheck$1(this,
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3281
|
+
_classCallCheck$1(this, Fullscreen2);
|
|
3282
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3283
|
+
args[_key] = arguments[_key];
|
|
3284
|
+
}
|
|
3285
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
3286
|
+
_defineProperty$1(_assertThisInitialized(_this), "_onOrientationChange", function(e2) {
|
|
3287
|
+
if (_this.player.fullscreen && _this.config.rotateFullscreen) {
|
|
3288
|
+
if (window.orientation === 90 || window.orientation === -90) {
|
|
3289
|
+
_this.player.setRotateDeg(0);
|
|
3290
|
+
} else {
|
|
3291
|
+
_this.player.setRotateDeg(90);
|
|
3326
3292
|
}
|
|
3327
|
-
pos.moving = true;
|
|
3328
|
-
pos.x = x2;
|
|
3329
|
-
ret = _this.computeTime(e2, x2);
|
|
3330
|
-
}
|
|
3331
|
-
_this.triggerCallbacks("dragmove", ret, e2);
|
|
3332
|
-
_this._updateInnerFocus(ret);
|
|
3333
|
-
});
|
|
3334
|
-
_defineProperty$1(_assertThisInitialized(_this), "onBodyClick", function(e2) {
|
|
3335
|
-
if (!_this.pos.isLocked) {
|
|
3336
|
-
return;
|
|
3337
3293
|
}
|
|
3338
|
-
_this.pos.isLocked = false;
|
|
3339
|
-
e2.preventDefault();
|
|
3340
|
-
e2.stopPropagation();
|
|
3341
3294
|
});
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
_defineProperty$1(_assertThisInitialized(_this), "_mouseMoveHandler", function(e2, data) {
|
|
3352
|
-
var _assertThisInitialize3 = _assertThisInitialized(_this), _state = _assertThisInitialize3._state, pos = _assertThisInitialize3.pos, config = _assertThisInitialize3.config, player = _assertThisInitialize3.player;
|
|
3353
|
-
if (_state.time < data.currentTime) {
|
|
3354
|
-
data.forward = true;
|
|
3355
|
-
} else {
|
|
3356
|
-
data.forward = false;
|
|
3357
|
-
}
|
|
3358
|
-
_state.time = data.currentTime;
|
|
3359
|
-
if (pos.isDown && !pos.moving) {
|
|
3360
|
-
pos.moving = true;
|
|
3361
|
-
config.isPauseMoving && player.pause();
|
|
3362
|
-
_this.triggerCallbacks("dragstart", data, e2);
|
|
3363
|
-
_this.emitUserAction("drag", "dragstart", data);
|
|
3364
|
-
}
|
|
3365
|
-
_this.updateWidth(data.currentTime, data.seekTime, data.percent, 1);
|
|
3366
|
-
_this.triggerCallbacks("dragmove", data, e2);
|
|
3367
|
-
_this._updateInnerFocus(data);
|
|
3368
|
-
});
|
|
3369
|
-
_defineProperty$1(_assertThisInitialized(_this), "onMouseDown", function(e2) {
|
|
3370
|
-
var _assertThisInitialize4 = _assertThisInitialized(_this), _state = _assertThisInitialize4._state, player = _assertThisInitialize4.player, pos = _assertThisInitialize4.pos, config = _assertThisInitialize4.config, playerConfig = _assertThisInitialize4.playerConfig;
|
|
3371
|
-
var _ePos = util$3.getEventPos(e2, player.zoom);
|
|
3372
|
-
var x2 = player.rotateDeg === 90 ? _ePos.clientY : _ePos.clientX;
|
|
3373
|
-
if (player.isMini || config.closeMoveSeek || !playerConfig.allowSeekAfterEnded && player.ended) {
|
|
3374
|
-
return;
|
|
3375
|
-
}
|
|
3376
|
-
if (!player.duration && !player.isPlaying) {
|
|
3377
|
-
player.play();
|
|
3295
|
+
return _this;
|
|
3296
|
+
}
|
|
3297
|
+
_createClass$1(Fullscreen2, [{
|
|
3298
|
+
key: "afterCreate",
|
|
3299
|
+
value: function afterCreate() {
|
|
3300
|
+
var _this2 = this;
|
|
3301
|
+
_get(_getPrototypeOf(Fullscreen2.prototype), "afterCreate", this).call(this);
|
|
3302
|
+
var config = this.config, playerConfig = this.playerConfig;
|
|
3303
|
+
if (config.disable) {
|
|
3378
3304
|
return;
|
|
3379
3305
|
}
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
util$3.checkIsFunction(playerConfig.disableSwipeHandler) && playerConfig.disableSwipeHandler();
|
|
3383
|
-
util$3.checkIsFunction(config.onMoveStart) && config.onMoveStart();
|
|
3384
|
-
util$3.event(e2);
|
|
3385
|
-
pos.x = x2;
|
|
3386
|
-
pos.isDown = true;
|
|
3387
|
-
pos.moving = false;
|
|
3388
|
-
_state.prePlayTime = player.currentTime;
|
|
3389
|
-
player.focus({
|
|
3390
|
-
autoHide: false
|
|
3391
|
-
});
|
|
3392
|
-
_this.isProgressMoving = true;
|
|
3393
|
-
util$3.addClass(_this.progressBtn, "active");
|
|
3394
|
-
var ret = _this.computeTime(e2, x2);
|
|
3395
|
-
ret.prePlayTime = _state.prePlayTime;
|
|
3396
|
-
_this._mouseDownHandlerHook(e2, ret);
|
|
3397
|
-
var eventType = e2.type;
|
|
3398
|
-
if (eventType === "touchstart") {
|
|
3399
|
-
_this.root.addEventListener("touchmove", _this.onMouseMove);
|
|
3400
|
-
_this.root.addEventListener("touchend", _this.onMouseUp);
|
|
3401
|
-
_this.root.addEventListener("touchcancel", _this.onMouseUp);
|
|
3402
|
-
} else {
|
|
3403
|
-
_this.unbind("mousemove", _this.onMoveOnly);
|
|
3404
|
-
document.addEventListener("mousemove", _this.onMouseMove, false);
|
|
3405
|
-
document.addEventListener("mouseup", _this.onMouseUp, false);
|
|
3306
|
+
if (config.target) {
|
|
3307
|
+
this.playerConfig.fullscreenTarget = this.config.target;
|
|
3406
3308
|
}
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
e2.stopPropagation();
|
|
3412
|
-
e2.preventDefault();
|
|
3413
|
-
util$3.checkIsFunction(playerConfig.enableSwipeHandler) && playerConfig.enableSwipeHandler();
|
|
3414
|
-
util$3.checkIsFunction(config.onMoveEnd) && config.onMoveEnd();
|
|
3415
|
-
util$3.event(e2);
|
|
3416
|
-
util$3.removeClass(_this.progressBtn, "active");
|
|
3417
|
-
var ret = _this.computeTime(e2, pos.x);
|
|
3418
|
-
ret.prePlayTime = _state.prePlayTime;
|
|
3419
|
-
if (pos.moving) {
|
|
3420
|
-
_this.triggerCallbacks("dragend", ret, e2);
|
|
3421
|
-
_this.emitUserAction("drag", "dragend", ret);
|
|
3422
|
-
} else {
|
|
3423
|
-
_this.triggerCallbacks("click", ret, e2);
|
|
3424
|
-
_this.emitUserAction("click", "click", ret);
|
|
3309
|
+
var fullEl = util$3.getFullScreenEl();
|
|
3310
|
+
if (playerConfig.fullscreenTarget === fullEl) {
|
|
3311
|
+
this.player.getFullscreen().catch(function(e2) {
|
|
3312
|
+
});
|
|
3425
3313
|
}
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
if (eventType === "touchend" || eventType === "touchcancel") {
|
|
3436
|
-
_this.root.removeEventListener("touchmove", _this.onMouseMove);
|
|
3437
|
-
_this.root.removeEventListener("touchend", _this.onMouseUp);
|
|
3438
|
-
_this.root.removeEventListener("touchcancel", _this.onMouseUp);
|
|
3439
|
-
_this.blur();
|
|
3440
|
-
} else {
|
|
3441
|
-
document.removeEventListener("mousemove", _this.onMouseMove, false);
|
|
3442
|
-
document.removeEventListener("mouseup", _this.onMouseUp, false);
|
|
3443
|
-
if (!pos.isEnter) {
|
|
3444
|
-
_this.onMouseLeave(e2);
|
|
3445
|
-
} else {
|
|
3446
|
-
playerConfig.isMobileSimulateMode !== "mobile" && _this.bind("mousemove", _this.onMoveOnly);
|
|
3314
|
+
this.initIcons();
|
|
3315
|
+
this.handleFullscreen = this.hook("fullscreenChange", this.toggleFullScreen, {
|
|
3316
|
+
pre: function pre(e2) {
|
|
3317
|
+
var fullscreen = _this2.player.fullscreen;
|
|
3318
|
+
_this2.emitUserAction(e2, "switch_fullscreen", {
|
|
3319
|
+
prop: "fullscreen",
|
|
3320
|
+
from: fullscreen,
|
|
3321
|
+
to: !fullscreen
|
|
3322
|
+
});
|
|
3447
3323
|
}
|
|
3324
|
+
});
|
|
3325
|
+
this.bind(".xgplayer-fullscreen", ["touchend", "click"], this.handleFullscreen);
|
|
3326
|
+
this.on(FULLSCREEN_CHANGE, function(isFullScreen) {
|
|
3327
|
+
var tipsDom = _this2.find(".xg-tips");
|
|
3328
|
+
tipsDom && _this2.changeLangTextKey(tipsDom, isFullScreen ? _this2.i18nKeys.EXITFULLSCREEN_TIPS : _this2.i18nKeys.FULLSCREEN_TIPS);
|
|
3329
|
+
_this2.animate(isFullScreen);
|
|
3330
|
+
});
|
|
3331
|
+
if (this.config.needBackIcon) {
|
|
3332
|
+
this.topBackIcon = this.player.registerPlugin({
|
|
3333
|
+
plugin: TopBackIcon,
|
|
3334
|
+
options: {
|
|
3335
|
+
config: {
|
|
3336
|
+
onClick: function onClick(e2) {
|
|
3337
|
+
_this2.handleFullscreen(e2);
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
}
|
|
3341
|
+
});
|
|
3448
3342
|
}
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
}, 1);
|
|
3452
|
-
player.focus();
|
|
3453
|
-
});
|
|
3454
|
-
_defineProperty$1(_assertThisInitialized(_this), "onMouseMove", function(e2) {
|
|
3455
|
-
var _assertThisInitialize6 = _assertThisInitialized(_this), _state = _assertThisInitialize6._state, pos = _assertThisInitialize6.pos, player = _assertThisInitialize6.player, config = _assertThisInitialize6.config;
|
|
3456
|
-
if (util$3.checkTouchSupport()) {
|
|
3457
|
-
e2.preventDefault();
|
|
3458
|
-
}
|
|
3459
|
-
util$3.event(e2);
|
|
3460
|
-
var _ePos = util$3.getEventPos(e2, player.zoom);
|
|
3461
|
-
var x2 = player.rotateDeg === 90 ? _ePos.clientY : _ePos.clientX;
|
|
3462
|
-
var diff = Math.abs(pos.x - x2);
|
|
3463
|
-
if (pos.moving && diff < config.miniMoveStep || !pos.moving && diff < config.miniStartStep) {
|
|
3464
|
-
return;
|
|
3465
|
-
}
|
|
3466
|
-
pos.x = x2;
|
|
3467
|
-
var ret = _this.computeTime(e2, x2);
|
|
3468
|
-
ret.prePlayTime = _state.prePlayTime;
|
|
3469
|
-
_this._mouseMoveHandlerHook(e2, ret);
|
|
3470
|
-
});
|
|
3471
|
-
_defineProperty$1(_assertThisInitialized(_this), "onMouseOut", function(e2) {
|
|
3472
|
-
_this.triggerCallbacks("mouseout", null, e2);
|
|
3473
|
-
});
|
|
3474
|
-
_defineProperty$1(_assertThisInitialized(_this), "onMouseOver", function(e2) {
|
|
3475
|
-
_this.triggerCallbacks("mouseover", null, e2);
|
|
3476
|
-
});
|
|
3477
|
-
_defineProperty$1(_assertThisInitialized(_this), "onMouseEnter", function(e2) {
|
|
3478
|
-
var _assertThisInitialize7 = _assertThisInitialized(_this), player = _assertThisInitialize7.player, pos = _assertThisInitialize7.pos;
|
|
3479
|
-
if (pos.isDown || pos.isEnter || player.isMini || !player.config.allowSeekAfterEnded && player.ended) {
|
|
3480
|
-
return;
|
|
3481
|
-
}
|
|
3482
|
-
pos.isEnter = true;
|
|
3483
|
-
_this.bind("mousemove", _this.onMoveOnly);
|
|
3484
|
-
_this.bind("mouseleave", _this.onMouseLeave);
|
|
3485
|
-
util$3.event(e2);
|
|
3486
|
-
var _ePos = util$3.getEventPos(e2, player.zoom);
|
|
3487
|
-
var x2 = player.rotateDeg === 90 ? _ePos.clientY : _ePos.clientX;
|
|
3488
|
-
var ret = _this.computeTime(e2, x2);
|
|
3489
|
-
_this.triggerCallbacks("mouseenter", ret, e2);
|
|
3490
|
-
_this.focus();
|
|
3491
|
-
});
|
|
3492
|
-
_defineProperty$1(_assertThisInitialized(_this), "onMouseLeave", function(e2) {
|
|
3493
|
-
_this.triggerCallbacks("mouseleave", null, e2);
|
|
3494
|
-
_this.unlock();
|
|
3495
|
-
_this._updateInnerFocus(null);
|
|
3496
|
-
});
|
|
3497
|
-
_defineProperty$1(_assertThisInitialized(_this), "onVideoResize", function() {
|
|
3498
|
-
var _this$pos = _this.pos, x2 = _this$pos.x, isDown = _this$pos.isDown, isEnter = _this$pos.isEnter;
|
|
3499
|
-
if (isEnter && !isDown) {
|
|
3500
|
-
var ret = _this.computeTime(null, x2);
|
|
3501
|
-
_this.onMoveOnly(null, ret);
|
|
3343
|
+
if (sniffer.device === "mobile") {
|
|
3344
|
+
window.addEventListener("orientationchange", this._onOrientationChange);
|
|
3502
3345
|
}
|
|
3503
|
-
});
|
|
3504
|
-
_this.useable = false;
|
|
3505
|
-
_this.isProgressMoving = false;
|
|
3506
|
-
_this.__dragCallBacks = [];
|
|
3507
|
-
_this._state = {
|
|
3508
|
-
now: -1,
|
|
3509
|
-
direc: 0,
|
|
3510
|
-
time: 0,
|
|
3511
|
-
prePlayTime: -1
|
|
3512
|
-
};
|
|
3513
|
-
_this._disableBlur = false;
|
|
3514
|
-
if (typeof _this.config.isDragingSeek === "boolean") {
|
|
3515
|
-
console.warn("[XGPLAYER] 'isDragingSeek' is deprecated, please use 'isDraggingSeek' instead");
|
|
3516
|
-
_this.config.isDraggingSeek = _this.config.isDragingSeek;
|
|
3517
|
-
}
|
|
3518
|
-
return _this;
|
|
3519
|
-
}
|
|
3520
|
-
_createClass$1(Progress2, [{
|
|
3521
|
-
key: "offsetDuration",
|
|
3522
|
-
get: function get() {
|
|
3523
|
-
return this.playerConfig.customDuration || this.player.offsetDuration || this.player.duration;
|
|
3524
3346
|
}
|
|
3525
3347
|
}, {
|
|
3526
|
-
key: "
|
|
3527
|
-
|
|
3528
|
-
return
|
|
3348
|
+
key: "registerIcons",
|
|
3349
|
+
value: function registerIcons() {
|
|
3350
|
+
return {
|
|
3351
|
+
fullscreen: {
|
|
3352
|
+
icon: FullScreenSvg,
|
|
3353
|
+
class: "xg-get-fullscreen"
|
|
3354
|
+
},
|
|
3355
|
+
exitFullscreen: {
|
|
3356
|
+
icon: ExitFullScreenSvg,
|
|
3357
|
+
class: "xg-exit-fullscreen"
|
|
3358
|
+
}
|
|
3359
|
+
};
|
|
3529
3360
|
}
|
|
3530
3361
|
}, {
|
|
3531
|
-
key: "
|
|
3532
|
-
|
|
3533
|
-
|
|
3362
|
+
key: "destroy",
|
|
3363
|
+
value: function destroy() {
|
|
3364
|
+
_get(_getPrototypeOf(Fullscreen2.prototype), "destroy", this).call(this);
|
|
3365
|
+
this.unbind(".xgplayer-icon", sniffer.device === "mobile" ? "touchend" : "click", this.handleFullscreen);
|
|
3366
|
+
if (sniffer.device === "mobile") {
|
|
3367
|
+
window.removeEventListener("orientationchange", this._onOrientationChange);
|
|
3368
|
+
}
|
|
3534
3369
|
}
|
|
3535
3370
|
}, {
|
|
3536
|
-
key: "
|
|
3537
|
-
|
|
3538
|
-
var
|
|
3539
|
-
|
|
3371
|
+
key: "initIcons",
|
|
3372
|
+
value: function initIcons() {
|
|
3373
|
+
var icons = this.icons;
|
|
3374
|
+
this.appendChild(".xgplayer-icon", icons.fullscreen);
|
|
3375
|
+
this.appendChild(".xgplayer-icon", icons.exitFullscreen);
|
|
3540
3376
|
}
|
|
3541
3377
|
}, {
|
|
3542
|
-
key: "
|
|
3543
|
-
value: function
|
|
3544
|
-
|
|
3545
|
-
|
|
3378
|
+
key: "toggleFullScreen",
|
|
3379
|
+
value: function toggleFullScreen(e2) {
|
|
3380
|
+
if (e2 instanceof Event) {
|
|
3381
|
+
e2.preventDefault();
|
|
3382
|
+
e2.stopPropagation();
|
|
3383
|
+
}
|
|
3384
|
+
var player = this.player, config = this.config;
|
|
3385
|
+
var useCssFullscreen = config.useCssFullscreen === true || typeof config.useCssFullscreen === "function" && config.useCssFullscreen();
|
|
3386
|
+
if (useCssFullscreen) {
|
|
3387
|
+
if (player.fullscreen) {
|
|
3388
|
+
player.exitCssFullscreen();
|
|
3389
|
+
} else {
|
|
3390
|
+
player.getCssFullscreen();
|
|
3391
|
+
}
|
|
3392
|
+
this.animate(player.fullscreen);
|
|
3393
|
+
} else if (config.rotateFullscreen) {
|
|
3394
|
+
if (player.fullscreen) {
|
|
3395
|
+
player.exitRotateFullscreen();
|
|
3396
|
+
} else {
|
|
3397
|
+
player.getRotateFullscreen();
|
|
3398
|
+
}
|
|
3399
|
+
this.animate(player.fullscreen);
|
|
3400
|
+
} else if (config.switchCallback && typeof config.switchCallback === "function") {
|
|
3401
|
+
config.switchCallback(player.fullscreen);
|
|
3402
|
+
} else {
|
|
3403
|
+
if (player.fullscreen) {
|
|
3404
|
+
player.exitFullscreen();
|
|
3405
|
+
if (config.useScreenOrientation) {
|
|
3406
|
+
this.unlockScreen();
|
|
3407
|
+
}
|
|
3408
|
+
} else {
|
|
3409
|
+
player.getFullscreen().catch(function(e22) {
|
|
3410
|
+
});
|
|
3411
|
+
if (config.useScreenOrientation && player.aspectRatio > 1) {
|
|
3412
|
+
this.lockScreen(config.lockOrientationType);
|
|
3413
|
+
}
|
|
3414
|
+
}
|
|
3415
|
+
}
|
|
3546
3416
|
}
|
|
3547
3417
|
}, {
|
|
3548
|
-
key: "
|
|
3549
|
-
value: function
|
|
3550
|
-
this.
|
|
3418
|
+
key: "animate",
|
|
3419
|
+
value: function animate(isFullScreen) {
|
|
3420
|
+
isFullScreen ? this.setAttr("data-state", "full") : this.setAttr("data-state", "normal");
|
|
3421
|
+
if (this.topBackIcon) {
|
|
3422
|
+
if (isFullScreen) {
|
|
3423
|
+
this.topBackIcon.show();
|
|
3424
|
+
this.hide();
|
|
3425
|
+
} else {
|
|
3426
|
+
this.topBackIcon.hide();
|
|
3427
|
+
this.show();
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3551
3430
|
}
|
|
3552
3431
|
}, {
|
|
3553
|
-
key: "
|
|
3554
|
-
value: function
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
3558
|
-
if (!fragments || fragments.length === 0) {
|
|
3559
|
-
fragments = [{
|
|
3560
|
-
percent: 1
|
|
3561
|
-
}];
|
|
3432
|
+
key: "render",
|
|
3433
|
+
value: function render() {
|
|
3434
|
+
if (this.config.disable) {
|
|
3435
|
+
return;
|
|
3562
3436
|
}
|
|
3563
|
-
var
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
this.innerList = new InnerList(_c);
|
|
3572
|
-
this.outer.insertBefore(this.innerList.render(), this.outer.children[0]);
|
|
3573
|
-
["findHightLight", "unHightLight", "setHightLight", "findFragment"].map(function(item) {
|
|
3574
|
-
_this2[item] = _this2.innerList[item].bind(_this2.innerList);
|
|
3437
|
+
var langKey = "FULLSCREEN_TIPS";
|
|
3438
|
+
return '<xg-icon class="xgplayer-fullscreen">\n <div class="xgplayer-icon">\n </div>\n '.concat(xgIconTips(this, langKey, this.playerConfig.isHideTips), "\n </xg-icon>");
|
|
3439
|
+
}
|
|
3440
|
+
}, {
|
|
3441
|
+
key: "lockScreen",
|
|
3442
|
+
value: function lockScreen(orientation) {
|
|
3443
|
+
try {
|
|
3444
|
+
screen.orientation.lock(orientation).catch(function(e2) {
|
|
3575
3445
|
});
|
|
3576
|
-
}
|
|
3577
|
-
this.innerList.reset(_c);
|
|
3446
|
+
} catch (e2) {
|
|
3578
3447
|
}
|
|
3579
3448
|
}
|
|
3580
3449
|
}, {
|
|
3581
|
-
key: "
|
|
3582
|
-
value: function
|
|
3583
|
-
|
|
3450
|
+
key: "unlockScreen",
|
|
3451
|
+
value: function unlockScreen() {
|
|
3452
|
+
try {
|
|
3453
|
+
screen.orientation.unlock().catch(function(e2) {
|
|
3454
|
+
});
|
|
3455
|
+
} catch (e2) {
|
|
3456
|
+
}
|
|
3457
|
+
}
|
|
3458
|
+
}], [{
|
|
3459
|
+
key: "pluginName",
|
|
3460
|
+
get: function get() {
|
|
3461
|
+
return "fullscreen";
|
|
3584
3462
|
}
|
|
3585
3463
|
}, {
|
|
3464
|
+
key: "defaultConfig",
|
|
3465
|
+
get: function get() {
|
|
3466
|
+
return {
|
|
3467
|
+
position: POSITIONS.CONTROLS_RIGHT,
|
|
3468
|
+
index: 0,
|
|
3469
|
+
useCssFullscreen: false,
|
|
3470
|
+
rotateFullscreen: false,
|
|
3471
|
+
useScreenOrientation: false,
|
|
3472
|
+
lockOrientationType: "landscape",
|
|
3473
|
+
switchCallback: null,
|
|
3474
|
+
target: null,
|
|
3475
|
+
disable: false,
|
|
3476
|
+
needBackIcon: false
|
|
3477
|
+
};
|
|
3478
|
+
}
|
|
3479
|
+
}]);
|
|
3480
|
+
return Fullscreen2;
|
|
3481
|
+
}(Icon);
|
|
3482
|
+
function PlayIcon() {
|
|
3483
|
+
return new DOMParser().parseFromString('<svg class="play" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M576,363L810,512L576,661zM342,214L576,363L576,661L342,810z"></path>\n</svg>\n', "image/svg+xml").firstChild;
|
|
3484
|
+
}
|
|
3485
|
+
function PauseIcon() {
|
|
3486
|
+
return new DOMParser().parseFromString('<svg class="pause" xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="3 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598,214h170v596h-170v-596zM256 810v-596h170v596h-170z"></path>\n</svg>\n', "image/svg+xml").firstChild;
|
|
3487
|
+
}
|
|
3488
|
+
var Play = /* @__PURE__ */ function(_IconPlugin) {
|
|
3489
|
+
_inherits(Play2, _IconPlugin);
|
|
3490
|
+
var _super = _createSuper(Play2);
|
|
3491
|
+
function Play2() {
|
|
3492
|
+
var _this;
|
|
3493
|
+
_classCallCheck$1(this, Play2);
|
|
3494
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3495
|
+
args[_key] = arguments[_key];
|
|
3496
|
+
}
|
|
3497
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
3498
|
+
_defineProperty$1(_assertThisInitialized(_this), "btnClick", function(e2) {
|
|
3499
|
+
e2.preventDefault();
|
|
3500
|
+
e2.stopPropagation();
|
|
3501
|
+
var _assertThisInitialize = _assertThisInitialized(_this), player = _assertThisInitialize.player;
|
|
3502
|
+
_this.emitUserAction(e2, "switch_play_pause", {
|
|
3503
|
+
prop: "paused",
|
|
3504
|
+
from: player.paused,
|
|
3505
|
+
to: !player.paused
|
|
3506
|
+
});
|
|
3507
|
+
if (player.ended) {
|
|
3508
|
+
player.replay();
|
|
3509
|
+
} else if (player.paused) {
|
|
3510
|
+
player.play();
|
|
3511
|
+
_this.animate(false);
|
|
3512
|
+
} else {
|
|
3513
|
+
player.pause();
|
|
3514
|
+
_this.animate(true);
|
|
3515
|
+
}
|
|
3516
|
+
return false;
|
|
3517
|
+
});
|
|
3518
|
+
return _this;
|
|
3519
|
+
}
|
|
3520
|
+
_createClass$1(Play2, [{
|
|
3586
3521
|
key: "afterCreate",
|
|
3587
3522
|
value: function afterCreate() {
|
|
3588
|
-
|
|
3523
|
+
_get(_getPrototypeOf(Play2.prototype), "afterCreate", this).call(this);
|
|
3524
|
+
var config = this.config;
|
|
3525
|
+
if (config.disable) {
|
|
3589
3526
|
return;
|
|
3590
3527
|
}
|
|
3591
|
-
this.
|
|
3592
|
-
|
|
3593
|
-
y: 0,
|
|
3594
|
-
moving: false,
|
|
3595
|
-
isDown: false,
|
|
3596
|
-
isEnter: false,
|
|
3597
|
-
isLocked: false
|
|
3598
|
-
};
|
|
3599
|
-
this.outer = this.find("xg-outer");
|
|
3600
|
-
var _this$config = this.config, fragFocusClass = _this$config.fragFocusClass, fragAutoFocus = _this$config.fragAutoFocus, fragClass = _this$config.fragClass;
|
|
3601
|
-
this._initInner(this.config.fragments, {
|
|
3602
|
-
fragFocusClass,
|
|
3603
|
-
fragAutoFocus,
|
|
3604
|
-
fragClass,
|
|
3605
|
-
style: this.playerConfig.commonStyle || {}
|
|
3606
|
-
});
|
|
3607
|
-
if (sniffer.device === "mobile") {
|
|
3608
|
-
this.config.isDraggingSeek = false;
|
|
3609
|
-
this.isMobile = true;
|
|
3610
|
-
}
|
|
3611
|
-
this.progressBtn = this.find(".xgplayer-progress-btn");
|
|
3528
|
+
this.initIcons();
|
|
3529
|
+
this.bind(["touchend", "click"], this.btnClick);
|
|
3612
3530
|
this.listenEvents();
|
|
3613
|
-
this.
|
|
3614
|
-
this.initCustomStyle();
|
|
3531
|
+
this.animate(true);
|
|
3615
3532
|
}
|
|
3616
3533
|
}, {
|
|
3617
3534
|
key: "listenEvents",
|
|
3618
3535
|
value: function listenEvents() {
|
|
3619
|
-
var
|
|
3620
|
-
this.
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
this.on(TIME_UPDATE, function() {
|
|
3624
|
-
_this3.onTimeupdate();
|
|
3625
|
-
});
|
|
3626
|
-
this.on(SEEKED, function() {
|
|
3627
|
-
_this3.onTimeupdate();
|
|
3628
|
-
_this3.onCacheUpdate();
|
|
3629
|
-
});
|
|
3630
|
-
this.on(PROGRESS, function() {
|
|
3631
|
-
_this3.onCacheUpdate();
|
|
3632
|
-
});
|
|
3633
|
-
this.on(ENDED, function() {
|
|
3634
|
-
_this3.onCacheUpdate(true);
|
|
3635
|
-
_this3.onTimeupdate(true);
|
|
3636
|
-
_this3._state.now = 0;
|
|
3637
|
-
});
|
|
3638
|
-
this.on(EMPTIED, function() {
|
|
3639
|
-
_this3.onReset();
|
|
3640
|
-
});
|
|
3641
|
-
this.on(VIDEO_RESIZE, function() {
|
|
3642
|
-
_this3.onVideoResize();
|
|
3643
|
-
});
|
|
3644
|
-
}
|
|
3645
|
-
}, {
|
|
3646
|
-
key: "setConfig",
|
|
3647
|
-
value: function setConfig(config) {
|
|
3648
|
-
var _this4 = this;
|
|
3649
|
-
var frags = null;
|
|
3650
|
-
Object.keys(config).forEach(function(key) {
|
|
3651
|
-
_this4.config[key] = config[key];
|
|
3652
|
-
if (key === "fragments") {
|
|
3653
|
-
frags = config[key];
|
|
3654
|
-
}
|
|
3536
|
+
var _this2 = this;
|
|
3537
|
+
var player = this.player;
|
|
3538
|
+
this.on([PLAY, PAUSE, ERROR, EMPTIED], function() {
|
|
3539
|
+
_this2.animate(player.paused);
|
|
3655
3540
|
});
|
|
3656
|
-
if (frags) {
|
|
3657
|
-
this._initInner(frags, config);
|
|
3658
|
-
}
|
|
3659
3541
|
}
|
|
3660
3542
|
}, {
|
|
3661
|
-
key: "
|
|
3662
|
-
value: function
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
progressBtn.style[key] = sliderBtnStyle[key];
|
|
3672
|
-
});
|
|
3543
|
+
key: "registerIcons",
|
|
3544
|
+
value: function registerIcons() {
|
|
3545
|
+
return {
|
|
3546
|
+
play: {
|
|
3547
|
+
icon: PlayIcon,
|
|
3548
|
+
class: "xg-icon-play"
|
|
3549
|
+
},
|
|
3550
|
+
pause: {
|
|
3551
|
+
icon: PauseIcon,
|
|
3552
|
+
class: "xg-icon-pause"
|
|
3673
3553
|
}
|
|
3674
|
-
}
|
|
3554
|
+
};
|
|
3675
3555
|
}
|
|
3676
3556
|
}, {
|
|
3677
|
-
key: "
|
|
3678
|
-
value: function
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
try {
|
|
3683
|
-
item.handler(data, event);
|
|
3684
|
-
} catch (error) {
|
|
3685
|
-
console.error("[XGPLAYER][triggerCallbacks] ".concat(item, " error"), error);
|
|
3686
|
-
}
|
|
3687
|
-
}
|
|
3688
|
-
});
|
|
3689
|
-
}
|
|
3557
|
+
key: "initIcons",
|
|
3558
|
+
value: function initIcons() {
|
|
3559
|
+
var icons = this.icons;
|
|
3560
|
+
this.appendChild(".xgplayer-icon", icons.play);
|
|
3561
|
+
this.appendChild(".xgplayer-icon", icons.pause);
|
|
3690
3562
|
}
|
|
3691
3563
|
}, {
|
|
3692
|
-
key: "
|
|
3693
|
-
value: function
|
|
3694
|
-
if (
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3564
|
+
key: "animate",
|
|
3565
|
+
value: function animate(paused) {
|
|
3566
|
+
if (!this.player) {
|
|
3567
|
+
return;
|
|
3568
|
+
}
|
|
3569
|
+
var i18nKeys = this.i18nKeys;
|
|
3570
|
+
var tipDom = this.find(".xg-tips");
|
|
3571
|
+
if (paused) {
|
|
3572
|
+
this.setAttr("data-state", "pause");
|
|
3573
|
+
tipDom && this.changeLangTextKey(tipDom, i18nKeys.PLAY_TIPS);
|
|
3574
|
+
} else {
|
|
3575
|
+
this.setAttr("data-state", "play");
|
|
3576
|
+
tipDom && this.changeLangTextKey(tipDom, i18nKeys.PAUSE_TIPS);
|
|
3699
3577
|
}
|
|
3700
3578
|
}
|
|
3701
3579
|
}, {
|
|
3702
|
-
key: "
|
|
3703
|
-
value: function
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
__dragCallBacks.map(function(item, index2) {
|
|
3707
|
-
if (item && item.type === type && item.handler === event) {
|
|
3708
|
-
_index = index2;
|
|
3709
|
-
}
|
|
3710
|
-
});
|
|
3711
|
-
if (_index > -1) {
|
|
3712
|
-
__dragCallBacks.splice(_index, 1);
|
|
3713
|
-
}
|
|
3580
|
+
key: "destroy",
|
|
3581
|
+
value: function destroy() {
|
|
3582
|
+
_get(_getPrototypeOf(Play2.prototype), "destroy", this).call(this);
|
|
3583
|
+
this.unbind(["touchend", "click"], this.btnClick);
|
|
3714
3584
|
}
|
|
3715
3585
|
}, {
|
|
3716
|
-
key: "
|
|
3717
|
-
value: function
|
|
3718
|
-
|
|
3719
|
-
pos.isEnter = false;
|
|
3720
|
-
pos.isLocked = false;
|
|
3721
|
-
if (player.isMini) {
|
|
3722
|
-
return;
|
|
3723
|
-
}
|
|
3724
|
-
this.unbind("mousemove", this.onMoveOnly);
|
|
3725
|
-
if (pos.isDown) {
|
|
3726
|
-
this.unbind("mouseleave", this.onMouseLeave);
|
|
3586
|
+
key: "render",
|
|
3587
|
+
value: function render() {
|
|
3588
|
+
if (this.config.disable) {
|
|
3727
3589
|
return;
|
|
3728
3590
|
}
|
|
3729
|
-
this.
|
|
3591
|
+
return '<xg-icon class="xgplayer-play">\n <div class="xgplayer-icon">\n </div>\n '.concat(xgIconTips(this, "PLAY_TIPS", this.playerConfig.isHideTips), "\n </xg-icon>");
|
|
3730
3592
|
}
|
|
3731
|
-
}, {
|
|
3732
|
-
key: "
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
this._mouseDownHandlerHook = this.hook("dragstart", this._mouseDownHandler);
|
|
3736
|
-
this._mouseUpHandlerHook = this.hook("dragend", this._mouseUpHandler);
|
|
3737
|
-
this._mouseMoveHandlerHook = this.hook("drag", this._mouseMoveHandler);
|
|
3738
|
-
if (this.domEventType === "touch" || this.domEventType === "compatible") {
|
|
3739
|
-
this.root.addEventListener("touchstart", this.onMouseDown);
|
|
3740
|
-
}
|
|
3741
|
-
if (this.domEventType === "mouse" || this.domEventType === "compatible") {
|
|
3742
|
-
this.bind("mousedown", this.onMouseDown);
|
|
3743
|
-
config.isMobileSimulateMode !== "mobile" && this.bind("mouseenter", this.onMouseEnter);
|
|
3744
|
-
this.bind("mouseover", this.onMouseOver);
|
|
3745
|
-
this.bind("mouseout", this.onMouseOut);
|
|
3746
|
-
this.player.root.addEventListener("click", this.onBodyClick, true);
|
|
3747
|
-
}
|
|
3593
|
+
}], [{
|
|
3594
|
+
key: "pluginName",
|
|
3595
|
+
get: function get() {
|
|
3596
|
+
return "play";
|
|
3748
3597
|
}
|
|
3749
3598
|
}, {
|
|
3750
|
-
key: "
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3599
|
+
key: "defaultConfig",
|
|
3600
|
+
get: function get() {
|
|
3601
|
+
return {
|
|
3602
|
+
position: POSITIONS.CONTROLS_LEFT,
|
|
3603
|
+
index: 0,
|
|
3604
|
+
disable: false
|
|
3605
|
+
};
|
|
3754
3606
|
}
|
|
3755
|
-
}
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3607
|
+
}]);
|
|
3608
|
+
return Play2;
|
|
3609
|
+
}(Icon);
|
|
3610
|
+
var TPL = [{
|
|
3611
|
+
tag: "xg-cache",
|
|
3612
|
+
className: "xgplayer-progress-cache",
|
|
3613
|
+
styleKey: "cachedColor"
|
|
3614
|
+
}, {
|
|
3615
|
+
tag: "xg-played",
|
|
3616
|
+
className: "xgplayer-progress-played",
|
|
3617
|
+
styleKey: "playedColor"
|
|
3618
|
+
}];
|
|
3619
|
+
var InnerList = /* @__PURE__ */ function() {
|
|
3620
|
+
function InnerList2(args) {
|
|
3621
|
+
_classCallCheck$1(this, InnerList2);
|
|
3622
|
+
this.fragments = args.fragments || [];
|
|
3623
|
+
if (this.fragments.length === 0) {
|
|
3624
|
+
this.fragments.push({
|
|
3625
|
+
percent: 1
|
|
3626
|
+
});
|
|
3763
3627
|
}
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3628
|
+
this._callBack = args.actionCallback;
|
|
3629
|
+
this.fragConfig = {
|
|
3630
|
+
fragFocusClass: args.fragFocusClass || "inner-focus-point",
|
|
3631
|
+
fragAutoFocus: !!args.fragAutoFocus,
|
|
3632
|
+
fragClass: args.fragClass || ""
|
|
3633
|
+
};
|
|
3634
|
+
this.style = args.style || {
|
|
3635
|
+
playedColor: "",
|
|
3636
|
+
cachedColor: "",
|
|
3637
|
+
progressColor: ""
|
|
3638
|
+
};
|
|
3639
|
+
this.duration = 0;
|
|
3640
|
+
this.cachedIndex = 0;
|
|
3641
|
+
this.playedIndex = 0;
|
|
3642
|
+
this.focusIndex = -1;
|
|
3643
|
+
}
|
|
3644
|
+
_createClass$1(InnerList2, [{
|
|
3645
|
+
key: "updateDuration",
|
|
3646
|
+
value: function updateDuration(duration) {
|
|
3647
|
+
var _this = this;
|
|
3648
|
+
this.duration = duration;
|
|
3649
|
+
var start = 0;
|
|
3650
|
+
var fragments = this.fragments;
|
|
3651
|
+
this.fragments = fragments.map(function(item) {
|
|
3652
|
+
item.start = parseInt(start, 10);
|
|
3653
|
+
item.end = parseInt(start + item.percent * _this.duration, 10);
|
|
3654
|
+
item.duration = parseInt(item.percent * _this.duration, 10);
|
|
3655
|
+
start += item.percent * _this.duration;
|
|
3656
|
+
return item;
|
|
3657
|
+
});
|
|
3768
3658
|
}
|
|
3769
3659
|
}, {
|
|
3770
|
-
key: "
|
|
3771
|
-
value: function
|
|
3772
|
-
|
|
3660
|
+
key: "updateProgress",
|
|
3661
|
+
value: function updateProgress() {
|
|
3662
|
+
var type = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "played";
|
|
3663
|
+
var data = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
3664
|
+
newIndex: 0,
|
|
3665
|
+
curIndex: 0,
|
|
3666
|
+
millisecond: 0
|
|
3667
|
+
};
|
|
3668
|
+
var progressList = this.progressList, fragments = this.fragments;
|
|
3669
|
+
if (progressList.length < 1) {
|
|
3670
|
+
return;
|
|
3671
|
+
}
|
|
3672
|
+
var newIndex = data.newIndex, curIndex = data.curIndex, millisecond = data.millisecond;
|
|
3673
|
+
if (newIndex !== curIndex) {
|
|
3674
|
+
progressList.map(function(item, index2) {
|
|
3675
|
+
if (index2 < newIndex) {
|
|
3676
|
+
item[type].style.width = "100%";
|
|
3677
|
+
} else if (index2 > newIndex) {
|
|
3678
|
+
item[type].style.width = 0;
|
|
3679
|
+
}
|
|
3680
|
+
});
|
|
3681
|
+
}
|
|
3682
|
+
var curPFrag = fragments[newIndex];
|
|
3683
|
+
var per = millisecond === 0 ? 0 : (millisecond - curPFrag.start) / curPFrag.duration;
|
|
3684
|
+
progressList[newIndex][type].style.width = per < 0 ? 0 : "".concat(per * 100, "%");
|
|
3773
3685
|
}
|
|
3774
3686
|
}, {
|
|
3775
|
-
key: "
|
|
3776
|
-
value: function
|
|
3777
|
-
|
|
3778
|
-
if (config.isCloseClickSeek && type === 0) {
|
|
3687
|
+
key: "updateFocus",
|
|
3688
|
+
value: function updateFocus(data) {
|
|
3689
|
+
if (!this.fragConfig.fragAutoFocus || this.fragments.length < 2) {
|
|
3779
3690
|
return;
|
|
3780
3691
|
}
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3692
|
+
if (!data) {
|
|
3693
|
+
if (this.focusIndex > -1) {
|
|
3694
|
+
this.unHightLight(this.focusIndex);
|
|
3695
|
+
var _data = {
|
|
3696
|
+
index: -1,
|
|
3697
|
+
preIndex: this.focusIndex,
|
|
3698
|
+
fragment: null
|
|
3699
|
+
};
|
|
3700
|
+
this._callBack && this._callBack(_data);
|
|
3701
|
+
this.focusIndex = -1;
|
|
3702
|
+
}
|
|
3785
3703
|
return;
|
|
3786
3704
|
}
|
|
3787
|
-
this.
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
if (player.rotateDeg === 90) {
|
|
3799
|
-
rWidth = height;
|
|
3800
|
-
rLeft = top;
|
|
3801
|
-
} else {
|
|
3802
|
-
rWidth = width;
|
|
3803
|
-
rLeft = left;
|
|
3705
|
+
var newPIndex = this.findIndex(data.currentTime * 1e3, this.focusIndex);
|
|
3706
|
+
if (newPIndex >= 0 && newPIndex !== this.focusIndex) {
|
|
3707
|
+
this.focusIndex > -1 && this.unHightLight(this.focusIndex);
|
|
3708
|
+
this.setHightLight(newPIndex);
|
|
3709
|
+
var _data2 = {
|
|
3710
|
+
index: newPIndex,
|
|
3711
|
+
preIndex: this.focusIndex,
|
|
3712
|
+
fragment: this.fragments[this.focusIndex]
|
|
3713
|
+
};
|
|
3714
|
+
this.focusIndex = newPIndex;
|
|
3715
|
+
this._callBack && this._callBack(_data2);
|
|
3804
3716
|
}
|
|
3805
|
-
var offset = clientX - rLeft;
|
|
3806
|
-
offset = offset > rWidth ? rWidth : offset < 0 ? 0 : offset;
|
|
3807
|
-
var percent = offset / rWidth;
|
|
3808
|
-
percent = percent < 0 ? 0 : percent > 1 ? 1 : percent;
|
|
3809
|
-
var currentTime = parseInt(percent * this.offsetDuration * 1e3, 10) / 1e3;
|
|
3810
|
-
var seekTime = util$3.getCurrentTimeByOffset(currentTime, player.timeSegments);
|
|
3811
|
-
return {
|
|
3812
|
-
percent,
|
|
3813
|
-
currentTime,
|
|
3814
|
-
seekTime,
|
|
3815
|
-
offset,
|
|
3816
|
-
width: rWidth,
|
|
3817
|
-
left: rLeft,
|
|
3818
|
-
e: e2
|
|
3819
|
-
};
|
|
3820
3717
|
}
|
|
3821
3718
|
}, {
|
|
3822
|
-
key: "
|
|
3823
|
-
value: function
|
|
3824
|
-
var
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
}
|
|
3828
|
-
|
|
3719
|
+
key: "update",
|
|
3720
|
+
value: function update() {
|
|
3721
|
+
var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
3722
|
+
cached: 0,
|
|
3723
|
+
played: 0
|
|
3724
|
+
};
|
|
3725
|
+
var duration = arguments.length > 1 ? arguments[1] : void 0;
|
|
3726
|
+
if (!this.duration || parseInt(duration * 1e3, 10) !== this.duration) {
|
|
3727
|
+
if (!duration && duration !== 0) {
|
|
3728
|
+
return;
|
|
3729
|
+
}
|
|
3730
|
+
this.updateDuration(parseInt(duration * 1e3, 10));
|
|
3829
3731
|
}
|
|
3830
|
-
var
|
|
3831
|
-
if (
|
|
3832
|
-
|
|
3732
|
+
var playedIndex = this.playedIndex, cachedIndex = this.cachedIndex;
|
|
3733
|
+
if (util$3.typeOf(data.played) !== "Undefined") {
|
|
3734
|
+
var newPIndex = this.findIndex(data.played * 1e3, playedIndex);
|
|
3735
|
+
if (newPIndex < 0) {
|
|
3736
|
+
return;
|
|
3737
|
+
}
|
|
3738
|
+
this.updateProgress("played", {
|
|
3739
|
+
newIndex: newPIndex,
|
|
3740
|
+
curIndex: playedIndex,
|
|
3741
|
+
millisecond: parseInt(data.played * 1e3, 10)
|
|
3742
|
+
});
|
|
3743
|
+
this.playedIndex = newPIndex;
|
|
3744
|
+
}
|
|
3745
|
+
if (util$3.typeOf(data.cached) !== "Undefined") {
|
|
3746
|
+
var newCIndex = this.findIndex(data.cached * 1e3, cachedIndex);
|
|
3747
|
+
if (newCIndex < 0) {
|
|
3748
|
+
return;
|
|
3749
|
+
}
|
|
3750
|
+
this.updateProgress("cached", {
|
|
3751
|
+
newIndex: newCIndex,
|
|
3752
|
+
curIndex: cachedIndex,
|
|
3753
|
+
millisecond: parseInt(data.cached * 1e3, 10)
|
|
3754
|
+
});
|
|
3755
|
+
this.cachedIndex = newCIndex;
|
|
3833
3756
|
}
|
|
3834
3757
|
}
|
|
3835
3758
|
}, {
|
|
3836
|
-
key: "
|
|
3837
|
-
value: function
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3759
|
+
key: "findIndex",
|
|
3760
|
+
value: function findIndex(time, curIndex) {
|
|
3761
|
+
var fragments = this.fragments;
|
|
3762
|
+
if (!fragments || fragments.length === 0) {
|
|
3763
|
+
return -1;
|
|
3764
|
+
}
|
|
3765
|
+
if (fragments.length === 1) {
|
|
3766
|
+
return 0;
|
|
3767
|
+
}
|
|
3768
|
+
if (curIndex > -1 && curIndex < fragments.length && time > fragments[curIndex].start && time < fragments[curIndex].end) {
|
|
3769
|
+
return curIndex;
|
|
3770
|
+
}
|
|
3771
|
+
if (time > fragments[fragments.length - 1].start) {
|
|
3772
|
+
return fragments.length - 1;
|
|
3773
|
+
}
|
|
3774
|
+
for (var i2 = 0; i2 < fragments.length; i2++) {
|
|
3775
|
+
if (time > fragments[i2].start && time <= fragments[i2].end) {
|
|
3776
|
+
curIndex = i2;
|
|
3777
|
+
break;
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3780
|
+
return curIndex;
|
|
3841
3781
|
}
|
|
3842
3782
|
}, {
|
|
3843
|
-
key: "
|
|
3844
|
-
value: function
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3783
|
+
key: "findHightLight",
|
|
3784
|
+
value: function findHightLight() {
|
|
3785
|
+
var children = this.root.children;
|
|
3786
|
+
for (var i2 = 0; i2 < children.length; i2++) {
|
|
3787
|
+
if (util$3.hasClass(children[i2], this.fragConfig.fragFocusClass)) {
|
|
3788
|
+
return {
|
|
3789
|
+
dom: children[i2],
|
|
3790
|
+
pos: children[i2].getBoundingClientRect()
|
|
3791
|
+
};
|
|
3792
|
+
}
|
|
3848
3793
|
}
|
|
3849
|
-
percent = percent > 1 ? 1 : percent < 0 ? 0 : percent;
|
|
3850
|
-
this.progressBtn.style.left = "".concat(percent * 100, "%");
|
|
3851
|
-
this.innerList.update({
|
|
3852
|
-
played: percent * this.offsetDuration
|
|
3853
|
-
}, this.offsetDuration);
|
|
3854
|
-
var miniprogress = this.player.plugins.miniprogress;
|
|
3855
|
-
miniprogress && miniprogress.update({
|
|
3856
|
-
played: percent * this.offsetDuration
|
|
3857
|
-
}, this.offsetDuration);
|
|
3858
3794
|
}
|
|
3859
3795
|
}, {
|
|
3860
|
-
key: "
|
|
3861
|
-
value: function
|
|
3862
|
-
var
|
|
3863
|
-
if (
|
|
3864
|
-
return;
|
|
3865
|
-
}
|
|
3866
|
-
if (_state.now > -1) {
|
|
3867
|
-
var abs = parseInt(_state.now * 1e3, 10) - parseInt(player.currentTime * 1e3, 10);
|
|
3868
|
-
if (_state.direc === 0 && abs > 300 || _state.direc === 1 && abs > -300) {
|
|
3869
|
-
_state.now = -1;
|
|
3870
|
-
return;
|
|
3871
|
-
} else {
|
|
3872
|
-
_state.now = -1;
|
|
3873
|
-
}
|
|
3796
|
+
key: "findFragment",
|
|
3797
|
+
value: function findFragment(index2) {
|
|
3798
|
+
var children = this.root.children;
|
|
3799
|
+
if (index2 < 0 || index2 >= children.length) {
|
|
3800
|
+
return null;
|
|
3874
3801
|
}
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
}, offsetDuration);
|
|
3880
|
-
this.progressBtn.style.left = "".concat(time / offsetDuration * 100, "%");
|
|
3802
|
+
return {
|
|
3803
|
+
dom: children[index2],
|
|
3804
|
+
pos: children[index2].getBoundingClientRect()
|
|
3805
|
+
};
|
|
3881
3806
|
}
|
|
3882
3807
|
}, {
|
|
3883
|
-
key: "
|
|
3884
|
-
value: function
|
|
3885
|
-
var
|
|
3886
|
-
|
|
3887
|
-
|
|
3808
|
+
key: "unHightLight",
|
|
3809
|
+
value: function unHightLight() {
|
|
3810
|
+
var children = this.root.children;
|
|
3811
|
+
for (var i2 = 0; i2 < children.length; i2++) {
|
|
3812
|
+
util$3.removeClass(children[i2], this.fragConfig.fragFocusClass);
|
|
3888
3813
|
}
|
|
3889
|
-
var _end = player.bufferedPoint.end;
|
|
3890
|
-
_end = util$3.adjustTimeByDuration(_end, duration, isEnded);
|
|
3891
|
-
this.innerList.update({
|
|
3892
|
-
cached: _end
|
|
3893
|
-
}, duration);
|
|
3894
3814
|
}
|
|
3895
3815
|
}, {
|
|
3896
|
-
key: "
|
|
3897
|
-
value: function
|
|
3898
|
-
this.
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3816
|
+
key: "setHightLight",
|
|
3817
|
+
value: function setHightLight(index2) {
|
|
3818
|
+
var children = this.root.children;
|
|
3819
|
+
if (index2 < children.length) {
|
|
3820
|
+
util$3.addClass(children[index2], this.fragConfig.fragFocusClass);
|
|
3821
|
+
return {
|
|
3822
|
+
dom: children[index2],
|
|
3823
|
+
pos: children[index2].getBoundingClientRect()
|
|
3824
|
+
};
|
|
3825
|
+
}
|
|
3903
3826
|
}
|
|
3904
3827
|
}, {
|
|
3905
3828
|
key: "destroy",
|
|
3906
3829
|
value: function destroy() {
|
|
3907
|
-
|
|
3908
|
-
this.
|
|
3909
|
-
this.
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3830
|
+
this.progressList = null;
|
|
3831
|
+
this.fragments = null;
|
|
3832
|
+
this.root.innerHTML = "";
|
|
3833
|
+
}
|
|
3834
|
+
}, {
|
|
3835
|
+
key: "reset",
|
|
3836
|
+
value: function reset(newOptions) {
|
|
3837
|
+
var _this2 = this;
|
|
3838
|
+
Object.keys(this.fragConfig).forEach(function(key) {
|
|
3839
|
+
if (newOptions[key] !== void 0) {
|
|
3840
|
+
_this2.fragConfig[key] = newOptions[key];
|
|
3841
|
+
}
|
|
3842
|
+
});
|
|
3843
|
+
if (newOptions.fragments) {
|
|
3844
|
+
this.fragments = newOptions.fragments.length === 0 ? [{
|
|
3845
|
+
percent: 1
|
|
3846
|
+
}] : newOptions.fragments;
|
|
3847
|
+
this.updateDuration(this.duration);
|
|
3848
|
+
this.playedIndex = 0;
|
|
3849
|
+
this.cachedIndex = 0;
|
|
3850
|
+
if (this.root) {
|
|
3851
|
+
var _c = this.root.children;
|
|
3852
|
+
while (_c.length > 0) {
|
|
3853
|
+
this.root.removeChild(_c[0]);
|
|
3854
|
+
}
|
|
3855
|
+
}
|
|
3856
|
+
this.render();
|
|
3917
3857
|
}
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3858
|
+
}
|
|
3859
|
+
}, {
|
|
3860
|
+
key: "render",
|
|
3861
|
+
value: function render() {
|
|
3862
|
+
var _this3 = this;
|
|
3863
|
+
var progressColor = this.style.progressColor;
|
|
3864
|
+
if (!this.root) {
|
|
3865
|
+
this.root = util$3.createDom("xg-inners", "", {}, "progress-list");
|
|
3866
|
+
}
|
|
3867
|
+
if (this.fragments) {
|
|
3868
|
+
var _this$fragConfig = this.fragConfig, fragClass = _this$fragConfig.fragClass, fragFocusClass = _this$fragConfig.fragFocusClass;
|
|
3869
|
+
this.progressList = this.fragments.map(function(item) {
|
|
3870
|
+
var inner = util$3.createDom("xg-inner", "", {
|
|
3871
|
+
style: progressColor ? "background:".concat(progressColor, "; flex: ").concat(item.percent) : "flex: ".concat(item.percent)
|
|
3872
|
+
}, "".concat(item.isFocus ? fragFocusClass : "", " xgplayer-progress-inner ").concat(fragClass));
|
|
3873
|
+
_this3.root.appendChild(inner);
|
|
3874
|
+
TPL.forEach(function(item2) {
|
|
3875
|
+
inner.appendChild(util$3.createDom(item2.tag, "", {
|
|
3876
|
+
style: item2.styleKey ? "background: ".concat(_this3.style[item2.styleKey], "; width:0;") : "width:0;"
|
|
3877
|
+
}, item2.className));
|
|
3878
|
+
});
|
|
3879
|
+
return {
|
|
3880
|
+
cached: inner.children[0],
|
|
3881
|
+
played: inner.children[1]
|
|
3882
|
+
};
|
|
3883
|
+
});
|
|
3884
|
+
}
|
|
3885
|
+
return this.root;
|
|
3886
|
+
}
|
|
3887
|
+
}]);
|
|
3888
|
+
return InnerList2;
|
|
3889
|
+
}();
|
|
3890
|
+
var FRAGMENT_FOCUS_CLASS = {
|
|
3891
|
+
POINT: "inner-focus-point",
|
|
3892
|
+
HIGHLIGHT: "inner-focus-highlight"
|
|
3893
|
+
};
|
|
3894
|
+
var Progress = /* @__PURE__ */ function(_Plugin) {
|
|
3895
|
+
_inherits(Progress2, _Plugin);
|
|
3896
|
+
var _super = _createSuper(Progress2);
|
|
3897
|
+
function Progress2(args) {
|
|
3898
|
+
var _this;
|
|
3899
|
+
_classCallCheck$1(this, Progress2);
|
|
3900
|
+
_this = _super.call(this, args);
|
|
3901
|
+
_defineProperty$1(_assertThisInitialized(_this), "onMoveOnly", function(e2, data) {
|
|
3902
|
+
var _assertThisInitialize = _assertThisInitialized(_this), pos = _assertThisInitialize.pos, config = _assertThisInitialize.config, player = _assertThisInitialize.player;
|
|
3903
|
+
var ret = data;
|
|
3904
|
+
if (e2) {
|
|
3905
|
+
util$3.event(e2);
|
|
3906
|
+
var _ePos = util$3.getEventPos(e2, player.zoom);
|
|
3907
|
+
var x2 = player.rotateDeg === 90 ? _ePos.clientY : _ePos.clientX;
|
|
3908
|
+
if (pos.moving && Math.abs(pos.x - x2) < config.miniMoveStep) {
|
|
3909
|
+
return;
|
|
3910
|
+
}
|
|
3911
|
+
pos.moving = true;
|
|
3912
|
+
pos.x = x2;
|
|
3913
|
+
ret = _this.computeTime(e2, x2);
|
|
3914
|
+
}
|
|
3915
|
+
_this.triggerCallbacks("dragmove", ret, e2);
|
|
3916
|
+
_this._updateInnerFocus(ret);
|
|
3917
|
+
});
|
|
3918
|
+
_defineProperty$1(_assertThisInitialized(_this), "onBodyClick", function(e2) {
|
|
3919
|
+
if (!_this.pos.isLocked) {
|
|
3920
|
+
return;
|
|
3921
|
+
}
|
|
3922
|
+
_this.pos.isLocked = false;
|
|
3923
|
+
e2.preventDefault();
|
|
3924
|
+
e2.stopPropagation();
|
|
3925
|
+
});
|
|
3926
|
+
_defineProperty$1(_assertThisInitialized(_this), "_mouseDownHandler", function(event, data) {
|
|
3927
|
+
_this._state.time = data.currentTime;
|
|
3928
|
+
_this.updateWidth(data.currentTime, data.seekTime, data.percent, 0);
|
|
3929
|
+
_this._updateInnerFocus(data);
|
|
3930
|
+
});
|
|
3931
|
+
_defineProperty$1(_assertThisInitialized(_this), "_mouseUpHandler", function(e2, data) {
|
|
3932
|
+
var _assertThisInitialize2 = _assertThisInitialized(_this), pos = _assertThisInitialize2.pos;
|
|
3933
|
+
pos.moving && _this.updateWidth(data.currentTime, data.seekTime, data.percent, 2);
|
|
3934
|
+
});
|
|
3935
|
+
_defineProperty$1(_assertThisInitialized(_this), "_mouseMoveHandler", function(e2, data) {
|
|
3936
|
+
var _assertThisInitialize3 = _assertThisInitialized(_this), _state = _assertThisInitialize3._state, pos = _assertThisInitialize3.pos, config = _assertThisInitialize3.config, player = _assertThisInitialize3.player;
|
|
3937
|
+
if (_state.time < data.currentTime) {
|
|
3938
|
+
data.forward = true;
|
|
3939
|
+
} else {
|
|
3940
|
+
data.forward = false;
|
|
3941
|
+
}
|
|
3942
|
+
_state.time = data.currentTime;
|
|
3943
|
+
if (pos.isDown && !pos.moving) {
|
|
3944
|
+
pos.moving = true;
|
|
3945
|
+
config.isPauseMoving && player.pause();
|
|
3946
|
+
_this.triggerCallbacks("dragstart", data, e2);
|
|
3947
|
+
_this.emitUserAction("drag", "dragstart", data);
|
|
3948
|
+
}
|
|
3949
|
+
_this.updateWidth(data.currentTime, data.seekTime, data.percent, 1);
|
|
3950
|
+
_this.triggerCallbacks("dragmove", data, e2);
|
|
3951
|
+
_this._updateInnerFocus(data);
|
|
3952
|
+
});
|
|
3953
|
+
_defineProperty$1(_assertThisInitialized(_this), "onMouseDown", function(e2) {
|
|
3954
|
+
var _assertThisInitialize4 = _assertThisInitialized(_this), _state = _assertThisInitialize4._state, player = _assertThisInitialize4.player, pos = _assertThisInitialize4.pos, config = _assertThisInitialize4.config, playerConfig = _assertThisInitialize4.playerConfig;
|
|
3955
|
+
var _ePos = util$3.getEventPos(e2, player.zoom);
|
|
3956
|
+
var x2 = player.rotateDeg === 90 ? _ePos.clientY : _ePos.clientX;
|
|
3957
|
+
if (player.isMini || config.closeMoveSeek || !playerConfig.allowSeekAfterEnded && player.ended) {
|
|
3958
|
+
return;
|
|
3959
|
+
}
|
|
3960
|
+
if (!player.duration && !player.isPlaying) {
|
|
3961
|
+
player.play();
|
|
3962
|
+
return;
|
|
3963
|
+
}
|
|
3964
|
+
e2.stopPropagation();
|
|
3965
|
+
_this.focus();
|
|
3966
|
+
util$3.checkIsFunction(playerConfig.disableSwipeHandler) && playerConfig.disableSwipeHandler();
|
|
3967
|
+
util$3.checkIsFunction(config.onMoveStart) && config.onMoveStart();
|
|
3968
|
+
util$3.event(e2);
|
|
3969
|
+
pos.x = x2;
|
|
3970
|
+
pos.isDown = true;
|
|
3971
|
+
pos.moving = false;
|
|
3972
|
+
_state.prePlayTime = player.currentTime;
|
|
3973
|
+
player.focus({
|
|
3974
|
+
autoHide: false
|
|
3975
|
+
});
|
|
3976
|
+
_this.isProgressMoving = true;
|
|
3977
|
+
util$3.addClass(_this.progressBtn, "active");
|
|
3978
|
+
var ret = _this.computeTime(e2, x2);
|
|
3979
|
+
ret.prePlayTime = _state.prePlayTime;
|
|
3980
|
+
_this._mouseDownHandlerHook(e2, ret);
|
|
3981
|
+
var eventType = e2.type;
|
|
3982
|
+
if (eventType === "touchstart") {
|
|
3983
|
+
_this.root.addEventListener("touchmove", _this.onMouseMove);
|
|
3984
|
+
_this.root.addEventListener("touchend", _this.onMouseUp);
|
|
3985
|
+
_this.root.addEventListener("touchcancel", _this.onMouseUp);
|
|
3986
|
+
} else {
|
|
3987
|
+
_this.unbind("mousemove", _this.onMoveOnly);
|
|
3988
|
+
document.addEventListener("mousemove", _this.onMouseMove, false);
|
|
3989
|
+
document.addEventListener("mouseup", _this.onMouseUp, false);
|
|
3990
|
+
}
|
|
3991
|
+
return true;
|
|
3992
|
+
});
|
|
3993
|
+
_defineProperty$1(_assertThisInitialized(_this), "onMouseUp", function(e2) {
|
|
3994
|
+
var _assertThisInitialize5 = _assertThisInitialized(_this), player = _assertThisInitialize5.player, config = _assertThisInitialize5.config, pos = _assertThisInitialize5.pos, playerConfig = _assertThisInitialize5.playerConfig, _state = _assertThisInitialize5._state;
|
|
3995
|
+
if (!pos) {
|
|
3996
|
+
return;
|
|
3997
|
+
}
|
|
3998
|
+
e2.stopPropagation();
|
|
3999
|
+
e2.preventDefault();
|
|
4000
|
+
util$3.checkIsFunction(playerConfig.enableSwipeHandler) && playerConfig.enableSwipeHandler();
|
|
4001
|
+
util$3.checkIsFunction(config.onMoveEnd) && config.onMoveEnd();
|
|
4002
|
+
util$3.event(e2);
|
|
4003
|
+
util$3.removeClass(_this.progressBtn, "active");
|
|
4004
|
+
var ret = _this.computeTime(e2, pos.x);
|
|
4005
|
+
ret.prePlayTime = _state.prePlayTime;
|
|
4006
|
+
if (pos.moving) {
|
|
4007
|
+
_this.triggerCallbacks("dragend", ret, e2);
|
|
4008
|
+
_this.emitUserAction("drag", "dragend", ret);
|
|
4009
|
+
} else {
|
|
4010
|
+
_this.triggerCallbacks("click", ret, e2);
|
|
4011
|
+
_this.emitUserAction("click", "click", ret);
|
|
4012
|
+
}
|
|
4013
|
+
_this._mouseUpHandlerHook(e2, ret);
|
|
4014
|
+
pos.moving = false;
|
|
4015
|
+
pos.isDown = false;
|
|
4016
|
+
pos.x = 0;
|
|
4017
|
+
pos.y = 0;
|
|
4018
|
+
pos.isLocked = true;
|
|
4019
|
+
_state.prePlayTime = 0;
|
|
4020
|
+
_state.time = 0;
|
|
4021
|
+
var eventType = e2.type;
|
|
4022
|
+
if (eventType === "touchend" || eventType === "touchcancel") {
|
|
4023
|
+
_this.root.removeEventListener("touchmove", _this.onMouseMove);
|
|
4024
|
+
_this.root.removeEventListener("touchend", _this.onMouseUp);
|
|
4025
|
+
_this.root.removeEventListener("touchcancel", _this.onMouseUp);
|
|
4026
|
+
_this.blur();
|
|
4027
|
+
} else {
|
|
4028
|
+
document.removeEventListener("mousemove", _this.onMouseMove, false);
|
|
4029
|
+
document.removeEventListener("mouseup", _this.onMouseUp, false);
|
|
4030
|
+
if (!pos.isEnter) {
|
|
4031
|
+
_this.onMouseLeave(e2);
|
|
4032
|
+
} else {
|
|
4033
|
+
playerConfig.isMobileSimulateMode !== "mobile" && _this.bind("mousemove", _this.onMoveOnly);
|
|
4034
|
+
}
|
|
4035
|
+
}
|
|
4036
|
+
util$3.setTimeout(_assertThisInitialized(_this), function() {
|
|
4037
|
+
_this.resetSeekState();
|
|
4038
|
+
}, 1);
|
|
4039
|
+
player.focus();
|
|
4040
|
+
});
|
|
4041
|
+
_defineProperty$1(_assertThisInitialized(_this), "onMouseMove", function(e2) {
|
|
4042
|
+
var _assertThisInitialize6 = _assertThisInitialized(_this), _state = _assertThisInitialize6._state, pos = _assertThisInitialize6.pos, player = _assertThisInitialize6.player, config = _assertThisInitialize6.config;
|
|
4043
|
+
if (util$3.checkTouchSupport()) {
|
|
4044
|
+
e2.preventDefault();
|
|
3926
4045
|
}
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
if (
|
|
4046
|
+
util$3.event(e2);
|
|
4047
|
+
var _ePos = util$3.getEventPos(e2, player.zoom);
|
|
4048
|
+
var x2 = player.rotateDeg === 90 ? _ePos.clientY : _ePos.clientX;
|
|
4049
|
+
var diff = Math.abs(pos.x - x2);
|
|
4050
|
+
if (pos.moving && diff < config.miniMoveStep || !pos.moving && diff < config.miniStartStep) {
|
|
3932
4051
|
return;
|
|
3933
4052
|
}
|
|
3934
|
-
|
|
3935
|
-
var
|
|
3936
|
-
|
|
4053
|
+
pos.x = x2;
|
|
4054
|
+
var ret = _this.computeTime(e2, x2);
|
|
4055
|
+
ret.prePlayTime = _state.prePlayTime;
|
|
4056
|
+
_this._mouseMoveHandlerHook(e2, ret);
|
|
4057
|
+
});
|
|
4058
|
+
_defineProperty$1(_assertThisInitialized(_this), "onMouseOut", function(e2) {
|
|
4059
|
+
_this.triggerCallbacks("mouseout", null, e2);
|
|
4060
|
+
});
|
|
4061
|
+
_defineProperty$1(_assertThisInitialized(_this), "onMouseOver", function(e2) {
|
|
4062
|
+
_this.triggerCallbacks("mouseover", null, e2);
|
|
4063
|
+
});
|
|
4064
|
+
_defineProperty$1(_assertThisInitialized(_this), "onMouseEnter", function(e2) {
|
|
4065
|
+
var _assertThisInitialize7 = _assertThisInitialized(_this), player = _assertThisInitialize7.player, pos = _assertThisInitialize7.pos;
|
|
4066
|
+
if (pos.isDown || pos.isEnter || player.isMini || !player.config.allowSeekAfterEnded && player.ended) {
|
|
4067
|
+
return;
|
|
4068
|
+
}
|
|
4069
|
+
pos.isEnter = true;
|
|
4070
|
+
_this.bind("mousemove", _this.onMoveOnly);
|
|
4071
|
+
_this.bind("mouseleave", _this.onMouseLeave);
|
|
4072
|
+
util$3.event(e2);
|
|
4073
|
+
var _ePos = util$3.getEventPos(e2, player.zoom);
|
|
4074
|
+
var x2 = player.rotateDeg === 90 ? _ePos.clientY : _ePos.clientX;
|
|
4075
|
+
var ret = _this.computeTime(e2, x2);
|
|
4076
|
+
_this.triggerCallbacks("mouseenter", ret, e2);
|
|
4077
|
+
_this.focus();
|
|
4078
|
+
});
|
|
4079
|
+
_defineProperty$1(_assertThisInitialized(_this), "onMouseLeave", function(e2) {
|
|
4080
|
+
_this.triggerCallbacks("mouseleave", null, e2);
|
|
4081
|
+
_this.unlock();
|
|
4082
|
+
_this._updateInnerFocus(null);
|
|
4083
|
+
});
|
|
4084
|
+
_defineProperty$1(_assertThisInitialized(_this), "onVideoResize", function() {
|
|
4085
|
+
var _this$pos = _this.pos, x2 = _this$pos.x, isDown = _this$pos.isDown, isEnter = _this$pos.isEnter;
|
|
4086
|
+
if (isEnter && !isDown) {
|
|
4087
|
+
var ret = _this.computeTime(null, x2);
|
|
4088
|
+
_this.onMoveOnly(null, ret);
|
|
4089
|
+
}
|
|
4090
|
+
});
|
|
4091
|
+
_this.useable = false;
|
|
4092
|
+
_this.isProgressMoving = false;
|
|
4093
|
+
_this.__dragCallBacks = [];
|
|
4094
|
+
_this._state = {
|
|
4095
|
+
now: -1,
|
|
4096
|
+
direc: 0,
|
|
4097
|
+
time: 0,
|
|
4098
|
+
prePlayTime: -1
|
|
4099
|
+
};
|
|
4100
|
+
_this._disableBlur = false;
|
|
4101
|
+
if (typeof _this.config.isDragingSeek === "boolean") {
|
|
4102
|
+
console.warn("[XGPLAYER] 'isDragingSeek' is deprecated, please use 'isDraggingSeek' instead");
|
|
4103
|
+
_this.config.isDraggingSeek = _this.config.isDragingSeek;
|
|
3937
4104
|
}
|
|
3938
|
-
|
|
3939
|
-
|
|
4105
|
+
return _this;
|
|
4106
|
+
}
|
|
4107
|
+
_createClass$1(Progress2, [{
|
|
4108
|
+
key: "offsetDuration",
|
|
3940
4109
|
get: function get() {
|
|
3941
|
-
return
|
|
4110
|
+
return this.playerConfig.customDuration || this.player.offsetDuration || this.player.duration;
|
|
3942
4111
|
}
|
|
3943
4112
|
}, {
|
|
3944
|
-
key: "
|
|
4113
|
+
key: "duration",
|
|
3945
4114
|
get: function get() {
|
|
3946
|
-
return
|
|
3947
|
-
position: POSITIONS.CONTROLS_CENTER,
|
|
3948
|
-
index: 0,
|
|
3949
|
-
disable: false,
|
|
3950
|
-
isDraggingSeek: true,
|
|
3951
|
-
closeMoveSeek: false,
|
|
3952
|
-
isPauseMoving: false,
|
|
3953
|
-
isCloseClickSeek: false,
|
|
3954
|
-
fragments: [{
|
|
3955
|
-
percent: 1
|
|
3956
|
-
}],
|
|
3957
|
-
fragFocusClass: FRAGMENT_FOCUS_CLASS.POINT,
|
|
3958
|
-
fragClass: "",
|
|
3959
|
-
fragAutoFocus: false,
|
|
3960
|
-
miniMoveStep: 5,
|
|
3961
|
-
miniStartStep: 2,
|
|
3962
|
-
onMoveStart: function onMoveStart() {
|
|
3963
|
-
},
|
|
3964
|
-
onMoveEnd: function onMoveEnd() {
|
|
3965
|
-
},
|
|
3966
|
-
endedDiff: 0.2
|
|
3967
|
-
};
|
|
4115
|
+
return this.playerConfig.customDuration || this.player.duration;
|
|
3968
4116
|
}
|
|
3969
4117
|
}, {
|
|
3970
|
-
key: "
|
|
4118
|
+
key: "timeOffset",
|
|
3971
4119
|
get: function get() {
|
|
3972
|
-
return
|
|
3973
|
-
}
|
|
3974
|
-
}]);
|
|
3975
|
-
return Progress2;
|
|
3976
|
-
}(Plugin);
|
|
3977
|
-
var Icon = /* @__PURE__ */ function(_Plugin) {
|
|
3978
|
-
_inherits(Icon2, _Plugin);
|
|
3979
|
-
var _super = _createSuper(Icon2);
|
|
3980
|
-
function Icon2() {
|
|
3981
|
-
var _this;
|
|
3982
|
-
_classCallCheck$1(this, Icon2);
|
|
3983
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3984
|
-
args[_key] = arguments[_key];
|
|
3985
|
-
}
|
|
3986
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
3987
|
-
_defineProperty$1(_assertThisInitialized(_this), "_onMouseenter", function(e2) {
|
|
3988
|
-
_this.emit("icon_mouseenter", {
|
|
3989
|
-
pluginName: _this.pluginName
|
|
3990
|
-
});
|
|
3991
|
-
});
|
|
3992
|
-
_defineProperty$1(_assertThisInitialized(_this), "_onMouseLeave", function(e2) {
|
|
3993
|
-
_this.emit("icon_mouseleave", {
|
|
3994
|
-
pluginName: _this.pluginName
|
|
3995
|
-
});
|
|
3996
|
-
});
|
|
3997
|
-
return _this;
|
|
3998
|
-
}
|
|
3999
|
-
_createClass$1(Icon2, [{
|
|
4000
|
-
key: "afterCreate",
|
|
4001
|
-
value: function afterCreate() {
|
|
4002
|
-
this.bind("mouseenter", this._onMouseenter);
|
|
4003
|
-
this.bind("mouseleave", this._onMouseLeave);
|
|
4004
|
-
if (this.config.disable) {
|
|
4005
|
-
this.disable();
|
|
4006
|
-
}
|
|
4007
|
-
}
|
|
4008
|
-
}, {
|
|
4009
|
-
key: "destroy",
|
|
4010
|
-
value: function destroy() {
|
|
4011
|
-
this.unbind("mouseenter", this._onMouseenter);
|
|
4012
|
-
this.unbind("mouseleave", this._onMouseLeave);
|
|
4013
|
-
}
|
|
4014
|
-
}]);
|
|
4015
|
-
return Icon2;
|
|
4016
|
-
}(Plugin);
|
|
4017
|
-
var Play = /* @__PURE__ */ function(_IconPlugin) {
|
|
4018
|
-
_inherits(Play2, _IconPlugin);
|
|
4019
|
-
var _super = _createSuper(Play2);
|
|
4020
|
-
function Play2() {
|
|
4021
|
-
var _this;
|
|
4022
|
-
_classCallCheck$1(this, Play2);
|
|
4023
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4024
|
-
args[_key] = arguments[_key];
|
|
4025
|
-
}
|
|
4026
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
4027
|
-
_defineProperty$1(_assertThisInitialized(_this), "btnClick", function(e2) {
|
|
4028
|
-
e2.preventDefault();
|
|
4029
|
-
e2.stopPropagation();
|
|
4030
|
-
var _assertThisInitialize = _assertThisInitialized(_this), player = _assertThisInitialize.player;
|
|
4031
|
-
_this.emitUserAction(e2, "switch_play_pause", {
|
|
4032
|
-
prop: "paused",
|
|
4033
|
-
from: player.paused,
|
|
4034
|
-
to: !player.paused
|
|
4035
|
-
});
|
|
4036
|
-
if (player.ended) {
|
|
4037
|
-
player.replay();
|
|
4038
|
-
} else if (player.paused) {
|
|
4039
|
-
player.play();
|
|
4040
|
-
_this.animate(false);
|
|
4041
|
-
} else {
|
|
4042
|
-
player.pause();
|
|
4043
|
-
_this.animate(true);
|
|
4044
|
-
}
|
|
4045
|
-
return false;
|
|
4046
|
-
});
|
|
4047
|
-
return _this;
|
|
4048
|
-
}
|
|
4049
|
-
_createClass$1(Play2, [{
|
|
4050
|
-
key: "afterCreate",
|
|
4051
|
-
value: function afterCreate() {
|
|
4052
|
-
_get(_getPrototypeOf(Play2.prototype), "afterCreate", this).call(this);
|
|
4053
|
-
var config = this.config;
|
|
4054
|
-
if (config.disable) {
|
|
4055
|
-
return;
|
|
4056
|
-
}
|
|
4057
|
-
this.initIcons();
|
|
4058
|
-
this.bind(["touchend", "click"], this.btnClick);
|
|
4059
|
-
this.listenEvents();
|
|
4060
|
-
this.animate(true);
|
|
4120
|
+
return this.playerConfig.timeOffset || 0;
|
|
4061
4121
|
}
|
|
4062
4122
|
}, {
|
|
4063
|
-
key: "
|
|
4064
|
-
|
|
4065
|
-
var
|
|
4066
|
-
|
|
4067
|
-
this.on([PLAY, PAUSE, ERROR, EMPTIED], function() {
|
|
4068
|
-
_this2.animate(player.paused);
|
|
4069
|
-
});
|
|
4123
|
+
key: "currentTime",
|
|
4124
|
+
get: function get() {
|
|
4125
|
+
var _this$player = this.player, offsetCurrentTime = _this$player.offsetCurrentTime, currentTime = _this$player.currentTime;
|
|
4126
|
+
return offsetCurrentTime >= 0 ? offsetCurrentTime : currentTime + this.timeOffset;
|
|
4070
4127
|
}
|
|
4071
4128
|
}, {
|
|
4072
|
-
key: "
|
|
4073
|
-
value: function
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
icon: PlaySvg,
|
|
4077
|
-
class: "xg-icon-play"
|
|
4078
|
-
},
|
|
4079
|
-
pause: {
|
|
4080
|
-
icon: PauseSvg,
|
|
4081
|
-
class: "xg-icon-pause"
|
|
4082
|
-
}
|
|
4083
|
-
};
|
|
4129
|
+
key: "changeState",
|
|
4130
|
+
value: function changeState() {
|
|
4131
|
+
var useable = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
4132
|
+
this.useable = useable;
|
|
4084
4133
|
}
|
|
4085
4134
|
}, {
|
|
4086
|
-
key: "
|
|
4087
|
-
value: function
|
|
4088
|
-
|
|
4089
|
-
this.appendChild(".xgplayer-icon", icons.play);
|
|
4090
|
-
this.appendChild(".xgplayer-icon", icons.pause);
|
|
4135
|
+
key: "show",
|
|
4136
|
+
value: function show(value) {
|
|
4137
|
+
this.root && (this.root.style.display = "flex");
|
|
4091
4138
|
}
|
|
4092
4139
|
}, {
|
|
4093
|
-
key: "
|
|
4094
|
-
value: function
|
|
4095
|
-
|
|
4096
|
-
|
|
4140
|
+
key: "_initInner",
|
|
4141
|
+
value: function _initInner() {
|
|
4142
|
+
var _this2 = this;
|
|
4143
|
+
var fragments = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
4144
|
+
var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
4145
|
+
if (!fragments || fragments.length === 0) {
|
|
4146
|
+
fragments = [{
|
|
4147
|
+
percent: 1
|
|
4148
|
+
}];
|
|
4097
4149
|
}
|
|
4098
|
-
var
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4150
|
+
var _c = _objectSpread2(_objectSpread2({
|
|
4151
|
+
fragments
|
|
4152
|
+
}, config), {}, {
|
|
4153
|
+
actionCallback: function actionCallback(data) {
|
|
4154
|
+
_this2.emitUserAction("fragment_focus", "fragment_focus", data);
|
|
4155
|
+
}
|
|
4156
|
+
});
|
|
4157
|
+
if (!this.innerList) {
|
|
4158
|
+
this.innerList = new InnerList(_c);
|
|
4159
|
+
this.outer.insertBefore(this.innerList.render(), this.outer.children[0]);
|
|
4160
|
+
["findHightLight", "unHightLight", "setHightLight", "findFragment"].map(function(item) {
|
|
4161
|
+
_this2[item] = _this2.innerList[item].bind(_this2.innerList);
|
|
4162
|
+
});
|
|
4103
4163
|
} else {
|
|
4104
|
-
this.
|
|
4105
|
-
tipDom && this.changeLangTextKey(tipDom, i18nKeys.PAUSE_TIPS);
|
|
4164
|
+
this.innerList.reset(_c);
|
|
4106
4165
|
}
|
|
4107
4166
|
}
|
|
4108
4167
|
}, {
|
|
4109
|
-
key: "
|
|
4110
|
-
value: function
|
|
4111
|
-
|
|
4112
|
-
this.unbind(["touchend", "click"], this.btnClick);
|
|
4168
|
+
key: "_updateInnerFocus",
|
|
4169
|
+
value: function _updateInnerFocus(data) {
|
|
4170
|
+
this.innerList && this.innerList.updateFocus(data);
|
|
4113
4171
|
}
|
|
4114
4172
|
}, {
|
|
4115
|
-
key: "
|
|
4116
|
-
value: function
|
|
4117
|
-
if (this.config.disable) {
|
|
4173
|
+
key: "afterCreate",
|
|
4174
|
+
value: function afterCreate() {
|
|
4175
|
+
if (this.config.disable || this.playerConfig.isLive) {
|
|
4118
4176
|
return;
|
|
4119
4177
|
}
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
}, {
|
|
4128
|
-
key: "defaultConfig",
|
|
4129
|
-
get: function get() {
|
|
4130
|
-
return {
|
|
4131
|
-
position: POSITIONS.CONTROLS_LEFT,
|
|
4132
|
-
index: 0,
|
|
4133
|
-
disable: false
|
|
4178
|
+
this.pos = {
|
|
4179
|
+
x: 0,
|
|
4180
|
+
y: 0,
|
|
4181
|
+
moving: false,
|
|
4182
|
+
isDown: false,
|
|
4183
|
+
isEnter: false,
|
|
4184
|
+
isLocked: false
|
|
4134
4185
|
};
|
|
4186
|
+
this.outer = this.find("xg-outer");
|
|
4187
|
+
var _this$config = this.config, fragFocusClass = _this$config.fragFocusClass, fragAutoFocus = _this$config.fragAutoFocus, fragClass = _this$config.fragClass;
|
|
4188
|
+
this._initInner(this.config.fragments, {
|
|
4189
|
+
fragFocusClass,
|
|
4190
|
+
fragAutoFocus,
|
|
4191
|
+
fragClass,
|
|
4192
|
+
style: this.playerConfig.commonStyle || {}
|
|
4193
|
+
});
|
|
4194
|
+
if (sniffer.device === "mobile") {
|
|
4195
|
+
this.config.isDraggingSeek = false;
|
|
4196
|
+
this.isMobile = true;
|
|
4197
|
+
}
|
|
4198
|
+
this.progressBtn = this.find(".xgplayer-progress-btn");
|
|
4199
|
+
this.listenEvents();
|
|
4200
|
+
this.bindDomEvents();
|
|
4201
|
+
this.initCustomStyle();
|
|
4135
4202
|
}
|
|
4136
|
-
}
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
this.
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4203
|
+
}, {
|
|
4204
|
+
key: "listenEvents",
|
|
4205
|
+
value: function listenEvents() {
|
|
4206
|
+
var _this3 = this;
|
|
4207
|
+
this.on(DURATION_CHANGE, function() {
|
|
4208
|
+
_this3.onMouseLeave();
|
|
4209
|
+
});
|
|
4210
|
+
this.on(TIME_UPDATE, function() {
|
|
4211
|
+
_this3.onTimeupdate();
|
|
4212
|
+
});
|
|
4213
|
+
this.on(SEEKED, function() {
|
|
4214
|
+
_this3.onTimeupdate();
|
|
4215
|
+
_this3.onCacheUpdate();
|
|
4216
|
+
});
|
|
4217
|
+
this.on(PROGRESS, function() {
|
|
4218
|
+
_this3.onCacheUpdate();
|
|
4219
|
+
});
|
|
4220
|
+
this.on(ENDED, function() {
|
|
4221
|
+
_this3.onCacheUpdate(true);
|
|
4222
|
+
_this3.onTimeupdate(true);
|
|
4223
|
+
_this3._state.now = 0;
|
|
4224
|
+
});
|
|
4225
|
+
this.on(EMPTIED, function() {
|
|
4226
|
+
_this3.onReset();
|
|
4227
|
+
});
|
|
4228
|
+
this.on(VIDEO_RESIZE, function() {
|
|
4229
|
+
_this3.onVideoResize();
|
|
4230
|
+
});
|
|
4160
4231
|
}
|
|
4161
4232
|
}, {
|
|
4162
|
-
key: "
|
|
4163
|
-
value: function
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4233
|
+
key: "setConfig",
|
|
4234
|
+
value: function setConfig(config) {
|
|
4235
|
+
var _this4 = this;
|
|
4236
|
+
var frags = null;
|
|
4237
|
+
Object.keys(config).forEach(function(key) {
|
|
4238
|
+
_this4.config[key] = config[key];
|
|
4239
|
+
if (key === "fragments") {
|
|
4240
|
+
frags = config[key];
|
|
4168
4241
|
}
|
|
4169
|
-
};
|
|
4242
|
+
});
|
|
4243
|
+
if (frags) {
|
|
4244
|
+
this._initInner(frags, config);
|
|
4245
|
+
}
|
|
4170
4246
|
}
|
|
4171
4247
|
}, {
|
|
4172
|
-
key: "
|
|
4173
|
-
value: function
|
|
4174
|
-
var
|
|
4175
|
-
|
|
4248
|
+
key: "initCustomStyle",
|
|
4249
|
+
value: function initCustomStyle() {
|
|
4250
|
+
var _ref = this.playerConfig || {}, commonStyle = _ref.commonStyle;
|
|
4251
|
+
var sliderBtnStyle = commonStyle.sliderBtnStyle;
|
|
4252
|
+
var progressBtn = this.progressBtn;
|
|
4253
|
+
if (sliderBtnStyle) {
|
|
4254
|
+
if (typeof sliderBtnStyle === "string") {
|
|
4255
|
+
progressBtn.style.boxShadow = sliderBtnStyle;
|
|
4256
|
+
} else if (_typeof$1(sliderBtnStyle) === "object") {
|
|
4257
|
+
Object.keys(sliderBtnStyle).map(function(key) {
|
|
4258
|
+
progressBtn.style[key] = sliderBtnStyle[key];
|
|
4259
|
+
});
|
|
4260
|
+
}
|
|
4261
|
+
}
|
|
4176
4262
|
}
|
|
4177
4263
|
}, {
|
|
4178
|
-
key: "
|
|
4179
|
-
value: function
|
|
4180
|
-
|
|
4264
|
+
key: "triggerCallbacks",
|
|
4265
|
+
value: function triggerCallbacks(type, data, event) {
|
|
4266
|
+
if (this.__dragCallBacks.length > 0) {
|
|
4267
|
+
this.__dragCallBacks.map(function(item) {
|
|
4268
|
+
if (item && item.handler && item.type === type) {
|
|
4269
|
+
try {
|
|
4270
|
+
item.handler(data, event);
|
|
4271
|
+
} catch (error) {
|
|
4272
|
+
console.error("[XGPLAYER][triggerCallbacks] ".concat(item, " error"), error);
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
});
|
|
4276
|
+
}
|
|
4181
4277
|
}
|
|
4182
4278
|
}, {
|
|
4183
|
-
key: "
|
|
4184
|
-
value: function
|
|
4185
|
-
|
|
4279
|
+
key: "addCallBack",
|
|
4280
|
+
value: function addCallBack(type, handle) {
|
|
4281
|
+
if (handle && typeof handle === "function") {
|
|
4282
|
+
this.__dragCallBacks.push({
|
|
4283
|
+
type,
|
|
4284
|
+
handler: handle
|
|
4285
|
+
});
|
|
4286
|
+
}
|
|
4186
4287
|
}
|
|
4187
4288
|
}, {
|
|
4188
|
-
key: "
|
|
4189
|
-
value: function
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4289
|
+
key: "removeCallBack",
|
|
4290
|
+
value: function removeCallBack(type, event) {
|
|
4291
|
+
var __dragCallBacks = this.__dragCallBacks;
|
|
4292
|
+
var _index = -1;
|
|
4293
|
+
__dragCallBacks.map(function(item, index2) {
|
|
4294
|
+
if (item && item.type === type && item.handler === event) {
|
|
4295
|
+
_index = index2;
|
|
4296
|
+
}
|
|
4297
|
+
});
|
|
4298
|
+
if (_index > -1) {
|
|
4299
|
+
__dragCallBacks.splice(_index, 1);
|
|
4300
|
+
}
|
|
4196
4301
|
}
|
|
4197
4302
|
}, {
|
|
4198
|
-
key: "
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
}]);
|
|
4206
|
-
return TopBackIcon2;
|
|
4207
|
-
}(Plugin);
|
|
4208
|
-
function FullScreenSvg() {
|
|
4209
|
-
return new DOMParser().parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M598 214h212v212h-84v-128h-128v-84zM726 726v-128h84v212h-212v-84h128zM214 426v-212h212v84h-128v128h-84zM298 598v128h128v84h-212v-212h84z"></path>\n</svg>\n', "image/svg+xml").firstChild;
|
|
4210
|
-
}
|
|
4211
|
-
function ExitFullScreenSvg() {
|
|
4212
|
-
return new DOMParser().parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="28" height="40" viewBox="2 -4 28 40">\n <path fill="#fff" transform="scale(0.0320625 0.0320625)" d="M682 342h128v84h-212v-212h84v128zM598 810v-212h212v84h-128v128h-84zM342 342v-128h84v212h-212v-84h128zM214 682v-84h212v212h-84v-128h-128z"></path>\n</svg>\n', "image/svg+xml").firstChild;
|
|
4213
|
-
}
|
|
4214
|
-
var Fullscreen = /* @__PURE__ */ function(_IconPlugin) {
|
|
4215
|
-
_inherits(Fullscreen2, _IconPlugin);
|
|
4216
|
-
var _super = _createSuper(Fullscreen2);
|
|
4217
|
-
function Fullscreen2() {
|
|
4218
|
-
var _this;
|
|
4219
|
-
_classCallCheck$1(this, Fullscreen2);
|
|
4220
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4221
|
-
args[_key] = arguments[_key];
|
|
4222
|
-
}
|
|
4223
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
4224
|
-
_defineProperty$1(_assertThisInitialized(_this), "_onOrientationChange", function(e2) {
|
|
4225
|
-
if (_this.player.fullscreen && _this.config.rotateFullscreen) {
|
|
4226
|
-
if (window.orientation === 90 || window.orientation === -90) {
|
|
4227
|
-
_this.player.setRotateDeg(0);
|
|
4228
|
-
} else {
|
|
4229
|
-
_this.player.setRotateDeg(90);
|
|
4230
|
-
}
|
|
4303
|
+
key: "unlock",
|
|
4304
|
+
value: function unlock() {
|
|
4305
|
+
var player = this.player, pos = this.pos;
|
|
4306
|
+
pos.isEnter = false;
|
|
4307
|
+
pos.isLocked = false;
|
|
4308
|
+
if (player.isMini) {
|
|
4309
|
+
return;
|
|
4231
4310
|
}
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
_createClass$1(Fullscreen2, [{
|
|
4236
|
-
key: "afterCreate",
|
|
4237
|
-
value: function afterCreate() {
|
|
4238
|
-
var _this2 = this;
|
|
4239
|
-
_get(_getPrototypeOf(Fullscreen2.prototype), "afterCreate", this).call(this);
|
|
4240
|
-
var config = this.config, playerConfig = this.playerConfig;
|
|
4241
|
-
if (config.disable) {
|
|
4311
|
+
this.unbind("mousemove", this.onMoveOnly);
|
|
4312
|
+
if (pos.isDown) {
|
|
4313
|
+
this.unbind("mouseleave", this.onMouseLeave);
|
|
4242
4314
|
return;
|
|
4243
4315
|
}
|
|
4244
|
-
|
|
4245
|
-
|
|
4316
|
+
this.blur();
|
|
4317
|
+
}
|
|
4318
|
+
}, {
|
|
4319
|
+
key: "bindDomEvents",
|
|
4320
|
+
value: function bindDomEvents() {
|
|
4321
|
+
var config = this.player.config;
|
|
4322
|
+
this._mouseDownHandlerHook = this.hook("dragstart", this._mouseDownHandler);
|
|
4323
|
+
this._mouseUpHandlerHook = this.hook("dragend", this._mouseUpHandler);
|
|
4324
|
+
this._mouseMoveHandlerHook = this.hook("drag", this._mouseMoveHandler);
|
|
4325
|
+
if (this.domEventType === "touch" || this.domEventType === "compatible") {
|
|
4326
|
+
this.root.addEventListener("touchstart", this.onMouseDown);
|
|
4327
|
+
}
|
|
4328
|
+
if (this.domEventType === "mouse" || this.domEventType === "compatible") {
|
|
4329
|
+
this.bind("mousedown", this.onMouseDown);
|
|
4330
|
+
config.isMobileSimulateMode !== "mobile" && this.bind("mouseenter", this.onMouseEnter);
|
|
4331
|
+
this.bind("mouseover", this.onMouseOver);
|
|
4332
|
+
this.bind("mouseout", this.onMouseOut);
|
|
4333
|
+
this.player.root.addEventListener("click", this.onBodyClick, true);
|
|
4246
4334
|
}
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4335
|
+
}
|
|
4336
|
+
}, {
|
|
4337
|
+
key: "focus",
|
|
4338
|
+
value: function focus() {
|
|
4339
|
+
this.player.controls.pauseAutoHide();
|
|
4340
|
+
util$3.addClass(this.root, "active");
|
|
4341
|
+
}
|
|
4342
|
+
}, {
|
|
4343
|
+
key: "blur",
|
|
4344
|
+
value: function blur() {
|
|
4345
|
+
if (this._disableBlur) {
|
|
4346
|
+
return;
|
|
4251
4347
|
}
|
|
4252
|
-
this.
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
this.
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
if (
|
|
4270
|
-
|
|
4271
|
-
plugin: TopBackIcon,
|
|
4272
|
-
options: {
|
|
4273
|
-
config: {
|
|
4274
|
-
onClick: function onClick(e2) {
|
|
4275
|
-
_this2.handleFullscreen(e2);
|
|
4276
|
-
}
|
|
4277
|
-
}
|
|
4278
|
-
}
|
|
4279
|
-
});
|
|
4348
|
+
this.player.controls.recoverAutoHide();
|
|
4349
|
+
util$3.removeClass(this.root, "active");
|
|
4350
|
+
}
|
|
4351
|
+
}, {
|
|
4352
|
+
key: "disableBlur",
|
|
4353
|
+
value: function disableBlur() {
|
|
4354
|
+
this._disableBlur = true;
|
|
4355
|
+
}
|
|
4356
|
+
}, {
|
|
4357
|
+
key: "enableBlur",
|
|
4358
|
+
value: function enableBlur() {
|
|
4359
|
+
this._disableBlur = false;
|
|
4360
|
+
}
|
|
4361
|
+
}, {
|
|
4362
|
+
key: "updateWidth",
|
|
4363
|
+
value: function updateWidth(currentTime, seekTime, percent, type) {
|
|
4364
|
+
var config = this.config, player = this.player;
|
|
4365
|
+
if (config.isCloseClickSeek && type === 0) {
|
|
4366
|
+
return;
|
|
4280
4367
|
}
|
|
4281
|
-
|
|
4282
|
-
|
|
4368
|
+
var realTime = seekTime = seekTime >= player.duration ? player.duration - config.endedDiff : Number(seekTime).toFixed(1);
|
|
4369
|
+
this.updatePercent(percent);
|
|
4370
|
+
this.updateTime(currentTime);
|
|
4371
|
+
if (type === 1 && (!config.isDraggingSeek || player.config.mediaType === "audio")) {
|
|
4372
|
+
return;
|
|
4283
4373
|
}
|
|
4374
|
+
this._state.now = realTime;
|
|
4375
|
+
this._state.direc = realTime > player.currentTime ? 0 : 1;
|
|
4376
|
+
player.seek(realTime);
|
|
4284
4377
|
}
|
|
4285
4378
|
}, {
|
|
4286
|
-
key: "
|
|
4287
|
-
value: function
|
|
4379
|
+
key: "computeTime",
|
|
4380
|
+
value: function computeTime(e2, x2) {
|
|
4381
|
+
var player = this.player;
|
|
4382
|
+
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;
|
|
4383
|
+
var rWidth, rLeft;
|
|
4384
|
+
var clientX = x2;
|
|
4385
|
+
if (player.rotateDeg === 90) {
|
|
4386
|
+
rWidth = height;
|
|
4387
|
+
rLeft = top;
|
|
4388
|
+
} else {
|
|
4389
|
+
rWidth = width;
|
|
4390
|
+
rLeft = left;
|
|
4391
|
+
}
|
|
4392
|
+
var offset = clientX - rLeft;
|
|
4393
|
+
offset = offset > rWidth ? rWidth : offset < 0 ? 0 : offset;
|
|
4394
|
+
var percent = offset / rWidth;
|
|
4395
|
+
percent = percent < 0 ? 0 : percent > 1 ? 1 : percent;
|
|
4396
|
+
if (Number.isNaN(percent)) {
|
|
4397
|
+
percent = this.player.currentTime / this.offsetDuration;
|
|
4398
|
+
}
|
|
4399
|
+
var currentTime = parseInt(percent * this.offsetDuration * 1e3, 10) / 1e3;
|
|
4400
|
+
var seekTime = util$3.getCurrentTimeByOffset(currentTime, player.timeSegments);
|
|
4288
4401
|
return {
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
}
|
|
4402
|
+
percent,
|
|
4403
|
+
currentTime,
|
|
4404
|
+
seekTime,
|
|
4405
|
+
offset,
|
|
4406
|
+
width: rWidth,
|
|
4407
|
+
left: rLeft,
|
|
4408
|
+
e: e2
|
|
4297
4409
|
};
|
|
4298
4410
|
}
|
|
4299
4411
|
}, {
|
|
4300
|
-
key: "
|
|
4301
|
-
value: function
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4412
|
+
key: "updateTime",
|
|
4413
|
+
value: function updateTime(time) {
|
|
4414
|
+
var player = this.player, duration = this.duration;
|
|
4415
|
+
if (time > duration) {
|
|
4416
|
+
time = duration;
|
|
4417
|
+
} else if (time < 0) {
|
|
4418
|
+
time = 0;
|
|
4419
|
+
}
|
|
4420
|
+
var timeIcon = player.plugins.time;
|
|
4421
|
+
if (timeIcon) {
|
|
4422
|
+
timeIcon.updateTime(time);
|
|
4306
4423
|
}
|
|
4307
4424
|
}
|
|
4308
4425
|
}, {
|
|
4309
|
-
key: "
|
|
4310
|
-
value: function
|
|
4311
|
-
|
|
4312
|
-
this.
|
|
4313
|
-
|
|
4426
|
+
key: "resetSeekState",
|
|
4427
|
+
value: function resetSeekState() {
|
|
4428
|
+
this.isProgressMoving = false;
|
|
4429
|
+
var timeIcon = this.player.plugins.time;
|
|
4430
|
+
timeIcon && timeIcon.resetActive();
|
|
4314
4431
|
}
|
|
4315
4432
|
}, {
|
|
4316
|
-
key: "
|
|
4317
|
-
value: function
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4433
|
+
key: "updatePercent",
|
|
4434
|
+
value: function updatePercent(percent, notSeek) {
|
|
4435
|
+
this.isProgressMoving = true;
|
|
4436
|
+
if (this.config.disable) {
|
|
4437
|
+
return;
|
|
4321
4438
|
}
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
}
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
if (
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
this.unlockScreen();
|
|
4345
|
-
}
|
|
4439
|
+
percent = percent > 1 ? 1 : percent < 0 ? 0 : percent;
|
|
4440
|
+
this.progressBtn.style.left = "".concat(percent * 100, "%");
|
|
4441
|
+
this.innerList.update({
|
|
4442
|
+
played: percent * this.offsetDuration
|
|
4443
|
+
}, this.offsetDuration);
|
|
4444
|
+
var miniprogress = this.player.plugins.miniprogress;
|
|
4445
|
+
miniprogress && miniprogress.update({
|
|
4446
|
+
played: percent * this.offsetDuration
|
|
4447
|
+
}, this.offsetDuration);
|
|
4448
|
+
}
|
|
4449
|
+
}, {
|
|
4450
|
+
key: "onTimeupdate",
|
|
4451
|
+
value: function onTimeupdate(isEnded) {
|
|
4452
|
+
var player = this.player, _state = this._state, offsetDuration = this.offsetDuration;
|
|
4453
|
+
if (player.isSeeking && player.media.seeking || this.isProgressMoving || !player.hasStart) {
|
|
4454
|
+
return;
|
|
4455
|
+
}
|
|
4456
|
+
if (_state.now > -1) {
|
|
4457
|
+
var abs = parseInt(_state.now * 1e3, 10) - parseInt(player.currentTime * 1e3, 10);
|
|
4458
|
+
if (_state.direc === 0 && abs > 300 || _state.direc === 1 && abs > -300) {
|
|
4459
|
+
_state.now = -1;
|
|
4460
|
+
return;
|
|
4346
4461
|
} else {
|
|
4347
|
-
|
|
4348
|
-
});
|
|
4349
|
-
if (config.useScreenOrientation && player.aspectRatio > 1) {
|
|
4350
|
-
this.lockScreen(config.lockOrientationType);
|
|
4351
|
-
}
|
|
4462
|
+
_state.now = -1;
|
|
4352
4463
|
}
|
|
4353
4464
|
}
|
|
4465
|
+
var time = this.currentTime;
|
|
4466
|
+
time = util$3.adjustTimeByDuration(time, offsetDuration, isEnded);
|
|
4467
|
+
this.innerList.update({
|
|
4468
|
+
played: time
|
|
4469
|
+
}, offsetDuration);
|
|
4470
|
+
this.progressBtn.style.left = "".concat(time / offsetDuration * 100, "%");
|
|
4354
4471
|
}
|
|
4355
4472
|
}, {
|
|
4356
|
-
key: "
|
|
4357
|
-
value: function
|
|
4358
|
-
|
|
4359
|
-
if (
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4473
|
+
key: "onCacheUpdate",
|
|
4474
|
+
value: function onCacheUpdate(isEnded) {
|
|
4475
|
+
var player = this.player, duration = this.duration;
|
|
4476
|
+
if (!player) {
|
|
4477
|
+
return;
|
|
4478
|
+
}
|
|
4479
|
+
var _end = player.bufferedPoint.end;
|
|
4480
|
+
_end = util$3.adjustTimeByDuration(_end, duration, isEnded);
|
|
4481
|
+
this.innerList.update({
|
|
4482
|
+
cached: _end
|
|
4483
|
+
}, duration);
|
|
4484
|
+
}
|
|
4485
|
+
}, {
|
|
4486
|
+
key: "onReset",
|
|
4487
|
+
value: function onReset() {
|
|
4488
|
+
this.innerList.update({
|
|
4489
|
+
played: 0,
|
|
4490
|
+
cached: 0
|
|
4491
|
+
}, 0);
|
|
4492
|
+
this.progressBtn.style.left = "0%";
|
|
4493
|
+
}
|
|
4494
|
+
}, {
|
|
4495
|
+
key: "destroy",
|
|
4496
|
+
value: function destroy() {
|
|
4497
|
+
var player = this.player;
|
|
4498
|
+
this.thumbnailPlugin = null;
|
|
4499
|
+
this.innerList.destroy();
|
|
4500
|
+
this.innerList = null;
|
|
4501
|
+
var domEventType = this.domEventType;
|
|
4502
|
+
if (domEventType === "touch" || domEventType === "compatible") {
|
|
4503
|
+
this.root.removeEventListener("touchstart", this.onMouseDown);
|
|
4504
|
+
this.root.removeEventListener("touchmove", this.onMouseMove);
|
|
4505
|
+
this.root.removeEventListener("touchend", this.onMouseUp);
|
|
4506
|
+
this.root.removeEventListener("touchcancel", this.onMouseUp);
|
|
4507
|
+
}
|
|
4508
|
+
if (domEventType === "mouse" || domEventType === "compatible") {
|
|
4509
|
+
this.unbind("mousedown", this.onMouseDown);
|
|
4510
|
+
this.unbind("mouseenter", this.onMouseEnter);
|
|
4511
|
+
this.unbind("mousemove", this.onMoveOnly);
|
|
4512
|
+
this.unbind("mouseleave", this.onMouseLeave);
|
|
4513
|
+
document.removeEventListener("mousemove", this.onMouseMove, false);
|
|
4514
|
+
document.removeEventListener("mouseup", this.onMouseUp, false);
|
|
4515
|
+
player.root.removeEventListener("click", this.onBodyClick, true);
|
|
4367
4516
|
}
|
|
4368
4517
|
}
|
|
4369
4518
|
}, {
|
|
4370
4519
|
key: "render",
|
|
4371
4520
|
value: function render() {
|
|
4372
|
-
if (this.config.disable) {
|
|
4521
|
+
if (this.config.disable || this.playerConfig.isLive) {
|
|
4373
4522
|
return;
|
|
4374
4523
|
}
|
|
4375
|
-
var
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
}, {
|
|
4379
|
-
key: "lockScreen",
|
|
4380
|
-
value: function lockScreen(orientation) {
|
|
4381
|
-
try {
|
|
4382
|
-
screen.orientation.lock(orientation).catch(function(e2) {
|
|
4383
|
-
});
|
|
4384
|
-
} catch (e2) {
|
|
4385
|
-
}
|
|
4386
|
-
}
|
|
4387
|
-
}, {
|
|
4388
|
-
key: "unlockScreen",
|
|
4389
|
-
value: function unlockScreen() {
|
|
4390
|
-
try {
|
|
4391
|
-
screen.orientation.unlock().catch(function(e2) {
|
|
4392
|
-
});
|
|
4393
|
-
} catch (e2) {
|
|
4394
|
-
}
|
|
4524
|
+
var controlsMode = this.player.controls ? this.player.controls.config.mode : "";
|
|
4525
|
+
var className = controlsMode === "bottom" ? "xgplayer-progress-bottom" : "";
|
|
4526
|
+
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 ');
|
|
4395
4527
|
}
|
|
4396
4528
|
}], [{
|
|
4397
4529
|
key: "pluginName",
|
|
4398
4530
|
get: function get() {
|
|
4399
|
-
return "
|
|
4531
|
+
return "progress";
|
|
4400
4532
|
}
|
|
4401
4533
|
}, {
|
|
4402
4534
|
key: "defaultConfig",
|
|
4403
4535
|
get: function get() {
|
|
4404
4536
|
return {
|
|
4405
|
-
position: POSITIONS.
|
|
4537
|
+
position: POSITIONS.CONTROLS_CENTER,
|
|
4406
4538
|
index: 0,
|
|
4407
|
-
useCssFullscreen: false,
|
|
4408
|
-
rotateFullscreen: false,
|
|
4409
|
-
useScreenOrientation: false,
|
|
4410
|
-
lockOrientationType: "landscape",
|
|
4411
|
-
switchCallback: null,
|
|
4412
|
-
target: null,
|
|
4413
4539
|
disable: false,
|
|
4414
|
-
|
|
4540
|
+
isDraggingSeek: true,
|
|
4541
|
+
closeMoveSeek: false,
|
|
4542
|
+
isPauseMoving: false,
|
|
4543
|
+
isCloseClickSeek: false,
|
|
4544
|
+
fragments: [{
|
|
4545
|
+
percent: 1
|
|
4546
|
+
}],
|
|
4547
|
+
fragFocusClass: FRAGMENT_FOCUS_CLASS.POINT,
|
|
4548
|
+
fragClass: "",
|
|
4549
|
+
fragAutoFocus: false,
|
|
4550
|
+
miniMoveStep: 5,
|
|
4551
|
+
miniStartStep: 2,
|
|
4552
|
+
onMoveStart: function onMoveStart() {
|
|
4553
|
+
},
|
|
4554
|
+
onMoveEnd: function onMoveEnd() {
|
|
4555
|
+
},
|
|
4556
|
+
endedDiff: 0.2
|
|
4415
4557
|
};
|
|
4416
4558
|
}
|
|
4559
|
+
}, {
|
|
4560
|
+
key: "FRAGMENT_FOCUS_CLASS",
|
|
4561
|
+
get: function get() {
|
|
4562
|
+
return FRAGMENT_FOCUS_CLASS;
|
|
4563
|
+
}
|
|
4417
4564
|
}]);
|
|
4418
|
-
return
|
|
4419
|
-
}(
|
|
4565
|
+
return Progress2;
|
|
4566
|
+
}(Plugin);
|
|
4420
4567
|
var Time = /* @__PURE__ */ function(_Plugin) {
|
|
4421
4568
|
_inherits(Time2, _Plugin);
|
|
4422
4569
|
var _super = _createSuper(Time2);
|
|
@@ -4541,6 +4688,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4541
4688
|
this.centerDurDom = util$3.createDom("xg-icon", "00:00", {}, "xgplayer-time xg-time-right");
|
|
4542
4689
|
center.children.length > 0 ? center.insertBefore(this.centerCurDom, center.children[0]) : center.appendChild(this.centerCurDom);
|
|
4543
4690
|
center.appendChild(this.centerDurDom);
|
|
4691
|
+
this.extraEls = [this.centerCurDom, this.centerDurDom];
|
|
4544
4692
|
}
|
|
4545
4693
|
}, {
|
|
4546
4694
|
key: "afterPlayerInit",
|
|
@@ -4962,141 +5110,6 @@ var __publicField = (obj, key, value) => {
|
|
|
4962
5110
|
}]);
|
|
4963
5111
|
return Volume2;
|
|
4964
5112
|
}(Plugin);
|
|
4965
|
-
function CssFullSceenSvg() {
|
|
4966
|
-
return new DOMParser().parseFromString(`<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">
|
|
4967
|
-
<path fill="#fff" transform="scale(1.3, 1.3)" class='path_full' d="M9,10v1a.9.9,0,0,1-1,1,.9.9,0,0,1-1-1V9A.9.9,0,0,1,8,8h2a.9.9,0,0,1,1,1,.9.9,0,0,1-1,1Zm6,4V13a1,1,0,0,1,2,0v2a.9.9,0,0,1-1,1H14a1,1,0,0,1,0-2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>
|
|
4968
|
-
</svg>
|
|
4969
|
-
`, "image/svg+xml").firstChild;
|
|
4970
|
-
}
|
|
4971
|
-
function ExitCssFullSceenSvg() {
|
|
4972
|
-
return new DOMParser().parseFromString('<svg xmlns="http://www.w3.org/2000/svg" width="31" height="40" viewBox="0 -5 31 40">\n <path fill="#fff" transform="scale(1.3, 1.3)" d="M9,10V9a.9.9,0,0,1,1-1,.9.9,0,0,1,1,1v2a.9.9,0,0,1-1,1H8a.9.9,0,0,1-1-1,.9.9,0,0,1,1-1Zm6,4v1a1,1,0,0,1-2,0V13a.9.9,0,0,1,1-1h2a1,1,0,0,1,0,2Zm3-7H6V17H18Zm2,0V17a2,2,0,0,1-2,2H6a2,2,0,0,1-2-2V7A2,2,0,0,1,6,5H18A2,2,0,0,1,20,7Z"></path>\n</svg>\n', "image/svg+xml").firstChild;
|
|
4973
|
-
}
|
|
4974
|
-
var CssFullScreen = /* @__PURE__ */ function(_IconPlugin) {
|
|
4975
|
-
_inherits(CssFullScreen2, _IconPlugin);
|
|
4976
|
-
var _super = _createSuper(CssFullScreen2);
|
|
4977
|
-
function CssFullScreen2() {
|
|
4978
|
-
_classCallCheck$1(this, CssFullScreen2);
|
|
4979
|
-
return _super.apply(this, arguments);
|
|
4980
|
-
}
|
|
4981
|
-
_createClass$1(CssFullScreen2, [{
|
|
4982
|
-
key: "beforeCreate",
|
|
4983
|
-
value: function beforeCreate(args) {
|
|
4984
|
-
if (typeof args.player.config.cssFullscreen === "boolean") {
|
|
4985
|
-
args.config.disable = !args.player.config.cssFullscreen;
|
|
4986
|
-
}
|
|
4987
|
-
}
|
|
4988
|
-
}, {
|
|
4989
|
-
key: "afterCreate",
|
|
4990
|
-
value: function afterCreate() {
|
|
4991
|
-
var _this = this;
|
|
4992
|
-
_get(_getPrototypeOf(CssFullScreen2.prototype), "afterCreate", this).call(this);
|
|
4993
|
-
if (this.config.disable) {
|
|
4994
|
-
return;
|
|
4995
|
-
}
|
|
4996
|
-
if (this.config.target) {
|
|
4997
|
-
this.playerConfig.fullscreenTarget = this.config.target;
|
|
4998
|
-
}
|
|
4999
|
-
this.initIcons();
|
|
5000
|
-
this.on(CSS_FULLSCREEN_CHANGE, function(isCssfullScreen) {
|
|
5001
|
-
_this.animate(isCssfullScreen);
|
|
5002
|
-
});
|
|
5003
|
-
this.btnClick = this.btnClick.bind(this);
|
|
5004
|
-
this.handleCssFullscreen = this.hook("cssFullscreen_change", this.btnClick, {
|
|
5005
|
-
pre: function pre(e2) {
|
|
5006
|
-
e2.preventDefault();
|
|
5007
|
-
e2.stopPropagation();
|
|
5008
|
-
}
|
|
5009
|
-
});
|
|
5010
|
-
this.bind(["click", "touchend"], this.handleCssFullscreen);
|
|
5011
|
-
}
|
|
5012
|
-
}, {
|
|
5013
|
-
key: "initIcons",
|
|
5014
|
-
value: function initIcons() {
|
|
5015
|
-
var icons = this.icons;
|
|
5016
|
-
var contentIcon = this.find(".xgplayer-icon");
|
|
5017
|
-
contentIcon.appendChild(icons.cssFullscreen);
|
|
5018
|
-
contentIcon.appendChild(icons.exitCssFullscreen);
|
|
5019
|
-
}
|
|
5020
|
-
}, {
|
|
5021
|
-
key: "btnClick",
|
|
5022
|
-
value: function btnClick(e2) {
|
|
5023
|
-
e2.preventDefault();
|
|
5024
|
-
e2.stopPropagation();
|
|
5025
|
-
var isCssfullScreen = this.player.isCssfullScreen;
|
|
5026
|
-
this.emitUserAction(e2, "switch_cssfullscreen", {
|
|
5027
|
-
cssfullscreen: isCssfullScreen
|
|
5028
|
-
});
|
|
5029
|
-
if (!isCssfullScreen) {
|
|
5030
|
-
this.player.getCssFullscreen();
|
|
5031
|
-
} else {
|
|
5032
|
-
this.player.exitCssFullscreen();
|
|
5033
|
-
}
|
|
5034
|
-
}
|
|
5035
|
-
}, {
|
|
5036
|
-
key: "animate",
|
|
5037
|
-
value: function animate(isFullScreen) {
|
|
5038
|
-
if (!this.root) {
|
|
5039
|
-
return;
|
|
5040
|
-
}
|
|
5041
|
-
isFullScreen ? this.setAttr("data-state", "full") : this.setAttr("data-state", "normal");
|
|
5042
|
-
this.switchTips(isFullScreen);
|
|
5043
|
-
}
|
|
5044
|
-
}, {
|
|
5045
|
-
key: "switchTips",
|
|
5046
|
-
value: function switchTips(isFullScreen) {
|
|
5047
|
-
var i18nKeys = this.i18nKeys;
|
|
5048
|
-
var tipDom = this.find(".xg-tips");
|
|
5049
|
-
tipDom && this.changeLangTextKey(tipDom, isFullScreen ? i18nKeys.EXITCSSFULLSCREEN_TIPS : i18nKeys.CSSFULLSCREEN_TIPS);
|
|
5050
|
-
}
|
|
5051
|
-
}, {
|
|
5052
|
-
key: "registerIcons",
|
|
5053
|
-
value: function registerIcons() {
|
|
5054
|
-
return {
|
|
5055
|
-
cssFullscreen: {
|
|
5056
|
-
icon: CssFullSceenSvg,
|
|
5057
|
-
class: "xg-get-cssfull"
|
|
5058
|
-
},
|
|
5059
|
-
exitCssFullscreen: {
|
|
5060
|
-
icon: ExitCssFullSceenSvg,
|
|
5061
|
-
class: "xg-exit-cssfull"
|
|
5062
|
-
}
|
|
5063
|
-
};
|
|
5064
|
-
}
|
|
5065
|
-
}, {
|
|
5066
|
-
key: "destroy",
|
|
5067
|
-
value: function destroy() {
|
|
5068
|
-
_get(_getPrototypeOf(CssFullScreen2.prototype), "destroy", this).call(this);
|
|
5069
|
-
this.unbind(["click", "touchend"], this.btnClick);
|
|
5070
|
-
}
|
|
5071
|
-
}, {
|
|
5072
|
-
key: "render",
|
|
5073
|
-
value: function render() {
|
|
5074
|
-
if (this.config.disable) {
|
|
5075
|
-
return;
|
|
5076
|
-
}
|
|
5077
|
-
return `<xg-icon class='xgplayer-cssfullscreen'>
|
|
5078
|
-
<div class="xgplayer-icon">
|
|
5079
|
-
</div>
|
|
5080
|
-
`.concat(xgIconTips(this, "CSSFULLSCREEN_TIPS", this.playerConfig.isHideTips), "\n </xg-icon>");
|
|
5081
|
-
}
|
|
5082
|
-
}], [{
|
|
5083
|
-
key: "pluginName",
|
|
5084
|
-
get: function get() {
|
|
5085
|
-
return "cssFullscreen";
|
|
5086
|
-
}
|
|
5087
|
-
}, {
|
|
5088
|
-
key: "defaultConfig",
|
|
5089
|
-
get: function get() {
|
|
5090
|
-
return {
|
|
5091
|
-
position: POSITIONS.CONTROLS_RIGHT,
|
|
5092
|
-
index: 1,
|
|
5093
|
-
disable: false,
|
|
5094
|
-
target: null
|
|
5095
|
-
};
|
|
5096
|
-
}
|
|
5097
|
-
}]);
|
|
5098
|
-
return CssFullScreen2;
|
|
5099
|
-
}(Icon);
|
|
5100
5113
|
function _typeof(obj) {
|
|
5101
5114
|
"@babel/helpers - typeof";
|
|
5102
5115
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
@@ -5466,6 +5479,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5466
5479
|
}, {
|
|
5467
5480
|
key: "shouldBlockVideoContent",
|
|
5468
5481
|
get: function get() {
|
|
5482
|
+
if (sniffer.os.isTizen || sniffer.os.isWebOS) {
|
|
5483
|
+
return false;
|
|
5484
|
+
}
|
|
5469
5485
|
return this.isLinearAdRunning || this._shouldBlockVideoContent;
|
|
5470
5486
|
},
|
|
5471
5487
|
set: function set(flag) {
|
|
@@ -5628,12 +5644,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5628
5644
|
break;
|
|
5629
5645
|
}
|
|
5630
5646
|
case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED: {
|
|
5631
|
-
if (_this._resumeCallback) {
|
|
5632
|
-
var _this$_resumeCallback = _this._resumeCallback(), canResume = _this$_resumeCallback.canResume;
|
|
5633
|
-
if (!canResume) {
|
|
5634
|
-
break;
|
|
5635
|
-
}
|
|
5636
|
-
}
|
|
5637
5647
|
_this._resumeContent();
|
|
5638
5648
|
_this.emit(IMA_CONTENT_RESUME_REQUESTED, {
|
|
5639
5649
|
ad
|
|
@@ -5659,8 +5669,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5659
5669
|
_this.plugin.emit(AD_PLAY, {
|
|
5660
5670
|
ad
|
|
5661
5671
|
});
|
|
5662
|
-
intervalTimer = setInterval(function() {
|
|
5663
|
-
}, 300);
|
|
5664
5672
|
}
|
|
5665
5673
|
break;
|
|
5666
5674
|
}
|
|
@@ -5737,7 +5745,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5737
5745
|
_this.displayContainer = null;
|
|
5738
5746
|
_this.adsLoader = null;
|
|
5739
5747
|
_this.adsManager = null;
|
|
5740
|
-
_this._resumeCallback = null;
|
|
5741
5748
|
return _this;
|
|
5742
5749
|
}
|
|
5743
5750
|
_createClass$2(ImaAdManager2, [{
|
|
@@ -5786,15 +5793,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5786
5793
|
value: function destroy() {
|
|
5787
5794
|
_get$1(_getPrototypeOf$1(ImaAdManager2.prototype), "destroy", this).call(this);
|
|
5788
5795
|
this.reset();
|
|
5789
|
-
this.displayContainer.destroy();
|
|
5790
5796
|
this._removeMediaEvents();
|
|
5791
5797
|
this._destroyLoader();
|
|
5792
5798
|
}
|
|
5793
|
-
}, {
|
|
5794
|
-
key: "resumeCallback",
|
|
5795
|
-
set: function set(resumeCallbackFunc) {
|
|
5796
|
-
this._resumeCallback = resumeCallbackFunc;
|
|
5797
|
-
}
|
|
5798
5799
|
}, {
|
|
5799
5800
|
key: "_initConfig",
|
|
5800
5801
|
value: function _initConfig() {
|
|
@@ -6027,27 +6028,28 @@ var __publicField = (obj, key, value) => {
|
|
|
6027
6028
|
key: "_checkAutoplaySupport",
|
|
6028
6029
|
value: function() {
|
|
6029
6030
|
var _checkAutoplaySupport2 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee3() {
|
|
6030
|
-
var autoplay, timeout, _yield$Promise$all, _yield$Promise$all2, autoplayAllowed, autoplayMutedAllowed;
|
|
6031
|
+
var autoplay, timeout, isKnownAutoplayPlatform, _yield$Promise$all, _yield$Promise$all2, autoplayAllowed, autoplayMutedAllowed;
|
|
6031
6032
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
6032
6033
|
while (1)
|
|
6033
6034
|
switch (_context3.prev = _context3.next) {
|
|
6034
6035
|
case 0:
|
|
6035
6036
|
autoplay = this.player.config.autoplay;
|
|
6036
6037
|
timeout = 800;
|
|
6037
|
-
|
|
6038
|
-
|
|
6038
|
+
isKnownAutoplayPlatform = sniffer.os.isTizen || sniffer.os.isWebOS;
|
|
6039
|
+
_context3.next = 5;
|
|
6040
|
+
return Promise.all([autoplay ? isKnownAutoplayPlatform || index.video({
|
|
6039
6041
|
timeout
|
|
6040
6042
|
}).then(function(_ref3) {
|
|
6041
6043
|
var result = _ref3.result;
|
|
6042
6044
|
return result;
|
|
6043
|
-
}) : Promise.resolve(false), autoplay && this.player.config.autoplayMuted ? index.video({
|
|
6045
|
+
}) : Promise.resolve(false), autoplay && this.player.config.autoplayMuted ? isKnownAutoplayPlatform || index.video({
|
|
6044
6046
|
timeout,
|
|
6045
6047
|
muted: true
|
|
6046
6048
|
}).then(function(_ref4) {
|
|
6047
6049
|
var result = _ref4.result;
|
|
6048
6050
|
return result;
|
|
6049
6051
|
}) : Promise.resolve(false)]);
|
|
6050
|
-
case
|
|
6052
|
+
case 5:
|
|
6051
6053
|
_yield$Promise$all = _context3.sent;
|
|
6052
6054
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
6053
6055
|
autoplayAllowed = _yield$Promise$all2[0];
|
|
@@ -6055,7 +6057,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6055
6057
|
this.autoplayAllowed = autoplayAllowed || autoplayMutedAllowed;
|
|
6056
6058
|
this.autoplayRequiresMuted = !autoplayAllowed && autoplayMutedAllowed;
|
|
6057
6059
|
logger$1.log("checkAutoplaySupport", this.autoplayAllowed, this.autoplayRequiresMuted);
|
|
6058
|
-
case
|
|
6060
|
+
case 12:
|
|
6059
6061
|
case "end":
|
|
6060
6062
|
return _context3.stop();
|
|
6061
6063
|
}
|
|
@@ -6246,9 +6248,15 @@ var __publicField = (obj, key, value) => {
|
|
|
6246
6248
|
if (targetPlugin) {
|
|
6247
6249
|
var newDecoratorPlugin = null;
|
|
6248
6250
|
if (decoratorClass && !player.getPlugin(decoratorClass.pluginName)) {
|
|
6251
|
+
var _newDecoratorPlugin$e;
|
|
6249
6252
|
player.registerPlugin(decoratorClass);
|
|
6250
6253
|
newDecoratorPlugin = player.getPlugin(decoratorClass.pluginName);
|
|
6251
6254
|
fragment.appendChild(newDecoratorPlugin.root);
|
|
6255
|
+
if ((_newDecoratorPlugin$e = newDecoratorPlugin.extraEls) !== null && _newDecoratorPlugin$e !== void 0 && _newDecoratorPlugin$e.length) {
|
|
6256
|
+
newDecoratorPlugin.extraEls.forEach(function(el) {
|
|
6257
|
+
fragment.appendChild(el);
|
|
6258
|
+
});
|
|
6259
|
+
}
|
|
6252
6260
|
}
|
|
6253
6261
|
adUIPlugins.push([targetPlugin, newDecoratorPlugin]);
|
|
6254
6262
|
}
|
|
@@ -6316,11 +6324,23 @@ var __publicField = (obj, key, value) => {
|
|
|
6316
6324
|
if (!overrideAdPlugin) {
|
|
6317
6325
|
return;
|
|
6318
6326
|
}
|
|
6319
|
-
var adRoot = overrideAdPlugin.root;
|
|
6320
|
-
var normalRoot = normalPlugin.root;
|
|
6327
|
+
var adRoot = overrideAdPlugin.root, adExtraEls = overrideAdPlugin.extraEls;
|
|
6328
|
+
var normalRoot = normalPlugin.root, normalExtraEls = normalPlugin.extraEls;
|
|
6321
6329
|
if (fragmentContainer.contains(adRoot)) {
|
|
6322
6330
|
fragmentContainer.removeChild(adRoot);
|
|
6323
6331
|
}
|
|
6332
|
+
if (Array.isArray(adExtraEls) && adExtraEls.length) {
|
|
6333
|
+
adExtraEls.forEach(function(adEl, index2) {
|
|
6334
|
+
if (fragmentContainer.contains(adEl)) {
|
|
6335
|
+
fragmentContainer.removeChild(adEl);
|
|
6336
|
+
}
|
|
6337
|
+
var normalEl = normalExtraEls === null || normalExtraEls === void 0 ? void 0 : normalExtraEls[index2];
|
|
6338
|
+
if (normalEl !== null && normalEl !== void 0 && normalEl.parentNode) {
|
|
6339
|
+
normalEl.parentNode.insertBefore(adEl, normalEl);
|
|
6340
|
+
fragmentContainer.appendChild(normalEl);
|
|
6341
|
+
}
|
|
6342
|
+
});
|
|
6343
|
+
}
|
|
6324
6344
|
normalRoot.parentNode.insertBefore(adRoot, normalRoot);
|
|
6325
6345
|
fragmentContainer.appendChild(normalRoot);
|
|
6326
6346
|
});
|
|
@@ -6355,8 +6375,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6355
6375
|
if (!overrideAdPlugin) {
|
|
6356
6376
|
return;
|
|
6357
6377
|
}
|
|
6358
|
-
var adRoot = overrideAdPlugin.root;
|
|
6359
|
-
var normalRoot = normalPlugin.root;
|
|
6378
|
+
var adRoot = overrideAdPlugin.root, adExtraEl = overrideAdPlugin.extraEls;
|
|
6379
|
+
var normalRoot = normalPlugin.root, normalExtraEl = normalPlugin.extraEls;
|
|
6360
6380
|
if (fragmentContainer.contains(normalRoot)) {
|
|
6361
6381
|
fragmentContainer.removeChild(normalRoot);
|
|
6362
6382
|
}
|
|
@@ -6364,6 +6384,18 @@ var __publicField = (obj, key, value) => {
|
|
|
6364
6384
|
adRoot.parentNode.insertBefore(normalRoot, adRoot);
|
|
6365
6385
|
fragmentContainer.appendChild(adRoot);
|
|
6366
6386
|
}
|
|
6387
|
+
if (Array.isArray(normalExtraEl) && normalExtraEl !== null && normalExtraEl !== void 0 && normalExtraEl.length) {
|
|
6388
|
+
normalExtraEl.forEach(function(normalEl, index2) {
|
|
6389
|
+
if (fragmentContainer.contains(normalEl)) {
|
|
6390
|
+
fragmentContainer.removeChild(normalEl);
|
|
6391
|
+
}
|
|
6392
|
+
var adEl = adExtraEl === null || adExtraEl === void 0 ? void 0 : adExtraEl[index2];
|
|
6393
|
+
if (adEl && adEl.parentNode) {
|
|
6394
|
+
adEl.parentNode.insertBefore(normalEl, adEl);
|
|
6395
|
+
fragmentContainer.appendChild(adEl);
|
|
6396
|
+
}
|
|
6397
|
+
});
|
|
6398
|
+
}
|
|
6367
6399
|
});
|
|
6368
6400
|
var otherPlugins = this._getNonAdPlugin();
|
|
6369
6401
|
otherPlugins.filter(function(plugin2) {
|
|
@@ -6471,7 +6503,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6471
6503
|
_createClass$2(AdsPlugin2, [{
|
|
6472
6504
|
key: "version",
|
|
6473
6505
|
get: function get() {
|
|
6474
|
-
return "3.0.
|
|
6506
|
+
return "3.0.23-rc.1";
|
|
6475
6507
|
}
|
|
6476
6508
|
}, {
|
|
6477
6509
|
key: "paused",
|
|
@@ -6533,55 +6565,37 @@ var __publicField = (obj, key, value) => {
|
|
|
6533
6565
|
}
|
|
6534
6566
|
}, {
|
|
6535
6567
|
key: "_initImaAd",
|
|
6536
|
-
value: function() {
|
|
6537
|
-
var
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
this.csManager.on(IMA_CONTENT_RESUME_REQUESTED, function() {
|
|
6568
|
-
_this.uiManager.hideAdUI();
|
|
6569
|
-
});
|
|
6570
|
-
_context.next = 9;
|
|
6571
|
-
return this.csManager.init();
|
|
6572
|
-
case 9:
|
|
6573
|
-
return _context.abrupt("return", this.csManager);
|
|
6574
|
-
case 10:
|
|
6575
|
-
case "end":
|
|
6576
|
-
return _context.stop();
|
|
6577
|
-
}
|
|
6578
|
-
}, _callee, this);
|
|
6579
|
-
}));
|
|
6580
|
-
function _initImaAd() {
|
|
6581
|
-
return _initImaAd2.apply(this, arguments);
|
|
6582
|
-
}
|
|
6583
|
-
return _initImaAd;
|
|
6584
|
-
}()
|
|
6568
|
+
value: function _initImaAd() {
|
|
6569
|
+
var _this = this;
|
|
6570
|
+
this.csManager = new ImaAdManager({
|
|
6571
|
+
plugin: this,
|
|
6572
|
+
config: this.config.ima,
|
|
6573
|
+
displayContainer: this.root
|
|
6574
|
+
});
|
|
6575
|
+
this.csManager.once(IMA_SDK_LOAD_START, function() {
|
|
6576
|
+
_this.uiManager.showAdContainer();
|
|
6577
|
+
});
|
|
6578
|
+
this.csManager.on(IMA_SDK_LOAD_ERROR, function() {
|
|
6579
|
+
_this.uiManager.hideAdContainer();
|
|
6580
|
+
});
|
|
6581
|
+
this.csManager.once(IMA_AD_LOADED, function(_ref) {
|
|
6582
|
+
var isPreroll = _ref.isPreroll;
|
|
6583
|
+
if (!isPreroll) {
|
|
6584
|
+
_this.uiManager.hideAdContainer();
|
|
6585
|
+
}
|
|
6586
|
+
});
|
|
6587
|
+
this.csManager.once(IMA_READY_TO_PLAY, function() {
|
|
6588
|
+
var _this$initPromise;
|
|
6589
|
+
(_this$initPromise = _this.initPromise) === null || _this$initPromise === void 0 ? void 0 : _this$initPromise.resolve();
|
|
6590
|
+
});
|
|
6591
|
+
this.csManager.on(IMA_CONTENT_PAUSE_REQUESTED, function() {
|
|
6592
|
+
_this.uiManager.showAdUI();
|
|
6593
|
+
});
|
|
6594
|
+
this.csManager.on(IMA_CONTENT_RESUME_REQUESTED, function() {
|
|
6595
|
+
_this.uiManager.hideAdUI();
|
|
6596
|
+
});
|
|
6597
|
+
this.csManager.init();
|
|
6598
|
+
}
|
|
6585
6599
|
}, {
|
|
6586
6600
|
key: "requestAds",
|
|
6587
6601
|
value: function requestAds() {
|