@volcengine/veplayer 2.12.0-rc.1 → 2.12.0-rc.2
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/veplayer.biz.live.development.js +16 -2
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +2 -1
- package/esm/veplayer.development.js +163 -138
- package/esm/veplayer.live.d.ts +2 -1
- package/esm/veplayer.live.development.js +163 -138
- package/esm/veplayer.live.production.js +3 -3
- package/esm/veplayer.production.js +3 -3
- package/esm/veplayer.vod.development.js +145 -134
- package/esm/veplayer.vod.production.js +2 -2
- package/package.json +1 -1
- package/umd/veplayer.biz.live.development.js +16 -2
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.d.ts +2 -1
- package/umd/veplayer.development.js +163 -138
- package/umd/veplayer.live.d.ts +2 -1
- package/umd/veplayer.live.development.js +163 -138
- package/umd/veplayer.live.production.js +1 -1
- package/umd/veplayer.production.js +1 -1
- package/umd/veplayer.vod.development.js +145 -134
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +2 -1
- package/veplayer.live.d.ts +2 -1
|
@@ -1456,7 +1456,7 @@ var sniffer = {
|
|
|
1456
1456
|
}
|
|
1457
1457
|
}
|
|
1458
1458
|
};
|
|
1459
|
-
var version = "3.0.24-rc.
|
|
1459
|
+
var version = "3.0.24-rc.6";
|
|
1460
1460
|
var ERROR_TYPE_MAP = {
|
|
1461
1461
|
1: "media",
|
|
1462
1462
|
2: "media",
|
|
@@ -4537,6 +4537,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4537
4537
|
_inherits(Player2, _MediaProxy);
|
|
4538
4538
|
var _super = _createSuper(Player2);
|
|
4539
4539
|
function Player2(options) {
|
|
4540
|
+
var _this$onReady, _this2;
|
|
4540
4541
|
var _this;
|
|
4541
4542
|
_classCallCheck(this, Player2);
|
|
4542
4543
|
var _config = util.deepMerge(getDefaultConfig$1(), options);
|
|
@@ -4705,16 +4706,18 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4705
4706
|
return _possibleConstructorReturn(_this);
|
|
4706
4707
|
}
|
|
4707
4708
|
var _this$config2 = _this.config, _this$config2$definit = _this$config2.definition, definition = _this$config2$definit === void 0 ? {} : _this$config2$definit, url = _this$config2.url;
|
|
4708
|
-
if (
|
|
4709
|
-
var
|
|
4709
|
+
if (Array.isArray(definition === null || definition === void 0 ? void 0 : definition.list) && definition.list.length > 0) {
|
|
4710
|
+
var curDefinition = definition.list.find(function(e) {
|
|
4710
4711
|
return e.definition && e.definition === definition.defaultDefinition;
|
|
4711
4712
|
});
|
|
4712
|
-
if (!
|
|
4713
|
+
if (!curDefinition) {
|
|
4713
4714
|
definition.defaultDefinition = definition.list[0].definition;
|
|
4714
|
-
|
|
4715
|
+
curDefinition = definition.list[0];
|
|
4716
|
+
}
|
|
4717
|
+
_this.curDefinition = curDefinition;
|
|
4718
|
+
if (!url) {
|
|
4719
|
+
_this.config.url = curDefinition.url;
|
|
4715
4720
|
}
|
|
4716
|
-
_this.config.url = defaultDefinitionObj.url;
|
|
4717
|
-
_this.curDefinition = defaultDefinitionObj;
|
|
4718
4721
|
}
|
|
4719
4722
|
_this._bindEvents();
|
|
4720
4723
|
_this._registerPresets();
|
|
@@ -4725,7 +4728,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4725
4728
|
util.setTimeout(_assertThisInitialized(_this), function() {
|
|
4726
4729
|
_this.emit(READY);
|
|
4727
4730
|
}, 0);
|
|
4728
|
-
_this.onReady
|
|
4731
|
+
(_this$onReady = (_this2 = _this).onReady) === null || _this$onReady === void 0 ? void 0 : _this$onReady.call(_this2);
|
|
4729
4732
|
if (_this.config.videoInit || _this.config.autoplay) {
|
|
4730
4733
|
if (!_this.hasStart || _this.state < STATES.ATTACHED) {
|
|
4731
4734
|
_this.start();
|
|
@@ -4736,7 +4739,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4736
4739
|
_createClass(Player2, [{
|
|
4737
4740
|
key: "_initDOM",
|
|
4738
4741
|
value: function _initDOM() {
|
|
4739
|
-
var _instManager,
|
|
4742
|
+
var _instManager, _this3 = this;
|
|
4740
4743
|
this.root = this.config.id ? document.getElementById(this.config.id) : null;
|
|
4741
4744
|
if (!this.root) {
|
|
4742
4745
|
var el = this.config.el;
|
|
@@ -4789,15 +4792,15 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4789
4792
|
"padding-top": "".concat(_height * 100 / _width, "%")
|
|
4790
4793
|
};
|
|
4791
4794
|
Object.keys(style).forEach(function(key) {
|
|
4792
|
-
|
|
4795
|
+
_this3.root.style[key] = style[key];
|
|
4793
4796
|
});
|
|
4794
4797
|
} else {
|
|
4795
4798
|
["width", "height"].forEach(function(key) {
|
|
4796
|
-
if (
|
|
4797
|
-
if (typeof
|
|
4798
|
-
|
|
4799
|
+
if (_this3.config[key]) {
|
|
4800
|
+
if (typeof _this3.config[key] !== "number") {
|
|
4801
|
+
_this3.root.style[key] = _this3.config[key];
|
|
4799
4802
|
} else {
|
|
4800
|
-
|
|
4803
|
+
_this3.root.style[key] = "".concat(_this3.config[key], "px");
|
|
4801
4804
|
}
|
|
4802
4805
|
}
|
|
4803
4806
|
});
|
|
@@ -4825,12 +4828,12 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4825
4828
|
}, {
|
|
4826
4829
|
key: "_bindEvents",
|
|
4827
4830
|
value: function _bindEvents() {
|
|
4828
|
-
var
|
|
4831
|
+
var _this4 = this;
|
|
4829
4832
|
["focus", "blur"].forEach(function(item) {
|
|
4830
|
-
|
|
4833
|
+
_this4.on(item, _this4["on" + item.charAt(0).toUpperCase() + item.slice(1)]);
|
|
4831
4834
|
});
|
|
4832
4835
|
FULLSCREEN_EVENTS.forEach(function(item) {
|
|
4833
|
-
document && document.addEventListener(item,
|
|
4836
|
+
document && document.addEventListener(item, _this4.onFullscreenChange);
|
|
4834
4837
|
});
|
|
4835
4838
|
if (sniffer.os.isIos) {
|
|
4836
4839
|
this.media.addEventListener("webkitbeginfullscreen", this._onWebkitbeginfullscreen);
|
|
@@ -4838,8 +4841,8 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4838
4841
|
}
|
|
4839
4842
|
this.once(LOADED_DATA, this.resize);
|
|
4840
4843
|
this.playFunc = function() {
|
|
4841
|
-
if (!
|
|
4842
|
-
|
|
4844
|
+
if (!_this4.config.closeFocusVideoFocus) {
|
|
4845
|
+
_this4.media.focus();
|
|
4843
4846
|
}
|
|
4844
4847
|
};
|
|
4845
4848
|
this.once(PLAY, this.playFunc);
|
|
@@ -4847,10 +4850,10 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4847
4850
|
}, {
|
|
4848
4851
|
key: "_unbindEvents",
|
|
4849
4852
|
value: function _unbindEvents() {
|
|
4850
|
-
var
|
|
4853
|
+
var _this5 = this;
|
|
4851
4854
|
this.root.removeEventListener("mousemove", this.mousemoveFunc);
|
|
4852
4855
|
FULLSCREEN_EVENTS.forEach(function(item) {
|
|
4853
|
-
document.removeEventListener(item,
|
|
4856
|
+
document.removeEventListener(item, _this5.onFullscreenChange);
|
|
4854
4857
|
});
|
|
4855
4858
|
this.playFunc && this.off(PLAY, this.playFunc);
|
|
4856
4859
|
this.off(CANPLAY, this.canPlayFunc);
|
|
@@ -4869,7 +4872,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4869
4872
|
}, {
|
|
4870
4873
|
key: "_startInit",
|
|
4871
4874
|
value: function _startInit(url) {
|
|
4872
|
-
var
|
|
4875
|
+
var _this6 = this;
|
|
4873
4876
|
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
4874
4877
|
if (!this.media) {
|
|
4875
4878
|
return;
|
|
@@ -4922,13 +4925,13 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4922
4925
|
this.hasStart = true;
|
|
4923
4926
|
this.setState(STATES.ATTACHED);
|
|
4924
4927
|
util.setTimeout(this, function() {
|
|
4925
|
-
|
|
4928
|
+
_this6.emit(COMPLETE);
|
|
4926
4929
|
}, 0);
|
|
4927
4930
|
}
|
|
4928
4931
|
}, {
|
|
4929
4932
|
key: "_registerPlugins",
|
|
4930
4933
|
value: function _registerPlugins() {
|
|
4931
|
-
var
|
|
4934
|
+
var _this7 = this;
|
|
4932
4935
|
var isInit = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
4933
4936
|
this._loadingPlugins = [];
|
|
4934
4937
|
var ignores = this.config.ignores || [];
|
|
@@ -4947,19 +4950,19 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4947
4950
|
return;
|
|
4948
4951
|
}
|
|
4949
4952
|
if (plugin.lazy && plugin.loader) {
|
|
4950
|
-
var loadingPlugin = pluginsManager.lazyRegister(
|
|
4953
|
+
var loadingPlugin = pluginsManager.lazyRegister(_this7, plugin);
|
|
4951
4954
|
if (plugin.forceBeforeInit) {
|
|
4952
4955
|
loadingPlugin.then(function() {
|
|
4953
|
-
|
|
4956
|
+
_this7._loadingPlugins.splice(_this7._loadingPlugins.indexOf(loadingPlugin), 1);
|
|
4954
4957
|
}).catch(function(e) {
|
|
4955
4958
|
XG_DEBUG.logError("_registerPlugins:loadingPlugin", e);
|
|
4956
|
-
|
|
4959
|
+
_this7._loadingPlugins.splice(_this7._loadingPlugins.indexOf(loadingPlugin), 1);
|
|
4957
4960
|
});
|
|
4958
|
-
|
|
4961
|
+
_this7._loadingPlugins.push(loadingPlugin);
|
|
4959
4962
|
}
|
|
4960
4963
|
return;
|
|
4961
4964
|
}
|
|
4962
|
-
return
|
|
4965
|
+
return _this7.registerPlugin(plugin);
|
|
4963
4966
|
} catch (err) {
|
|
4964
4967
|
XG_DEBUG.logError("_registerPlugins:", err);
|
|
4965
4968
|
}
|
|
@@ -4968,9 +4971,9 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4968
4971
|
}, {
|
|
4969
4972
|
key: "_registerPresets",
|
|
4970
4973
|
value: function _registerPresets() {
|
|
4971
|
-
var
|
|
4974
|
+
var _this8 = this;
|
|
4972
4975
|
this.config.presets.forEach(function(preset) {
|
|
4973
|
-
usePreset(
|
|
4976
|
+
usePreset(_this8, preset);
|
|
4974
4977
|
});
|
|
4975
4978
|
}
|
|
4976
4979
|
}, {
|
|
@@ -5120,7 +5123,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5120
5123
|
}, {
|
|
5121
5124
|
key: "start",
|
|
5122
5125
|
value: function start(url) {
|
|
5123
|
-
var
|
|
5126
|
+
var _this9 = this;
|
|
5124
5127
|
if (this.state > STATES.ATTACHING) {
|
|
5125
5128
|
return;
|
|
5126
5129
|
}
|
|
@@ -5135,14 +5138,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5135
5138
|
this.setState(STATES.ATTACHING);
|
|
5136
5139
|
this._registerPlugins(false);
|
|
5137
5140
|
return pluginsManager.beforeInit(this).then(function() {
|
|
5138
|
-
if (!
|
|
5141
|
+
if (!_this9.config) {
|
|
5139
5142
|
return;
|
|
5140
5143
|
}
|
|
5141
5144
|
if (!url) {
|
|
5142
|
-
url =
|
|
5145
|
+
url = _this9.url || _this9.config.url;
|
|
5143
5146
|
}
|
|
5144
|
-
var _furl =
|
|
5145
|
-
var ret =
|
|
5147
|
+
var _furl = _this9.preProcessUrl(url);
|
|
5148
|
+
var ret = _this9._startInit(_furl.url, {
|
|
5146
5149
|
playSessionId
|
|
5147
5150
|
});
|
|
5148
5151
|
return ret;
|
|
@@ -5156,7 +5159,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5156
5159
|
}, {
|
|
5157
5160
|
key: "switchURL",
|
|
5158
5161
|
value: function switchURL(url, options) {
|
|
5159
|
-
var
|
|
5162
|
+
var _this10 = this;
|
|
5160
5163
|
var _src = url;
|
|
5161
5164
|
if (util.typeOf(url) === "Object") {
|
|
5162
5165
|
_src = url.url;
|
|
@@ -5168,32 +5171,32 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5168
5171
|
this.src = _src;
|
|
5169
5172
|
return new Promise(function(resolve, reject) {
|
|
5170
5173
|
var _error = function _error2(e) {
|
|
5171
|
-
|
|
5172
|
-
|
|
5174
|
+
_this10.off("timeupdate", _canplay);
|
|
5175
|
+
_this10.off("canplay", _canplay);
|
|
5173
5176
|
reject(e);
|
|
5174
5177
|
};
|
|
5175
5178
|
var _canplay = function _canplay2() {
|
|
5176
|
-
|
|
5179
|
+
_this10._seekToStartTime();
|
|
5177
5180
|
if (isPaused) {
|
|
5178
|
-
|
|
5181
|
+
_this10.pause();
|
|
5179
5182
|
}
|
|
5180
|
-
|
|
5183
|
+
_this10.off("error", _error);
|
|
5181
5184
|
resolve(true);
|
|
5182
5185
|
};
|
|
5183
|
-
|
|
5186
|
+
_this10.once("error", _error);
|
|
5184
5187
|
if (!_src) {
|
|
5185
|
-
|
|
5188
|
+
_this10.errorHandler("error", {
|
|
5186
5189
|
code: 6,
|
|
5187
5190
|
message: "empty_src"
|
|
5188
5191
|
});
|
|
5189
5192
|
return;
|
|
5190
5193
|
}
|
|
5191
5194
|
if (sniffer.os.isAndroid) {
|
|
5192
|
-
|
|
5195
|
+
_this10.once("timeupdate", _canplay);
|
|
5193
5196
|
} else {
|
|
5194
|
-
|
|
5197
|
+
_this10.once("canplay", _canplay);
|
|
5195
5198
|
}
|
|
5196
|
-
|
|
5199
|
+
_this10.play();
|
|
5197
5200
|
});
|
|
5198
5201
|
}
|
|
5199
5202
|
}, {
|
|
@@ -5204,7 +5207,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5204
5207
|
}, {
|
|
5205
5208
|
key: "mediaPlay",
|
|
5206
5209
|
value: function mediaPlay() {
|
|
5207
|
-
var
|
|
5210
|
+
var _this11 = this;
|
|
5208
5211
|
if (!this.hasStart && this.state < STATES.ATTACHED) {
|
|
5209
5212
|
this.removeClass(STATE_CLASS.NO_START);
|
|
5210
5213
|
this.addClass(STATE_CLASS.ENTER);
|
|
@@ -5219,28 +5222,28 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5219
5222
|
var playPromise = _get(_getPrototypeOf(Player2.prototype), "play", this).call(this);
|
|
5220
5223
|
if (playPromise !== void 0 && playPromise && playPromise.then) {
|
|
5221
5224
|
playPromise.then(function() {
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
if (
|
|
5225
|
+
_this11.removeClass(STATE_CLASS.NOT_ALLOW_AUTOPLAY);
|
|
5226
|
+
_this11.addClass(STATE_CLASS.PLAYING);
|
|
5227
|
+
if (_this11.state < STATES.RUNNING) {
|
|
5225
5228
|
XG_DEBUG.logInfo(">>>>playPromise.then");
|
|
5226
|
-
|
|
5227
|
-
|
|
5229
|
+
_this11.setState(STATES.RUNNING);
|
|
5230
|
+
_this11.emit(AUTOPLAY_STARTED);
|
|
5228
5231
|
}
|
|
5229
5232
|
}).catch(function(e) {
|
|
5230
5233
|
XG_DEBUG.logWarn(">>>>playPromise.catch", e.name);
|
|
5231
|
-
if (
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
+
if (_this11.media && _this11.media.error) {
|
|
5235
|
+
_this11.onError();
|
|
5236
|
+
_this11.removeClass(STATE_CLASS.ENTER);
|
|
5234
5237
|
return;
|
|
5235
5238
|
}
|
|
5236
5239
|
if (e.name === "NotAllowedError") {
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5240
|
+
_this11._errorTimer = util.setTimeout(_this11, function() {
|
|
5241
|
+
_this11._errorTimer = null;
|
|
5242
|
+
_this11.emit(AUTOPLAY_PREVENTED);
|
|
5243
|
+
_this11.addClass(STATE_CLASS.NOT_ALLOW_AUTOPLAY);
|
|
5244
|
+
_this11.removeClass(STATE_CLASS.ENTER);
|
|
5245
|
+
_this11.pause();
|
|
5246
|
+
_this11.setState(STATES.NOTALLOW);
|
|
5244
5247
|
}, 0);
|
|
5245
5248
|
}
|
|
5246
5249
|
});
|
|
@@ -5270,24 +5273,24 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5270
5273
|
}, {
|
|
5271
5274
|
key: "play",
|
|
5272
5275
|
value: function play() {
|
|
5273
|
-
var
|
|
5276
|
+
var _this12 = this;
|
|
5274
5277
|
this.removeClass(STATE_CLASS.PAUSED);
|
|
5275
5278
|
return runHooks(this, "play", function() {
|
|
5276
|
-
return
|
|
5279
|
+
return _this12.mediaPlay();
|
|
5277
5280
|
});
|
|
5278
5281
|
}
|
|
5279
5282
|
}, {
|
|
5280
5283
|
key: "pause",
|
|
5281
5284
|
value: function pause() {
|
|
5282
|
-
var
|
|
5285
|
+
var _this13 = this;
|
|
5283
5286
|
runHooks(this, "pause", function() {
|
|
5284
|
-
_get(_getPrototypeOf(Player2.prototype), "pause",
|
|
5287
|
+
_get(_getPrototypeOf(Player2.prototype), "pause", _this13).call(_this13);
|
|
5285
5288
|
});
|
|
5286
5289
|
}
|
|
5287
5290
|
}, {
|
|
5288
5291
|
key: "seek",
|
|
5289
5292
|
value: function seek(time, status) {
|
|
5290
|
-
var
|
|
5293
|
+
var _this14 = this;
|
|
5291
5294
|
if (!this.media || Number.isNaN(Number(time)) || !this.hasStart) {
|
|
5292
5295
|
return;
|
|
5293
5296
|
}
|
|
@@ -5297,20 +5300,20 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5297
5300
|
!this._isPauseBeforeSeek && (this._isPauseBeforeSeek = this.paused ? 2 : 1);
|
|
5298
5301
|
this._onceSeekCanplay && this.off(SEEKED, this._onceSeekCanplay);
|
|
5299
5302
|
this._onceSeekCanplay = function() {
|
|
5300
|
-
|
|
5301
|
-
|
|
5303
|
+
_this14.removeClass(STATE_CLASS.ENTER);
|
|
5304
|
+
_this14.isSeeking = false;
|
|
5302
5305
|
switch (_status) {
|
|
5303
5306
|
case "play":
|
|
5304
|
-
|
|
5307
|
+
_this14.play();
|
|
5305
5308
|
break;
|
|
5306
5309
|
case "pause":
|
|
5307
|
-
|
|
5310
|
+
_this14.pause();
|
|
5308
5311
|
break;
|
|
5309
5312
|
default:
|
|
5310
|
-
|
|
5313
|
+
_this14._isPauseBeforeSeek > 1 || _this14.paused ? _this14.pause() : _this14.play();
|
|
5311
5314
|
}
|
|
5312
|
-
|
|
5313
|
-
|
|
5315
|
+
_this14._isPauseBeforeSeek = 0;
|
|
5316
|
+
_this14._onceSeekCanplay = null;
|
|
5314
5317
|
};
|
|
5315
5318
|
this.once(SEEKED, this._onceSeekCanplay);
|
|
5316
5319
|
if (this.state < STATES.RUNNING) {
|
|
@@ -5324,13 +5327,13 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5324
5327
|
}, {
|
|
5325
5328
|
key: "getInitDefinition",
|
|
5326
5329
|
value: function getInitDefinition() {
|
|
5327
|
-
var
|
|
5330
|
+
var _this15 = this;
|
|
5328
5331
|
var _this$config5 = this.config, definition = _this$config5.definition, url = _this$config5.url;
|
|
5329
5332
|
if (!url && definition && definition.list && definition.list.length > 0 && definition.defaultDefinition) {
|
|
5330
5333
|
definition.list.map(function(item) {
|
|
5331
5334
|
if (item.definition === definition.defaultDefinition) {
|
|
5332
|
-
|
|
5333
|
-
|
|
5335
|
+
_this15.config.url = item.url;
|
|
5336
|
+
_this15.curDefinition = item;
|
|
5334
5337
|
}
|
|
5335
5338
|
});
|
|
5336
5339
|
}
|
|
@@ -5338,12 +5341,12 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5338
5341
|
}, {
|
|
5339
5342
|
key: "changeDefinition",
|
|
5340
5343
|
value: function changeDefinition(to, from) {
|
|
5341
|
-
var
|
|
5344
|
+
var _this16 = this;
|
|
5342
5345
|
var definition = this.config.definition;
|
|
5343
5346
|
if (Array.isArray(definition === null || definition === void 0 ? void 0 : definition.list)) {
|
|
5344
5347
|
definition.list.forEach(function(item) {
|
|
5345
5348
|
if ((to === null || to === void 0 ? void 0 : to.definition) === item.definition) {
|
|
5346
|
-
|
|
5349
|
+
_this16.curDefinition = item;
|
|
5347
5350
|
}
|
|
5348
5351
|
});
|
|
5349
5352
|
}
|
|
@@ -5363,7 +5366,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5363
5366
|
}, to));
|
|
5364
5367
|
if (ret && ret.then) {
|
|
5365
5368
|
ret.then(function() {
|
|
5366
|
-
|
|
5369
|
+
_this16.emit(AFTER_DEFINITION_CHANGE, {
|
|
5367
5370
|
from,
|
|
5368
5371
|
to
|
|
5369
5372
|
});
|
|
@@ -5387,7 +5390,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5387
5390
|
}, {
|
|
5388
5391
|
key: "resetState",
|
|
5389
5392
|
value: function resetState() {
|
|
5390
|
-
var
|
|
5393
|
+
var _this17 = this;
|
|
5391
5394
|
var NOT_ALLOW_AUTOPLAY = STATE_CLASS.NOT_ALLOW_AUTOPLAY, PLAYING2 = STATE_CLASS.PLAYING, NO_START = STATE_CLASS.NO_START, PAUSED = STATE_CLASS.PAUSED, REPLAY2 = STATE_CLASS.REPLAY, ENTER = STATE_CLASS.ENTER, ENDED2 = STATE_CLASS.ENDED, ERROR2 = STATE_CLASS.ERROR, LOADING2 = STATE_CLASS.LOADING;
|
|
5392
5395
|
var clsList = [NOT_ALLOW_AUTOPLAY, PLAYING2, NO_START, PAUSED, REPLAY2, ENTER, ENDED2, ERROR2, LOADING2];
|
|
5393
5396
|
this.hasStart = false;
|
|
@@ -5398,7 +5401,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5398
5401
|
this._accPlayed.t = 0;
|
|
5399
5402
|
this._accPlayed.loopAcc = 0;
|
|
5400
5403
|
clsList.forEach(function(cls) {
|
|
5401
|
-
|
|
5404
|
+
_this17.removeClass(cls);
|
|
5402
5405
|
});
|
|
5403
5406
|
this.addClass(STATE_CLASS.NO_START);
|
|
5404
5407
|
this.emit(RESET);
|
|
@@ -5406,7 +5409,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5406
5409
|
}, {
|
|
5407
5410
|
key: "reset",
|
|
5408
5411
|
value: function reset() {
|
|
5409
|
-
var
|
|
5412
|
+
var _this18 = this;
|
|
5410
5413
|
var unregisterPlugins = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
5411
5414
|
var isResetConfig = arguments.length > 1 ? arguments[1] : void 0;
|
|
5412
5415
|
this.resetState();
|
|
@@ -5415,13 +5418,13 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5415
5418
|
return;
|
|
5416
5419
|
}
|
|
5417
5420
|
unregisterPlugins.map(function(pn) {
|
|
5418
|
-
|
|
5421
|
+
_this18.deregister(pn);
|
|
5419
5422
|
});
|
|
5420
5423
|
if (isResetConfig) {
|
|
5421
5424
|
var de = getDefaultConfig$1();
|
|
5422
5425
|
Object.keys(this.config).forEach(function(k) {
|
|
5423
|
-
if (
|
|
5424
|
-
|
|
5426
|
+
if (_this18.config[k] !== "undefined" && (k === "plugins" || k === "presets" || k === "el" || k === "id")) {
|
|
5427
|
+
_this18.config[k] = de[k];
|
|
5425
5428
|
}
|
|
5426
5429
|
});
|
|
5427
5430
|
}
|
|
@@ -5429,7 +5432,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5429
5432
|
}, {
|
|
5430
5433
|
key: "destroy",
|
|
5431
5434
|
value: function destroy2() {
|
|
5432
|
-
var _instManager2,
|
|
5435
|
+
var _instManager2, _this19 = this;
|
|
5433
5436
|
var innerContainer = this.innerContainer, root2 = this.root, media = this.media;
|
|
5434
5437
|
if (!root2 || !media) {
|
|
5435
5438
|
return;
|
|
@@ -5458,8 +5461,8 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5458
5461
|
}
|
|
5459
5462
|
!innerContainer && media instanceof window.Node && root2.contains(media) && !this.config.remainMediaAfterDestroy && root2.removeChild(media);
|
|
5460
5463
|
["topBar", "leftBar", "rightBar", "innerContainer"].map(function(item) {
|
|
5461
|
-
|
|
5462
|
-
|
|
5464
|
+
_this19[item] && root2.removeChild(_this19[item]);
|
|
5465
|
+
_this19[item] = null;
|
|
5463
5466
|
});
|
|
5464
5467
|
var cList = root2.className.split(" ");
|
|
5465
5468
|
if (cList.length > 0) {
|
|
@@ -5471,45 +5474,45 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5471
5474
|
}
|
|
5472
5475
|
this.removeAttribute("data-xgfill");
|
|
5473
5476
|
["isSeeking", "isCanplay", "isActive", "cssfullscreen", "fullscreen"].forEach(function(key) {
|
|
5474
|
-
|
|
5477
|
+
_this19[key] = false;
|
|
5475
5478
|
});
|
|
5476
5479
|
}
|
|
5477
5480
|
}, {
|
|
5478
5481
|
key: "replay",
|
|
5479
5482
|
value: function replay() {
|
|
5480
|
-
var
|
|
5483
|
+
var _this20 = this;
|
|
5481
5484
|
this.removeClass(STATE_CLASS.ENDED);
|
|
5482
5485
|
this.currentTime = 0;
|
|
5483
5486
|
this.isSeeking = false;
|
|
5484
5487
|
runHooks(this, "replay", function() {
|
|
5485
|
-
|
|
5486
|
-
var playPromise =
|
|
5488
|
+
_this20.once(SEEKED, function() {
|
|
5489
|
+
var playPromise = _this20.mediaPlay();
|
|
5487
5490
|
if (playPromise && playPromise.catch) {
|
|
5488
5491
|
playPromise.catch(function(err) {
|
|
5489
5492
|
console.log(err);
|
|
5490
5493
|
});
|
|
5491
5494
|
}
|
|
5492
5495
|
});
|
|
5493
|
-
|
|
5494
|
-
|
|
5496
|
+
_this20.emit(REPLAY);
|
|
5497
|
+
_this20.onPlay();
|
|
5495
5498
|
});
|
|
5496
5499
|
}
|
|
5497
5500
|
}, {
|
|
5498
5501
|
key: "retry",
|
|
5499
5502
|
value: function retry() {
|
|
5500
|
-
var
|
|
5503
|
+
var _this21 = this;
|
|
5501
5504
|
this.removeClass(STATE_CLASS.ERROR);
|
|
5502
5505
|
this.addClass(STATE_CLASS.LOADING);
|
|
5503
5506
|
runHooks(this, "retry", function() {
|
|
5504
|
-
var cur =
|
|
5505
|
-
var url =
|
|
5506
|
-
var _srcRet = !util.isMSE(
|
|
5507
|
+
var cur = _this21.currentTime;
|
|
5508
|
+
var url = _this21.config.url;
|
|
5509
|
+
var _srcRet = !util.isMSE(_this21.media) ? _this21.preProcessUrl(url) : {
|
|
5507
5510
|
url
|
|
5508
5511
|
};
|
|
5509
|
-
|
|
5510
|
-
!
|
|
5511
|
-
|
|
5512
|
-
|
|
5512
|
+
_this21.src = _srcRet.url;
|
|
5513
|
+
!_this21.config.isLive && (_this21.currentTime = cur);
|
|
5514
|
+
_this21.once(CANPLAY, function() {
|
|
5515
|
+
_this21.mediaPlay();
|
|
5513
5516
|
});
|
|
5514
5517
|
});
|
|
5515
5518
|
}
|
|
@@ -5744,7 +5747,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5744
5747
|
}, {
|
|
5745
5748
|
key: "onFocus",
|
|
5746
5749
|
value: function onFocus() {
|
|
5747
|
-
var
|
|
5750
|
+
var _this22 = this;
|
|
5748
5751
|
var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
5749
5752
|
autoHide: true,
|
|
5750
5753
|
delay: 3e3
|
|
@@ -5762,8 +5765,8 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5762
5765
|
}
|
|
5763
5766
|
var time = data && data.delay ? data.delay : this.config.inactive;
|
|
5764
5767
|
this.userTimer = util.setTimeout(this, function() {
|
|
5765
|
-
|
|
5766
|
-
|
|
5768
|
+
_this22.userTimer = null;
|
|
5769
|
+
_this22.blur();
|
|
5767
5770
|
}, time);
|
|
5768
5771
|
}
|
|
5769
5772
|
}, {
|
|
@@ -5796,7 +5799,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5796
5799
|
}, {
|
|
5797
5800
|
key: "onLoadeddata",
|
|
5798
5801
|
value: function onLoadeddata() {
|
|
5799
|
-
var
|
|
5802
|
+
var _this23 = this;
|
|
5800
5803
|
this.isError = false;
|
|
5801
5804
|
this.isSeeking = false;
|
|
5802
5805
|
if (this.__startTime > 0) {
|
|
@@ -5804,7 +5807,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5804
5807
|
this._seekToStartTime();
|
|
5805
5808
|
} else {
|
|
5806
5809
|
this.once(DURATION_CHANGE, function() {
|
|
5807
|
-
|
|
5810
|
+
_this23._seekToStartTime();
|
|
5808
5811
|
});
|
|
5809
5812
|
}
|
|
5810
5813
|
}
|
|
@@ -5875,27 +5878,27 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5875
5878
|
}, {
|
|
5876
5879
|
key: "onWaiting",
|
|
5877
5880
|
value: function onWaiting() {
|
|
5878
|
-
var
|
|
5881
|
+
var _this24 = this;
|
|
5879
5882
|
if (this.waitTimer) {
|
|
5880
5883
|
util.clearTimeout(this, this.waitTimer);
|
|
5881
5884
|
}
|
|
5882
5885
|
this.updateAcc("waiting");
|
|
5883
5886
|
this.waitTimer = util.setTimeout(this, function() {
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
util.clearTimeout(
|
|
5887
|
-
|
|
5887
|
+
_this24.addClass(STATE_CLASS.LOADING);
|
|
5888
|
+
_this24.emit(LOADING);
|
|
5889
|
+
util.clearTimeout(_this24, _this24.waitTimer);
|
|
5890
|
+
_this24.waitTimer = null;
|
|
5888
5891
|
}, this.config.minWaitDelay);
|
|
5889
5892
|
}
|
|
5890
5893
|
}, {
|
|
5891
5894
|
key: "onPlaying",
|
|
5892
5895
|
value: function onPlaying() {
|
|
5893
|
-
var
|
|
5896
|
+
var _this25 = this;
|
|
5894
5897
|
this.isError = false;
|
|
5895
5898
|
var NO_START = STATE_CLASS.NO_START, PAUSED = STATE_CLASS.PAUSED, ENDED2 = STATE_CLASS.ENDED, ERROR2 = STATE_CLASS.ERROR, REPLAY2 = STATE_CLASS.REPLAY, LOADING2 = STATE_CLASS.LOADING;
|
|
5896
5899
|
var clsList = [NO_START, PAUSED, ENDED2, ERROR2, REPLAY2, LOADING2];
|
|
5897
5900
|
clsList.forEach(function(cls) {
|
|
5898
|
-
|
|
5901
|
+
_this25.removeClass(cls);
|
|
5899
5902
|
});
|
|
5900
5903
|
if (!this._accPlayed.t && !this.paused && !this.ended) {
|
|
5901
5904
|
this._accPlayed.t = (/* @__PURE__ */ new Date()).getTime();
|
|
@@ -5983,7 +5986,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5983
5986
|
}, {
|
|
5984
5987
|
key: "resizePosition",
|
|
5985
5988
|
value: function resizePosition() {
|
|
5986
|
-
var
|
|
5989
|
+
var _this26 = this;
|
|
5987
5990
|
var _this$videoPos = this.videoPos, vy = _this$videoPos.vy, vx = _this$videoPos.vx, h = _this$videoPos.h, w = _this$videoPos.w;
|
|
5988
5991
|
var rotate = this.videoPos.rotate;
|
|
5989
5992
|
if (rotate < 0 && h < 0 && w < 0) {
|
|
@@ -6040,7 +6043,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
6040
6043
|
styles.transform = formStyle;
|
|
6041
6044
|
styles.webkitTransform = formStyle;
|
|
6042
6045
|
Object.keys(styles).map(function(key) {
|
|
6043
|
-
|
|
6046
|
+
_this26.media.style[key] = styles[key];
|
|
6044
6047
|
});
|
|
6045
6048
|
}
|
|
6046
6049
|
}, {
|
|
@@ -6065,14 +6068,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
6065
6068
|
}, {
|
|
6066
6069
|
key: "setConfig",
|
|
6067
6070
|
value: function setConfig(config) {
|
|
6068
|
-
var
|
|
6071
|
+
var _this27 = this;
|
|
6069
6072
|
if (!config) {
|
|
6070
6073
|
return;
|
|
6071
6074
|
}
|
|
6072
6075
|
Object.keys(config).map(function(key) {
|
|
6073
6076
|
if (key !== "plugins") {
|
|
6074
|
-
|
|
6075
|
-
var plugin =
|
|
6077
|
+
_this27.config[key] = config[key];
|
|
6078
|
+
var plugin = _this27.plugins[key.toLowerCase()];
|
|
6076
6079
|
if (plugin && util.typeOf(plugin.setConfig) === "Function") {
|
|
6077
6080
|
plugin.setConfig(config[key]);
|
|
6078
6081
|
}
|
|
@@ -6082,20 +6085,20 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
6082
6085
|
}, {
|
|
6083
6086
|
key: "playNext",
|
|
6084
6087
|
value: function playNext(config) {
|
|
6085
|
-
var
|
|
6088
|
+
var _this28 = this;
|
|
6086
6089
|
this.resetState();
|
|
6087
6090
|
this.setConfig(config);
|
|
6088
6091
|
this._currentTime = 0;
|
|
6089
6092
|
this._duration = 0;
|
|
6090
6093
|
runHooks(this, "playnext", function() {
|
|
6091
|
-
|
|
6092
|
-
|
|
6094
|
+
_this28.start();
|
|
6095
|
+
_this28.emit(PLAYNEXT, config);
|
|
6093
6096
|
});
|
|
6094
6097
|
}
|
|
6095
6098
|
}, {
|
|
6096
6099
|
key: "resize",
|
|
6097
6100
|
value: function resize() {
|
|
6098
|
-
var
|
|
6101
|
+
var _this29 = this;
|
|
6099
6102
|
if (!this.media || !this.root) {
|
|
6100
6103
|
return;
|
|
6101
6104
|
}
|
|
@@ -6135,7 +6138,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
6135
6138
|
}
|
|
6136
6139
|
if (!this.fullscreen && !this.cssfullscreen) {
|
|
6137
6140
|
Object.keys(_style).forEach(function(key) {
|
|
6138
|
-
|
|
6141
|
+
_this29.root.style[key] = _style[key];
|
|
6139
6142
|
});
|
|
6140
6143
|
}
|
|
6141
6144
|
if (videoFillMode === "fillHeight" && fit < videoFit || videoFillMode === "fillWidth" && fit > videoFit) {
|
|
@@ -6235,15 +6238,15 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
6235
6238
|
return this.config.definition.list || [];
|
|
6236
6239
|
},
|
|
6237
6240
|
set: function set(list) {
|
|
6238
|
-
var
|
|
6241
|
+
var _this30 = this;
|
|
6239
6242
|
var definition = this.config.definition;
|
|
6240
6243
|
var curDef = null;
|
|
6241
6244
|
var targetDef = null;
|
|
6242
6245
|
definition.list = list;
|
|
6243
6246
|
this.emit("resourceReady", list);
|
|
6244
6247
|
list.forEach(function(item) {
|
|
6245
|
-
var
|
|
6246
|
-
if (((
|
|
6248
|
+
var _this30$curDefinition;
|
|
6249
|
+
if (((_this30$curDefinition = _this30.curDefinition) === null || _this30$curDefinition === void 0 ? void 0 : _this30$curDefinition.definition) === item.definition) {
|
|
6247
6250
|
curDef = item;
|
|
6248
6251
|
}
|
|
6249
6252
|
if (definition.defaultDefinition === item.definition) {
|
|
@@ -6419,6 +6422,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
6419
6422
|
value: function hook$1(hookName, handler) {
|
|
6420
6423
|
return hook.call.apply(hook, [this].concat(Array.prototype.slice.call(arguments)));
|
|
6421
6424
|
}
|
|
6425
|
+
}, {
|
|
6426
|
+
key: "runHooks",
|
|
6427
|
+
value: function runHooks$1() {
|
|
6428
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
6429
|
+
args[_key] = arguments[_key];
|
|
6430
|
+
}
|
|
6431
|
+
return runHooks.call.apply(runHooks, [this].concat(Array.prototype.slice.call(arguments)));
|
|
6432
|
+
}
|
|
6422
6433
|
}, {
|
|
6423
6434
|
key: "useHooks",
|
|
6424
6435
|
value: function useHooks$1(hookName, handler) {
|
|
@@ -6432,16 +6443,16 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
6432
6443
|
}, {
|
|
6433
6444
|
key: "usePluginHooks",
|
|
6434
6445
|
value: function usePluginHooks$1(pluginName, hookName, handler) {
|
|
6435
|
-
for (var
|
|
6436
|
-
args[
|
|
6446
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
|
|
6447
|
+
args[_key2 - 3] = arguments[_key2];
|
|
6437
6448
|
}
|
|
6438
6449
|
return usePluginHooks.call.apply(usePluginHooks, [this].concat(Array.prototype.slice.call(arguments)));
|
|
6439
6450
|
}
|
|
6440
6451
|
}, {
|
|
6441
6452
|
key: "removePluginHooks",
|
|
6442
6453
|
value: function removePluginHooks$1(pluginName, hookName, handler) {
|
|
6443
|
-
for (var
|
|
6444
|
-
args[
|
|
6454
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 3 ? _len3 - 3 : 0), _key3 = 3; _key3 < _len3; _key3++) {
|
|
6455
|
+
args[_key3 - 3] = arguments[_key3];
|
|
6445
6456
|
}
|
|
6446
6457
|
return removePluginHooks.call.apply(removePluginHooks, [this].concat(Array.prototype.slice.call(arguments)));
|
|
6447
6458
|
}
|
|
@@ -14497,7 +14508,7 @@ class VePlayerBase {
|
|
|
14497
14508
|
* @brief Retrieve the player SDK version number.
|
|
14498
14509
|
*/
|
|
14499
14510
|
get playerVersion() {
|
|
14500
|
-
return "2.12.0-rc.
|
|
14511
|
+
return "2.12.0-rc.2";
|
|
14501
14512
|
}
|
|
14502
14513
|
/** {zh}
|
|
14503
14514
|
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|