@volcengine/veplayer 2.2.1-rc.0 → 2.3.0-rc.1
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/LICENSE +20 -0
- package/esm/index.d.ts +1752 -294
- package/esm/veplayer.biz.live.development.js +122 -28
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +3888 -648
- package/esm/veplayer.development.css +1 -1
- package/esm/veplayer.development.js +729 -194
- package/esm/veplayer.live.d.ts +3888 -648
- package/esm/veplayer.live.development.css +1 -1
- package/esm/veplayer.live.development.js +729 -194
- package/esm/veplayer.live.production.css +1 -1
- package/esm/veplayer.live.production.js +3 -3
- package/esm/veplayer.production.css +1 -1
- package/esm/veplayer.production.js +3 -3
- package/esm/veplayer.vod.d.ts +1752 -294
- package/esm/veplayer.vod.development.css +1 -1
- package/esm/veplayer.vod.development.js +620 -176
- package/esm/veplayer.vod.production.css +1 -1
- package/esm/veplayer.vod.production.js +2 -2
- package/package.json +1 -1
- package/umd/index.d.ts +1752 -294
- package/umd/veplayer.biz.live.development.js +125 -31
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.biz.vod.development.js +3 -2
- package/umd/veplayer.biz.vod.production.js +1 -1
- package/umd/veplayer.d.ts +3888 -648
- package/umd/veplayer.development.css +1 -1
- package/umd/veplayer.development.js +728 -193
- package/umd/veplayer.live.d.ts +3888 -648
- package/umd/veplayer.live.development.css +1 -1
- package/umd/veplayer.live.development.js +731 -196
- package/umd/veplayer.live.production.css +1 -1
- package/umd/veplayer.live.production.js +1 -1
- package/umd/veplayer.production.css +1 -1
- package/umd/veplayer.production.js +1 -1
- package/umd/veplayer.vod.d.ts +1752 -294
- package/umd/veplayer.vod.development.css +1 -1
- package/umd/veplayer.vod.development.js +625 -181
- package/umd/veplayer.vod.production.css +1 -1
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +3888 -648
- package/veplayer.live.d.ts +3888 -648
- package/veplayer.vod.d.ts +1752 -294
|
@@ -48,8 +48,8 @@ function _typeof(obj) {
|
|
|
48
48
|
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
49
49
|
}, _typeof(obj);
|
|
50
50
|
}
|
|
51
|
-
function _classCallCheck(
|
|
52
|
-
if (!(
|
|
51
|
+
function _classCallCheck(instance2, Constructor) {
|
|
52
|
+
if (!(instance2 instanceof Constructor)) {
|
|
53
53
|
throw new TypeError("Cannot call a class as a function");
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -1454,7 +1454,7 @@ var sniffer$1 = {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
1456
|
};
|
|
1457
|
-
var version = "3.0.
|
|
1457
|
+
var version = "3.0.12";
|
|
1458
1458
|
var ERROR_TYPE_MAP = {
|
|
1459
1459
|
1: "media",
|
|
1460
1460
|
2: "media",
|
|
@@ -2316,10 +2316,10 @@ var INDEXDB = /* @__PURE__ */ function() {
|
|
|
2316
2316
|
}, {
|
|
2317
2317
|
key: "addData",
|
|
2318
2318
|
value: function addData(storename, data) {
|
|
2319
|
-
var
|
|
2319
|
+
var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
|
|
2320
2320
|
var request;
|
|
2321
2321
|
for (var i2 = 0; i2 < data.length; i2++) {
|
|
2322
|
-
request =
|
|
2322
|
+
request = store2.add(data[i2]);
|
|
2323
2323
|
request.onerror = function() {
|
|
2324
2324
|
};
|
|
2325
2325
|
request.onsuccess = function() {
|
|
@@ -2329,10 +2329,10 @@ var INDEXDB = /* @__PURE__ */ function() {
|
|
|
2329
2329
|
}, {
|
|
2330
2330
|
key: "putData",
|
|
2331
2331
|
value: function putData(storename, data) {
|
|
2332
|
-
var
|
|
2332
|
+
var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
|
|
2333
2333
|
var request;
|
|
2334
2334
|
for (var i2 = 0; i2 < data.length; i2++) {
|
|
2335
|
-
request =
|
|
2335
|
+
request = store2.put(data[i2]);
|
|
2336
2336
|
request.onerror = function() {
|
|
2337
2337
|
};
|
|
2338
2338
|
request.onsuccess = function() {
|
|
@@ -2343,8 +2343,8 @@ var INDEXDB = /* @__PURE__ */ function() {
|
|
|
2343
2343
|
key: "getDataByKey",
|
|
2344
2344
|
value: function getDataByKey(storename, key, callback) {
|
|
2345
2345
|
var self2 = this;
|
|
2346
|
-
var
|
|
2347
|
-
var request =
|
|
2346
|
+
var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
|
|
2347
|
+
var request = store2.get(key);
|
|
2348
2348
|
request.onerror = function() {
|
|
2349
2349
|
callback.call(self2, null);
|
|
2350
2350
|
};
|
|
@@ -2356,14 +2356,14 @@ var INDEXDB = /* @__PURE__ */ function() {
|
|
|
2356
2356
|
}, {
|
|
2357
2357
|
key: "deleteData",
|
|
2358
2358
|
value: function deleteData(storename, key) {
|
|
2359
|
-
var
|
|
2360
|
-
|
|
2359
|
+
var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
|
|
2360
|
+
store2.delete(key);
|
|
2361
2361
|
}
|
|
2362
2362
|
}, {
|
|
2363
2363
|
key: "clearData",
|
|
2364
2364
|
value: function clearData(storename) {
|
|
2365
|
-
var
|
|
2366
|
-
|
|
2365
|
+
var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
|
|
2366
|
+
store2.clear();
|
|
2367
2367
|
}
|
|
2368
2368
|
}]);
|
|
2369
2369
|
return INDEXDB2;
|
|
@@ -2480,24 +2480,24 @@ function removePluginHooks(pluginName) {
|
|
|
2480
2480
|
return plugin.removeHooks && plugin.removeHooks.apply(plugin, args);
|
|
2481
2481
|
}
|
|
2482
2482
|
}
|
|
2483
|
-
function hooksDescriptor(
|
|
2483
|
+
function hooksDescriptor(instance2) {
|
|
2484
2484
|
var presetHooks = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
2485
|
-
|
|
2485
|
+
instance2.__hooks = {};
|
|
2486
2486
|
presetHooks && presetHooks.map(function(item) {
|
|
2487
|
-
|
|
2487
|
+
instance2.__hooks[item] = null;
|
|
2488
2488
|
});
|
|
2489
|
-
Object.defineProperty(
|
|
2489
|
+
Object.defineProperty(instance2, "hooks", {
|
|
2490
2490
|
get: function get() {
|
|
2491
|
-
return
|
|
2492
|
-
if (
|
|
2491
|
+
return instance2.__hooks && Object.keys(instance2.__hooks).map(function(key) {
|
|
2492
|
+
if (instance2.__hooks[key]) {
|
|
2493
2493
|
return key;
|
|
2494
2494
|
}
|
|
2495
2495
|
});
|
|
2496
2496
|
}
|
|
2497
2497
|
});
|
|
2498
2498
|
}
|
|
2499
|
-
function delHooksDescriptor(
|
|
2500
|
-
|
|
2499
|
+
function delHooksDescriptor(instance2) {
|
|
2500
|
+
instance2.__hooks = null;
|
|
2501
2501
|
}
|
|
2502
2502
|
function runHooks(obj, hookName, handler) {
|
|
2503
2503
|
for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
|
|
@@ -2715,7 +2715,7 @@ var BasePlugin = /* @__PURE__ */ function() {
|
|
|
2715
2715
|
}
|
|
2716
2716
|
}, {
|
|
2717
2717
|
key: "registerPlugin",
|
|
2718
|
-
value: function
|
|
2718
|
+
value: function registerPlugin2(plugin) {
|
|
2719
2719
|
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
2720
2720
|
var name = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
|
2721
2721
|
if (!this.player) {
|
|
@@ -3074,7 +3074,7 @@ var Plugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
3074
3074
|
}
|
|
3075
3075
|
}, {
|
|
3076
3076
|
key: "registerPlugin",
|
|
3077
|
-
value: function
|
|
3077
|
+
value: function registerPlugin2(plugin) {
|
|
3078
3078
|
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
3079
3079
|
var name = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
|
3080
3080
|
options.root = options.root || this.root;
|
|
@@ -3213,7 +3213,7 @@ var Plugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
3213
3213
|
var cs = window.getComputedStyle(this.root, null);
|
|
3214
3214
|
var cssDisplayValue = cs.getPropertyValue("display");
|
|
3215
3215
|
if (cssDisplayValue === "none") {
|
|
3216
|
-
|
|
3216
|
+
this.root.style.display = "block";
|
|
3217
3217
|
}
|
|
3218
3218
|
}
|
|
3219
3219
|
}, {
|
|
@@ -3470,28 +3470,11 @@ var pluginsManager = {
|
|
|
3470
3470
|
!player.config.closeResizeObserver && addObserver(player.root, function() {
|
|
3471
3471
|
player.resize();
|
|
3472
3472
|
});
|
|
3473
|
-
if (Object.keys(this.pluginGroup).length === 0) {
|
|
3474
|
-
player.isUserActive = true;
|
|
3475
|
-
}
|
|
3476
3473
|
this.pluginGroup[cgid] = {
|
|
3477
|
-
_player: player,
|
|
3478
3474
|
_originalOptions: player.config || {},
|
|
3479
3475
|
_plugins: {}
|
|
3480
3476
|
};
|
|
3481
3477
|
},
|
|
3482
|
-
checkPlayerRoot: function checkPlayerRoot(root2) {
|
|
3483
|
-
if (this.pluginGroup) {
|
|
3484
|
-
var _keys = Object.keys(this.pluginGroup);
|
|
3485
|
-
for (var i2 = 0; i2 < _keys.length; i2++) {
|
|
3486
|
-
var _p = this.pluginGroup[_keys[i2]]._player;
|
|
3487
|
-
if (_p.root === root2) {
|
|
3488
|
-
return _p;
|
|
3489
|
-
}
|
|
3490
|
-
}
|
|
3491
|
-
return null;
|
|
3492
|
-
}
|
|
3493
|
-
return null;
|
|
3494
|
-
},
|
|
3495
3478
|
formatPluginInfo: function formatPluginInfo(plugin, config) {
|
|
3496
3479
|
var PLUFGIN = null;
|
|
3497
3480
|
var options = null;
|
|
@@ -3566,7 +3549,7 @@ var pluginsManager = {
|
|
|
3566
3549
|
}
|
|
3567
3550
|
var plugins = this.pluginGroup[cgid]._plugins;
|
|
3568
3551
|
var originalOptions = this.pluginGroup[cgid]._originalOptions;
|
|
3569
|
-
options.player =
|
|
3552
|
+
options.player = player;
|
|
3570
3553
|
var pluginName = options.pluginName || plugin.pluginName;
|
|
3571
3554
|
if (!pluginName) {
|
|
3572
3555
|
throw new Error("The property pluginName is necessary");
|
|
@@ -3765,37 +3748,6 @@ var pluginsManager = {
|
|
|
3765
3748
|
}
|
|
3766
3749
|
});
|
|
3767
3750
|
},
|
|
3768
|
-
setCurrentUserActive: function setCurrentUserActive(playerId, isActive) {
|
|
3769
|
-
if (!this.pluginGroup[playerId]) {
|
|
3770
|
-
return;
|
|
3771
|
-
}
|
|
3772
|
-
if (!isActive) {
|
|
3773
|
-
this.pluginGroup[playerId]._player.isUserActive = isActive;
|
|
3774
|
-
return playerId;
|
|
3775
|
-
}
|
|
3776
|
-
var keys = Object.keys(this.pluginGroup);
|
|
3777
|
-
for (var i2 = 0; i2 < keys.length; i2++) {
|
|
3778
|
-
var c2 = this.pluginGroup[keys[i2]];
|
|
3779
|
-
if (c2 && c2._player) {
|
|
3780
|
-
this.pluginGroup[keys[i2]]._player.isUserActive = false;
|
|
3781
|
-
}
|
|
3782
|
-
}
|
|
3783
|
-
this.pluginGroup[playerId]._player.isUserActive = isActive;
|
|
3784
|
-
return playerId;
|
|
3785
|
-
},
|
|
3786
|
-
getCurrentUseActiveId: function getCurrentUseActiveId() {
|
|
3787
|
-
if (!this.pluginGroup) {
|
|
3788
|
-
return;
|
|
3789
|
-
}
|
|
3790
|
-
var keys = Object.keys(this.pluginGroup);
|
|
3791
|
-
for (var i2 = 0; i2 < keys.length; i2++) {
|
|
3792
|
-
var c2 = this.pluginGroup[keys[i2]];
|
|
3793
|
-
if (c2 && c2._player && c2._player.isUserActive) {
|
|
3794
|
-
return keys[i2];
|
|
3795
|
-
}
|
|
3796
|
-
}
|
|
3797
|
-
return null;
|
|
3798
|
-
},
|
|
3799
3751
|
destroy: function destroy(player) {
|
|
3800
3752
|
var cgid = player._pluginInfoId;
|
|
3801
3753
|
if (!this.pluginGroup[cgid]) {
|
|
@@ -4051,7 +4003,7 @@ var Controls = /* @__PURE__ */ function(_Plugin) {
|
|
|
4051
4003
|
}
|
|
4052
4004
|
}, {
|
|
4053
4005
|
key: "show",
|
|
4054
|
-
value: function show() {
|
|
4006
|
+
value: function show(value) {
|
|
4055
4007
|
this.root.style.display = "";
|
|
4056
4008
|
this.player.focus();
|
|
4057
4009
|
}
|
|
@@ -4067,7 +4019,7 @@ var Controls = /* @__PURE__ */ function(_Plugin) {
|
|
|
4067
4019
|
}
|
|
4068
4020
|
}, {
|
|
4069
4021
|
key: "registerPlugin",
|
|
4070
|
-
value: function
|
|
4022
|
+
value: function registerPlugin2(plugin) {
|
|
4071
4023
|
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
4072
4024
|
var name = arguments.length > 2 ? arguments[2] : void 0;
|
|
4073
4025
|
if (!this.root) {
|
|
@@ -4344,9 +4296,158 @@ var STATES = {
|
|
|
4344
4296
|
DESTROYED: 8
|
|
4345
4297
|
};
|
|
4346
4298
|
var STATE_ARRAY = ["ERROR", "INITIAL", "READY", "ATTACHING", "ATTACHED", "NOTALLOW", "RUNNING", "ENDED", "DESTROYED"];
|
|
4299
|
+
var store = {};
|
|
4300
|
+
var instance = null;
|
|
4301
|
+
var InstManager = /* @__PURE__ */ function(_EventEmitter) {
|
|
4302
|
+
_inherits(InstManager2, _EventEmitter);
|
|
4303
|
+
var _super = _createSuper(InstManager2);
|
|
4304
|
+
function InstManager2() {
|
|
4305
|
+
_classCallCheck(this, InstManager2);
|
|
4306
|
+
return _super.apply(this, arguments);
|
|
4307
|
+
}
|
|
4308
|
+
_createClass$1(InstManager2, [{
|
|
4309
|
+
key: "add",
|
|
4310
|
+
value: function add(player) {
|
|
4311
|
+
if (!player) {
|
|
4312
|
+
return;
|
|
4313
|
+
}
|
|
4314
|
+
store[player.playerId] = player;
|
|
4315
|
+
if (Object.keys(store).length === 1) {
|
|
4316
|
+
this.setActive(player.playerId, true);
|
|
4317
|
+
}
|
|
4318
|
+
}
|
|
4319
|
+
}, {
|
|
4320
|
+
key: "remove",
|
|
4321
|
+
value: function remove(player) {
|
|
4322
|
+
if (!player) {
|
|
4323
|
+
return;
|
|
4324
|
+
}
|
|
4325
|
+
player.isUserActive;
|
|
4326
|
+
delete store[player.playerId];
|
|
4327
|
+
}
|
|
4328
|
+
}, {
|
|
4329
|
+
key: "_iterate",
|
|
4330
|
+
value: function _iterate(fn) {
|
|
4331
|
+
var endEarly = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
4332
|
+
for (var key in store) {
|
|
4333
|
+
if (Object.prototype.hasOwnProperty.call(store, key)) {
|
|
4334
|
+
var player = store[key];
|
|
4335
|
+
if (endEarly) {
|
|
4336
|
+
if (fn(player)) {
|
|
4337
|
+
break;
|
|
4338
|
+
}
|
|
4339
|
+
} else {
|
|
4340
|
+
fn(player);
|
|
4341
|
+
}
|
|
4342
|
+
}
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
4345
|
+
}, {
|
|
4346
|
+
key: "forEach",
|
|
4347
|
+
value: function forEach(fn) {
|
|
4348
|
+
this._iterate(fn);
|
|
4349
|
+
}
|
|
4350
|
+
}, {
|
|
4351
|
+
key: "find",
|
|
4352
|
+
value: function find(fn) {
|
|
4353
|
+
var result = null;
|
|
4354
|
+
this._iterate(function(player) {
|
|
4355
|
+
var flag = fn(player);
|
|
4356
|
+
if (flag) {
|
|
4357
|
+
result = player;
|
|
4358
|
+
}
|
|
4359
|
+
return flag;
|
|
4360
|
+
}, true);
|
|
4361
|
+
return result;
|
|
4362
|
+
}
|
|
4363
|
+
}, {
|
|
4364
|
+
key: "findAll",
|
|
4365
|
+
value: function findAll(fn) {
|
|
4366
|
+
var results = [];
|
|
4367
|
+
this._iterate(function(player) {
|
|
4368
|
+
if (fn(player)) {
|
|
4369
|
+
results.push(player);
|
|
4370
|
+
}
|
|
4371
|
+
});
|
|
4372
|
+
return results;
|
|
4373
|
+
}
|
|
4374
|
+
}, {
|
|
4375
|
+
key: "setActive",
|
|
4376
|
+
value: function setActive(playerId) {
|
|
4377
|
+
var isActive = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
4378
|
+
if (!store[playerId]) {
|
|
4379
|
+
return;
|
|
4380
|
+
}
|
|
4381
|
+
if (isActive) {
|
|
4382
|
+
this.forEach(function(inst) {
|
|
4383
|
+
if (playerId === inst.playerId) {
|
|
4384
|
+
inst.isUserActive = true;
|
|
4385
|
+
inst.isInstNext = false;
|
|
4386
|
+
} else {
|
|
4387
|
+
inst.isUserActive = false;
|
|
4388
|
+
}
|
|
4389
|
+
});
|
|
4390
|
+
} else {
|
|
4391
|
+
store[playerId].isUserActive = isActive;
|
|
4392
|
+
}
|
|
4393
|
+
return playerId;
|
|
4394
|
+
}
|
|
4395
|
+
}, {
|
|
4396
|
+
key: "getActiveId",
|
|
4397
|
+
value: function getActiveId() {
|
|
4398
|
+
var keys = Object.keys(store);
|
|
4399
|
+
for (var i2 = 0; i2 < keys.length; i2++) {
|
|
4400
|
+
var c2 = store[keys[i2]];
|
|
4401
|
+
if (c2 && c2.isUserActive) {
|
|
4402
|
+
return keys[i2];
|
|
4403
|
+
}
|
|
4404
|
+
}
|
|
4405
|
+
return null;
|
|
4406
|
+
}
|
|
4407
|
+
}, {
|
|
4408
|
+
key: "setNext",
|
|
4409
|
+
value: function setNext(playerId) {
|
|
4410
|
+
var isNext = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
4411
|
+
if (!store[playerId]) {
|
|
4412
|
+
return;
|
|
4413
|
+
}
|
|
4414
|
+
if (isNext) {
|
|
4415
|
+
this.forEach(function(inst) {
|
|
4416
|
+
if (playerId === inst.playerId) {
|
|
4417
|
+
inst.isUserActive = false;
|
|
4418
|
+
inst.isInstNext = true;
|
|
4419
|
+
} else {
|
|
4420
|
+
inst.isInstNext = false;
|
|
4421
|
+
}
|
|
4422
|
+
});
|
|
4423
|
+
} else {
|
|
4424
|
+
store[playerId].isInstNext = isNext;
|
|
4425
|
+
}
|
|
4426
|
+
return playerId;
|
|
4427
|
+
}
|
|
4428
|
+
}], [{
|
|
4429
|
+
key: "getInstance",
|
|
4430
|
+
value: function getInstance() {
|
|
4431
|
+
instance || (instance = new InstManager2());
|
|
4432
|
+
return instance;
|
|
4433
|
+
}
|
|
4434
|
+
}]);
|
|
4435
|
+
return InstManager2;
|
|
4436
|
+
}(eventemitter3Exports.EventEmitter);
|
|
4437
|
+
function checkPlayerRoot(root2) {
|
|
4438
|
+
var keys = Object.keys(store);
|
|
4439
|
+
for (var i2 = 0; i2 < keys.length; i2++) {
|
|
4440
|
+
var p2 = store[keys[i2]];
|
|
4441
|
+
if (p2.root === root2) {
|
|
4442
|
+
return p2;
|
|
4443
|
+
}
|
|
4444
|
+
}
|
|
4445
|
+
return null;
|
|
4446
|
+
}
|
|
4347
4447
|
var PlAYER_HOOKS = ["play", "pause", "replay", "retry"];
|
|
4348
4448
|
var REAL_TIME_SPEED = 0;
|
|
4349
4449
|
var AVG_SPEED = 0;
|
|
4450
|
+
var instManager = null;
|
|
4350
4451
|
var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
4351
4452
|
_inherits(Player2, _MediaProxy);
|
|
4352
4453
|
var _super = _createSuper(Player2);
|
|
@@ -4359,11 +4460,11 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4359
4460
|
if (!_this.config) {
|
|
4360
4461
|
return;
|
|
4361
4462
|
}
|
|
4362
|
-
var _this$config = _this.config, autoplay2 = _this$config.autoplay,
|
|
4363
|
-
XG_DEBUG.logInfo("player", "canPlayFunc, startTime",
|
|
4364
|
-
if (
|
|
4365
|
-
_this.currentTime =
|
|
4366
|
-
_this.
|
|
4463
|
+
var _this$config = _this.config, autoplay2 = _this$config.autoplay, defaultPlaybackRate = _this$config.defaultPlaybackRate;
|
|
4464
|
+
XG_DEBUG.logInfo("player", "canPlayFunc, startTime", _this.__startTime);
|
|
4465
|
+
if (_this.__startTime > 0 && _this.duration > 0) {
|
|
4466
|
+
_this.currentTime = _this.__startTime > _this.duration ? _this.duration : _this.__startTime;
|
|
4467
|
+
_this.__startTime = -1;
|
|
4367
4468
|
}
|
|
4368
4469
|
_this.playbackRate = defaultPlaybackRate;
|
|
4369
4470
|
(autoplay2 || _this._useAutoplay) && _this.mediaPlay();
|
|
@@ -4454,6 +4555,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4454
4555
|
_this.isSeeking = false;
|
|
4455
4556
|
_this.isCanplay = false;
|
|
4456
4557
|
_this._useAutoplay = false;
|
|
4558
|
+
_this.__startTime = -1;
|
|
4457
4559
|
_this.rotateDeg = 0;
|
|
4458
4560
|
_this.isActive = false;
|
|
4459
4561
|
_this.fullscreen = false;
|
|
@@ -4508,6 +4610,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4508
4610
|
_this.innerStates = {
|
|
4509
4611
|
isActiveLocked: false
|
|
4510
4612
|
};
|
|
4613
|
+
_this.instManager = instManager;
|
|
4511
4614
|
var rootInit = _this._initDOM();
|
|
4512
4615
|
if (!rootInit) {
|
|
4513
4616
|
console.error(new Error("can't find the dom which id is ".concat(_this.config.id, " or this.config.el does not exist")));
|
|
@@ -4545,7 +4648,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4545
4648
|
_createClass$1(Player2, [{
|
|
4546
4649
|
key: "_initDOM",
|
|
4547
4650
|
value: function _initDOM() {
|
|
4548
|
-
var _this2 = this;
|
|
4651
|
+
var _instManager, _this2 = this;
|
|
4549
4652
|
this.root = this.config.id ? document.getElementById(this.config.id) : null;
|
|
4550
4653
|
if (!this.root) {
|
|
4551
4654
|
var el = this.config.el;
|
|
@@ -4561,12 +4664,13 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4561
4664
|
return false;
|
|
4562
4665
|
}
|
|
4563
4666
|
}
|
|
4564
|
-
var ret =
|
|
4667
|
+
var ret = checkPlayerRoot(this.root);
|
|
4565
4668
|
if (ret) {
|
|
4566
4669
|
XG_DEBUG.logWarn("The is an Player instance already exists in this.root, destroy it and reinitialize");
|
|
4567
4670
|
ret.destroy();
|
|
4568
4671
|
}
|
|
4569
4672
|
this.root.setAttribute(PLATER_ID, this.playerId);
|
|
4673
|
+
(_instManager = instManager) === null || _instManager === void 0 ? void 0 : _instManager.add(this);
|
|
4570
4674
|
pluginsManager.init(this);
|
|
4571
4675
|
this._initBaseDoms();
|
|
4572
4676
|
var XgVideoProxy = this.constructor.XgVideoProxy;
|
|
@@ -4709,10 +4813,13 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4709
4813
|
!util$1.isMSE(this.media) && this.load();
|
|
4710
4814
|
(sniffer$1.os.isIpad || sniffer$1.os.isPhone) && this.mediaPlay();
|
|
4711
4815
|
}
|
|
4712
|
-
|
|
4816
|
+
var startTime = this.config.startTime;
|
|
4817
|
+
this.__startTime = startTime > 0 ? startTime : -1;
|
|
4818
|
+
this.config.startTime = 0;
|
|
4819
|
+
if (readyState >= 2 && this.duration > 0) {
|
|
4713
4820
|
this.canPlayFunc();
|
|
4714
4821
|
} else {
|
|
4715
|
-
this.
|
|
4822
|
+
this.on(CANPLAY, this.canPlayFunc);
|
|
4716
4823
|
}
|
|
4717
4824
|
if (!this.hasStart || this.state < STATES.ATTACHED) {
|
|
4718
4825
|
pluginsManager.afterInit(this);
|
|
@@ -4805,7 +4912,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4805
4912
|
}
|
|
4806
4913
|
}, {
|
|
4807
4914
|
key: "registerPlugin",
|
|
4808
|
-
value: function
|
|
4915
|
+
value: function registerPlugin2(plugin, config) {
|
|
4809
4916
|
var _retPlugin = pluginsManager.formatPluginInfo(plugin, config);
|
|
4810
4917
|
var PLUFGIN = _retPlugin.PLUFGIN, options = _retPlugin.options;
|
|
4811
4918
|
var plugins = this.config.plugins;
|
|
@@ -4954,6 +5061,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4954
5061
|
}
|
|
4955
5062
|
_src = this.preProcessUrl(_src).url;
|
|
4956
5063
|
var curTime = this.currentTime;
|
|
5064
|
+
this.__startTime = curTime;
|
|
4957
5065
|
var isPaused = this.paused && !this.isError;
|
|
4958
5066
|
this.src = _src;
|
|
4959
5067
|
return new Promise(function(resolve, reject) {
|
|
@@ -4963,7 +5071,10 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4963
5071
|
reject(e3);
|
|
4964
5072
|
};
|
|
4965
5073
|
var _canplay = function _canplay2() {
|
|
4966
|
-
_this9.
|
|
5074
|
+
if (_this9.duration > 0 && _this9.__startTime > 0) {
|
|
5075
|
+
_this9.currentTime = _this9.__startTime;
|
|
5076
|
+
_this9.__startTime = -1;
|
|
5077
|
+
}
|
|
4967
5078
|
if (isPaused) {
|
|
4968
5079
|
_this9.pause();
|
|
4969
5080
|
}
|
|
@@ -5190,7 +5301,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5190
5301
|
clsList.forEach(function(cls) {
|
|
5191
5302
|
_this16.removeClass(cls);
|
|
5192
5303
|
});
|
|
5193
|
-
this.addClass(STATE_CLASS.
|
|
5304
|
+
this.addClass(STATE_CLASS.NO_START);
|
|
5194
5305
|
this.emit(RESET);
|
|
5195
5306
|
}
|
|
5196
5307
|
}, {
|
|
@@ -5219,7 +5330,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5219
5330
|
}, {
|
|
5220
5331
|
key: "destroy",
|
|
5221
5332
|
value: function destroy2() {
|
|
5222
|
-
var _this18 = this;
|
|
5333
|
+
var _instManager2, _this18 = this;
|
|
5223
5334
|
var innerContainer = this.innerContainer, root2 = this.root, media = this.media;
|
|
5224
5335
|
if (!root2 || !media) {
|
|
5225
5336
|
return;
|
|
@@ -5232,6 +5343,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5232
5343
|
this._detachSourceEvents(this.media);
|
|
5233
5344
|
util$1.clearAllTimers(this);
|
|
5234
5345
|
this.emit(DESTROY);
|
|
5346
|
+
(_instManager2 = instManager) === null || _instManager2 === void 0 ? void 0 : _instManager2.remove(this);
|
|
5235
5347
|
pluginsManager.destroy(this);
|
|
5236
5348
|
delHooksDescriptor(this);
|
|
5237
5349
|
_get(_getPrototypeOf(Player2.prototype), "destroy", this).call(this);
|
|
@@ -5583,6 +5695,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5583
5695
|
this.isCanplay = true;
|
|
5584
5696
|
this.waitTimer && util$1.clearTimeout(this, this.waitTimer);
|
|
5585
5697
|
}
|
|
5698
|
+
}, {
|
|
5699
|
+
key: "onDurationchange",
|
|
5700
|
+
value: function onDurationchange() {
|
|
5701
|
+
if (this.__startTime > 0 && this.duration > 0) {
|
|
5702
|
+
this.currentTime = this.__startTime;
|
|
5703
|
+
this.__startTime = -1;
|
|
5704
|
+
}
|
|
5705
|
+
}
|
|
5586
5706
|
}, {
|
|
5587
5707
|
key: "onLoadeddata",
|
|
5588
5708
|
value: function onLoadeddata() {
|
|
@@ -5760,8 +5880,9 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5760
5880
|
}, {
|
|
5761
5881
|
key: "resizePosition",
|
|
5762
5882
|
value: function resizePosition() {
|
|
5763
|
-
var _this$videoPos = this.videoPos,
|
|
5764
|
-
|
|
5883
|
+
var _this$videoPos = this.videoPos, vy = _this$videoPos.vy, vx = _this$videoPos.vx, h2 = _this$videoPos.h, w2 = _this$videoPos.w;
|
|
5884
|
+
var rotate = this.videoPos.rotate;
|
|
5885
|
+
if (rotate < 0 && h2 < 0 && w2 < 0) {
|
|
5765
5886
|
return;
|
|
5766
5887
|
}
|
|
5767
5888
|
var _pi = this.videoPos._pi;
|
|
@@ -5772,6 +5893,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5772
5893
|
return;
|
|
5773
5894
|
}
|
|
5774
5895
|
this.videoPos.pi = _pi;
|
|
5896
|
+
rotate = rotate < 0 ? 0 : rotate;
|
|
5775
5897
|
var _pos = {
|
|
5776
5898
|
rotate
|
|
5777
5899
|
};
|
|
@@ -6204,7 +6326,8 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
6204
6326
|
}
|
|
6205
6327
|
}, {
|
|
6206
6328
|
key: "setUserActive",
|
|
6207
|
-
value: function setUserActive(isActive
|
|
6329
|
+
value: function setUserActive(isActive) {
|
|
6330
|
+
var isMuted = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
6208
6331
|
if (typeof isMuted === "boolean" && isMuted !== this.muted) {
|
|
6209
6332
|
this.addInnerOP("volumechange");
|
|
6210
6333
|
this.muted = isMuted;
|
|
@@ -6219,15 +6342,25 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
6219
6342
|
set: function set(value) {
|
|
6220
6343
|
XG_DEBUG.config.debug = value;
|
|
6221
6344
|
}
|
|
6345
|
+
}, {
|
|
6346
|
+
key: "instManager",
|
|
6347
|
+
get: function get() {
|
|
6348
|
+
return instManager;
|
|
6349
|
+
},
|
|
6350
|
+
set: function set(value) {
|
|
6351
|
+
instManager = value;
|
|
6352
|
+
}
|
|
6222
6353
|
}, {
|
|
6223
6354
|
key: "getCurrentUserActivePlayerId",
|
|
6224
6355
|
value: function getCurrentUserActivePlayerId() {
|
|
6225
|
-
|
|
6356
|
+
var _instManager3;
|
|
6357
|
+
return (_instManager3 = instManager) === null || _instManager3 === void 0 ? void 0 : _instManager3.getActiveId();
|
|
6226
6358
|
}
|
|
6227
6359
|
}, {
|
|
6228
6360
|
key: "setCurrentUserActive",
|
|
6229
|
-
value: function
|
|
6230
|
-
|
|
6361
|
+
value: function setCurrentUserActive(playerId, isActive) {
|
|
6362
|
+
var _instManager4;
|
|
6363
|
+
(_instManager4 = instManager) === null || _instManager4 === void 0 ? void 0 : _instManager4.setActive(playerId, isActive);
|
|
6231
6364
|
}
|
|
6232
6365
|
}, {
|
|
6233
6366
|
key: "isHevcSupported",
|
|
@@ -6262,6 +6395,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
6262
6395
|
}(MediaProxy);
|
|
6263
6396
|
_defineProperty$1(Player, "defaultPreset", null);
|
|
6264
6397
|
_defineProperty$1(Player, "XgVideoProxy", null);
|
|
6398
|
+
Player.instManager = InstManager.getInstance();
|
|
6265
6399
|
var index_min = "";
|
|
6266
6400
|
var Level = /* @__PURE__ */ ((Level2) => {
|
|
6267
6401
|
Level2["Fatal"] = "Fatal";
|
|
@@ -6404,6 +6538,14 @@ const ERROR_INFO = {
|
|
|
6404
6538
|
messageTextKey: "MODULE_LOAD_ERROR",
|
|
6405
6539
|
level: "Fatal"
|
|
6406
6540
|
/* Fatal */
|
|
6541
|
+
},
|
|
6542
|
+
[
|
|
6543
|
+
7100
|
|
6544
|
+
/* DRM_LICENSE */
|
|
6545
|
+
]: {
|
|
6546
|
+
messageTextKey: "DRM_LICENSE",
|
|
6547
|
+
level: "Fatal"
|
|
6548
|
+
/* Fatal */
|
|
6407
6549
|
}
|
|
6408
6550
|
};
|
|
6409
6551
|
const ERROR_TYPE_INFO = {
|
|
@@ -6473,7 +6615,12 @@ const ERROR_TYPE_INFO = {
|
|
|
6473
6615
|
}
|
|
6474
6616
|
};
|
|
6475
6617
|
let VeError$1 = class VeError extends Error {
|
|
6476
|
-
/**
|
|
6618
|
+
/** {zh}
|
|
6619
|
+
* @hidden
|
|
6620
|
+
* @param error
|
|
6621
|
+
* @param i18n
|
|
6622
|
+
*/
|
|
6623
|
+
/** {en}
|
|
6477
6624
|
* @hidden
|
|
6478
6625
|
* @param error
|
|
6479
6626
|
* @param i18n
|
|
@@ -6486,16 +6633,25 @@ let VeError$1 = class VeError extends Error {
|
|
|
6486
6633
|
const message = (i18n == null ? void 0 : i18n.getText(errorInfo == null ? void 0 : errorInfo.messageTextKey)) ?? (errorInfo == null ? void 0 : errorInfo.message) ?? ((_a = errorInfo == null ? void 0 : errorInfo.error) == null ? void 0 : _a.message) ?? (i18n == null ? void 0 : i18n.getText("UNKNOWN"));
|
|
6487
6634
|
super(message);
|
|
6488
6635
|
/**
|
|
6489
|
-
* @brief
|
|
6636
|
+
* @brief 错误码。
|
|
6637
|
+
*/
|
|
6638
|
+
/** {en}
|
|
6639
|
+
* @brief The error code.
|
|
6490
6640
|
*/
|
|
6491
6641
|
__publicField(this, "errorCode");
|
|
6492
|
-
/**
|
|
6642
|
+
/** {zh}
|
|
6493
6643
|
* @brief 错误等级。
|
|
6494
6644
|
*/
|
|
6645
|
+
/** {en}
|
|
6646
|
+
* @brief The error level.
|
|
6647
|
+
*/
|
|
6495
6648
|
__publicField(this, "level");
|
|
6496
|
-
/**
|
|
6649
|
+
/** {zh}
|
|
6497
6650
|
* @brief 其他错误信息。
|
|
6498
6651
|
*/
|
|
6652
|
+
/** {en}
|
|
6653
|
+
* @brief Other error messages.
|
|
6654
|
+
*/
|
|
6499
6655
|
__publicField(this, "ext");
|
|
6500
6656
|
this.errorCode = (errorInfo == null ? void 0 : errorInfo.errorCode) ?? "UNKNOWN";
|
|
6501
6657
|
this.level = (errorInfo == null ? void 0 : errorInfo.level) ?? "Error";
|
|
@@ -6559,7 +6715,7 @@ var Poster = /* @__PURE__ */ function(_Plugin) {
|
|
|
6559
6715
|
}
|
|
6560
6716
|
}, {
|
|
6561
6717
|
key: "show",
|
|
6562
|
-
value: function show() {
|
|
6718
|
+
value: function show(value) {
|
|
6563
6719
|
util$1.removeClass(this.root, "hide");
|
|
6564
6720
|
}
|
|
6565
6721
|
}, {
|
|
@@ -6638,10 +6794,11 @@ var Poster = /* @__PURE__ */ function(_Plugin) {
|
|
|
6638
6794
|
}, {
|
|
6639
6795
|
key: "render",
|
|
6640
6796
|
value: function render() {
|
|
6641
|
-
var _this$config = this.config, poster = _this$config.poster, hideCanplay = _this$config.hideCanplay, fillMode = _this$config.fillMode;
|
|
6797
|
+
var _this$config = this.config, poster = _this$config.poster, hideCanplay = _this$config.hideCanplay, fillMode = _this$config.fillMode, notHidden = _this$config.notHidden;
|
|
6642
6798
|
var _bg = this.getBgSize(fillMode);
|
|
6643
6799
|
var style = poster ? "background-image:url(".concat(poster, ");").concat(_bg) : _bg;
|
|
6644
|
-
|
|
6800
|
+
var className = notHidden ? "xg-not-hidden" : hideCanplay ? "xg-showplay" : "";
|
|
6801
|
+
return '<xg-poster class="xgplayer-poster '.concat(className, '" style="').concat(style, '">\n </xg-poster>');
|
|
6645
6802
|
}
|
|
6646
6803
|
}], [{
|
|
6647
6804
|
key: "pluginName",
|
|
@@ -6654,6 +6811,7 @@ var Poster = /* @__PURE__ */ function(_Plugin) {
|
|
|
6654
6811
|
return {
|
|
6655
6812
|
isEndedShow: true,
|
|
6656
6813
|
hideCanplay: false,
|
|
6814
|
+
notHidden: false,
|
|
6657
6815
|
poster: "",
|
|
6658
6816
|
fillMode: "fixWidth"
|
|
6659
6817
|
};
|
|
@@ -6797,7 +6955,7 @@ var Start = /* @__PURE__ */ function(_Plugin) {
|
|
|
6797
6955
|
}
|
|
6798
6956
|
}, {
|
|
6799
6957
|
key: "show",
|
|
6800
|
-
value: function show() {
|
|
6958
|
+
value: function show(value) {
|
|
6801
6959
|
util$1.removeClass(this.root, "hide");
|
|
6802
6960
|
}
|
|
6803
6961
|
}, {
|
|
@@ -7759,14 +7917,14 @@ var PCPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
7759
7917
|
key: "initEvents",
|
|
7760
7918
|
value: function initEvents() {
|
|
7761
7919
|
var _this3 = this;
|
|
7762
|
-
var _this$player = this.player,
|
|
7920
|
+
var _this$player = this.player, media = _this$player.media, root2 = _this$player.root;
|
|
7763
7921
|
var enableContextmenu = this.playerConfig.enableContextmenu;
|
|
7764
7922
|
root2 && root2.addEventListener("click", this.onVideoClick, false);
|
|
7765
7923
|
root2 && root2.addEventListener("dblclick", this.onVideoDblClick, false);
|
|
7766
7924
|
Object.keys(MOUSE_EVENTS).map(function(item) {
|
|
7767
7925
|
root2.addEventListener(item, _this3[MOUSE_EVENTS[item]], false);
|
|
7768
7926
|
});
|
|
7769
|
-
enableContextmenu &&
|
|
7927
|
+
!enableContextmenu && media && media.addEventListener("contextmenu", this.onContextmenu, false);
|
|
7770
7928
|
}
|
|
7771
7929
|
}, {
|
|
7772
7930
|
key: "switchPlayPause",
|
|
@@ -9490,16 +9648,6 @@ var Fullscreen = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
9490
9648
|
}
|
|
9491
9649
|
}
|
|
9492
9650
|
}
|
|
9493
|
-
}, {
|
|
9494
|
-
key: "show",
|
|
9495
|
-
value: function show() {
|
|
9496
|
-
_get(_getPrototypeOf(Fullscreen2.prototype), "show", this).call(this);
|
|
9497
|
-
}
|
|
9498
|
-
}, {
|
|
9499
|
-
key: "hide",
|
|
9500
|
-
value: function hide() {
|
|
9501
|
-
_get(_getPrototypeOf(Fullscreen2.prototype), "hide", this).call(this);
|
|
9502
|
-
}
|
|
9503
9651
|
}, {
|
|
9504
9652
|
key: "render",
|
|
9505
9653
|
value: function render() {
|
|
@@ -9955,11 +10103,14 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
9955
10103
|
}, 0);
|
|
9956
10104
|
!paused && player.mediaPlay();
|
|
9957
10105
|
_this3.setAttr("data-state", "normal");
|
|
10106
|
+
_this3.pipWindow = null;
|
|
9958
10107
|
player.emit(PIP_CHANGE, false);
|
|
9959
10108
|
};
|
|
9960
10109
|
this.enterPIPCallback = function(e3) {
|
|
9961
10110
|
player.emit(PIP_CHANGE, true);
|
|
9962
|
-
|
|
10111
|
+
if (e3 !== null && e3 !== void 0 && e3.pictureInPictureWindow) {
|
|
10112
|
+
_this3.pipWindow = e3.pictureInPictureWindow;
|
|
10113
|
+
}
|
|
9963
10114
|
_this3.setAttr("data-state", "pip");
|
|
9964
10115
|
};
|
|
9965
10116
|
this.onWebkitpresentationmodechanged = function(e3) {
|
|
@@ -9980,10 +10131,33 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
9980
10131
|
PIP2.checkWebkitSetPresentationMode(player.media) && player.media.addEventListener("webkitpresentationmodechanged", this.onWebkitpresentationmodechanged);
|
|
9981
10132
|
}
|
|
9982
10133
|
}
|
|
10134
|
+
}, {
|
|
10135
|
+
key: "copyStyleIntoPiPWindow",
|
|
10136
|
+
value: function copyStyleIntoPiPWindow(pipWin) {
|
|
10137
|
+
var textContent = _toConsumableArray(document.styleSheets).map(function(style2) {
|
|
10138
|
+
try {
|
|
10139
|
+
return _toConsumableArray(style2.cssRules).map(function(rule) {
|
|
10140
|
+
return rule.cssText;
|
|
10141
|
+
}).join("");
|
|
10142
|
+
} catch (e3) {
|
|
10143
|
+
var link = document.createElement("link");
|
|
10144
|
+
link.rel = "stylesheet";
|
|
10145
|
+
link.type = style2.type;
|
|
10146
|
+
link.media = style2.media;
|
|
10147
|
+
link.href = style2.href;
|
|
10148
|
+
pipWin.document.head.appendChild(link);
|
|
10149
|
+
}
|
|
10150
|
+
return "";
|
|
10151
|
+
}).filter(Boolean).join("\n");
|
|
10152
|
+
var style = document.createElement("style");
|
|
10153
|
+
style.textContent = textContent;
|
|
10154
|
+
pipWin.document.head.appendChild(style);
|
|
10155
|
+
}
|
|
9983
10156
|
}, {
|
|
9984
10157
|
key: "requestPIP",
|
|
9985
10158
|
value: function requestPIP() {
|
|
9986
|
-
var
|
|
10159
|
+
var _this4 = this;
|
|
10160
|
+
var player = this.player, playerConfig = this.playerConfig, config = this.config;
|
|
9987
10161
|
if (!this.isPIPAvailable() || this.isPip) {
|
|
9988
10162
|
return;
|
|
9989
10163
|
}
|
|
@@ -9992,7 +10166,62 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
9992
10166
|
if (poster) {
|
|
9993
10167
|
player.media.poster = util$1.typeOf(poster) === "String" ? poster : poster.poster;
|
|
9994
10168
|
}
|
|
9995
|
-
|
|
10169
|
+
if (config.preferDocument && this.isDocPIPAvailable()) {
|
|
10170
|
+
var pipOptions = {};
|
|
10171
|
+
if (config.width && config.height) {
|
|
10172
|
+
pipOptions.width = config.width;
|
|
10173
|
+
pipOptions.height = config.height;
|
|
10174
|
+
} else {
|
|
10175
|
+
var playerRect = player.root.getBoundingClientRect();
|
|
10176
|
+
pipOptions.width = playerRect.width;
|
|
10177
|
+
pipOptions.height = playerRect.height;
|
|
10178
|
+
}
|
|
10179
|
+
documentPictureInPicture.requestWindow(pipOptions).then(function(pipWin) {
|
|
10180
|
+
var docPiPNode = config.docPiPNode, docPiPStyle = config.docPiPStyle;
|
|
10181
|
+
_this4.enterPIPCallback();
|
|
10182
|
+
var pipRoot = docPiPNode || player.root;
|
|
10183
|
+
var parentNode = pipRoot.parentElement;
|
|
10184
|
+
var previousSibling = pipRoot.previousSibling;
|
|
10185
|
+
var nextSibling = pipRoot.nextSibling;
|
|
10186
|
+
_this4.copyStyleIntoPiPWindow(pipWin);
|
|
10187
|
+
var styles = document.createElement("style");
|
|
10188
|
+
styles.append("body{padding:0; margin:0;}");
|
|
10189
|
+
if (docPiPStyle) {
|
|
10190
|
+
var cssContent = "";
|
|
10191
|
+
if (typeof docPiPStyle === "string") {
|
|
10192
|
+
cssContent = docPiPStyle;
|
|
10193
|
+
} else if (typeof docPiPStyle === "function") {
|
|
10194
|
+
cssContent = docPiPStyle.call(config);
|
|
10195
|
+
}
|
|
10196
|
+
if (cssContent) {
|
|
10197
|
+
styles.append(cssContent);
|
|
10198
|
+
}
|
|
10199
|
+
} else if (pipRoot === player.root) {
|
|
10200
|
+
styles.append("\n .xgplayer{width: 100%!important; height: 100%!important;}\n ");
|
|
10201
|
+
}
|
|
10202
|
+
pipWin.document.head.append(styles);
|
|
10203
|
+
pipWin.document.body.append(pipRoot);
|
|
10204
|
+
pipWin.addEventListener("pagehide", function(event) {
|
|
10205
|
+
if (parentNode) {
|
|
10206
|
+
if (nextSibling) {
|
|
10207
|
+
parentNode.insertBefore(pipRoot, nextSibling);
|
|
10208
|
+
} else if (previousSibling) {
|
|
10209
|
+
parentNode.insertBefore(pipRoot, previousSibling.nextSibling);
|
|
10210
|
+
} else {
|
|
10211
|
+
parentNode.appendChild(pipRoot);
|
|
10212
|
+
}
|
|
10213
|
+
} else {
|
|
10214
|
+
}
|
|
10215
|
+
_this4.leavePIPCallback();
|
|
10216
|
+
}, {
|
|
10217
|
+
once: true
|
|
10218
|
+
});
|
|
10219
|
+
});
|
|
10220
|
+
} else if (PIP2.checkWebkitSetPresentationMode(player.media)) {
|
|
10221
|
+
player.media.webkitSetPresentationMode("picture-in-picture");
|
|
10222
|
+
} else {
|
|
10223
|
+
player.media.requestPictureInPicture();
|
|
10224
|
+
}
|
|
9996
10225
|
return true;
|
|
9997
10226
|
} catch (reason) {
|
|
9998
10227
|
console.error("requestPiP", reason);
|
|
@@ -10005,7 +10234,14 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
10005
10234
|
var player = this.player;
|
|
10006
10235
|
try {
|
|
10007
10236
|
if (this.isPIPAvailable() && this.isPip) {
|
|
10008
|
-
|
|
10237
|
+
var _documentPictureInPic;
|
|
10238
|
+
if (this.isDocPIPAvailable() && (_documentPictureInPic = documentPictureInPicture) !== null && _documentPictureInPic !== void 0 && _documentPictureInPic.window) {
|
|
10239
|
+
documentPictureInPicture.window.close();
|
|
10240
|
+
} else if (PIP2.checkWebkitSetPresentationMode(player.media)) {
|
|
10241
|
+
player.media.webkitSetPresentationMode("inline");
|
|
10242
|
+
} else {
|
|
10243
|
+
document.exitPictureInPicture();
|
|
10244
|
+
}
|
|
10009
10245
|
}
|
|
10010
10246
|
return true;
|
|
10011
10247
|
} catch (reason) {
|
|
@@ -10016,15 +10252,21 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
10016
10252
|
}, {
|
|
10017
10253
|
key: "isPip",
|
|
10018
10254
|
get: function get() {
|
|
10255
|
+
var _documentPictureInPic2;
|
|
10019
10256
|
var player = this.player;
|
|
10020
|
-
return document.pictureInPictureElement && document.pictureInPictureElement === player.media || player.media.webkitPresentationMode === PresentationMode.PIP;
|
|
10257
|
+
return !!(this.isDocPIPAvailable() && (_documentPictureInPic2 = documentPictureInPicture) !== null && _documentPictureInPic2 !== void 0 && _documentPictureInPic2.window) || document.pictureInPictureElement && document.pictureInPictureElement === player.media || player.media.webkitPresentationMode === PresentationMode.PIP;
|
|
10021
10258
|
}
|
|
10022
10259
|
}, {
|
|
10023
10260
|
key: "isPIPAvailable",
|
|
10024
10261
|
value: function isPIPAvailable() {
|
|
10025
10262
|
var video = this.player.media;
|
|
10026
10263
|
var _isEnabled = util$1.typeOf(document.pictureInPictureEnabled) === "Boolean" ? document.pictureInPictureEnabled : true;
|
|
10027
|
-
return _isEnabled && (util$1.typeOf(video.disablePictureInPicture) === "Boolean" && !video.disablePictureInPicture || video.webkitSupportsPresentationMode && util$1.typeOf(video.webkitSetPresentationMode) === "Function");
|
|
10264
|
+
return _isEnabled && (util$1.typeOf(video.disablePictureInPicture) === "Boolean" && !video.disablePictureInPicture || video.webkitSupportsPresentationMode && util$1.typeOf(video.webkitSetPresentationMode) === "Function") || this.isDocPIPAvailable();
|
|
10265
|
+
}
|
|
10266
|
+
}, {
|
|
10267
|
+
key: "isDocPIPAvailable",
|
|
10268
|
+
value: function isDocPIPAvailable() {
|
|
10269
|
+
return "documentPictureInPicture" in window && /^(https|file)/.test(location.protocol);
|
|
10028
10270
|
}
|
|
10029
10271
|
}, {
|
|
10030
10272
|
key: "destroy",
|
|
@@ -10056,7 +10298,12 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
10056
10298
|
return {
|
|
10057
10299
|
position: POSITIONS$2.CONTROLS_RIGHT,
|
|
10058
10300
|
index: 6,
|
|
10059
|
-
showIcon: false
|
|
10301
|
+
showIcon: false,
|
|
10302
|
+
preferDocument: false,
|
|
10303
|
+
width: void 0,
|
|
10304
|
+
height: void 0,
|
|
10305
|
+
docPiPNode: void 0,
|
|
10306
|
+
docPiPStyle: void 0
|
|
10060
10307
|
};
|
|
10061
10308
|
}
|
|
10062
10309
|
}, {
|
|
@@ -12124,7 +12371,7 @@ class DefinitionPlugin extends OptionsIcon {
|
|
|
12124
12371
|
}
|
|
12125
12372
|
this._waitingStartTime = Date.now();
|
|
12126
12373
|
const currentTime = this.player.currentTime;
|
|
12127
|
-
this._timer = setTimeout(() => {
|
|
12374
|
+
this._timer = window.setTimeout(() => {
|
|
12128
12375
|
if (this.player && this.player.currentTime <= currentTime + 0.1) {
|
|
12129
12376
|
this.player.emit(Events$1.LONG_WAITING);
|
|
12130
12377
|
if (this.config.needFallback) {
|
|
@@ -12229,7 +12476,8 @@ const NAME_MAP = {
|
|
|
12229
12476
|
"plugin:hls": "veplayer.plugin.hls.[env].[ext]",
|
|
12230
12477
|
"plugin:shaka": "veplayer.plugin.shaka.[env].[ext]",
|
|
12231
12478
|
"plugin:rtm": "veplayer.plugin.rtm.[env].[ext]",
|
|
12232
|
-
"plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]"
|
|
12479
|
+
"plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]",
|
|
12480
|
+
"plugin:drm": "veplayer.plugin.drm.[env].[ext]"
|
|
12233
12481
|
};
|
|
12234
12482
|
var DynamicModule = /* @__PURE__ */ ((DynamicModule2) => {
|
|
12235
12483
|
DynamicModule2["BizVod"] = "biz:vod";
|
|
@@ -12240,6 +12488,7 @@ var DynamicModule = /* @__PURE__ */ ((DynamicModule2) => {
|
|
|
12240
12488
|
DynamicModule2["PluginShaka"] = "plugin:shaka";
|
|
12241
12489
|
DynamicModule2["PluginRtm"] = "plugin:rtm";
|
|
12242
12490
|
DynamicModule2["PluginXgvideo"] = "plugin:xgvideo";
|
|
12491
|
+
DynamicModule2["PluginDrm"] = "plugin:drm";
|
|
12243
12492
|
return DynamicModule2;
|
|
12244
12493
|
})(DynamicModule || {});
|
|
12245
12494
|
class Loader {
|
|
@@ -12283,13 +12532,13 @@ class Loader {
|
|
|
12283
12532
|
src: src2 ?? moduleSrc,
|
|
12284
12533
|
name,
|
|
12285
12534
|
state: 0,
|
|
12286
|
-
exports: {}
|
|
12535
|
+
exports: { __PLUGIN_NAME__: name }
|
|
12287
12536
|
};
|
|
12288
12537
|
this.modules[name] = module;
|
|
12289
12538
|
this.mountPromiseMap[name] = this._mount(module);
|
|
12290
12539
|
return this.mountPromiseMap[name];
|
|
12291
12540
|
});
|
|
12292
|
-
__publicField(this, "
|
|
12541
|
+
__publicField(this, "registerPlugin", (name, exports) => {
|
|
12293
12542
|
if (!this._moduleSystem) {
|
|
12294
12543
|
throw new Error(
|
|
12295
12544
|
`You have to specify moduleSystem first, call setModuleSystem(moduleSystem) to set module system`
|
|
@@ -12316,6 +12565,11 @@ class Loader {
|
|
|
12316
12565
|
}
|
|
12317
12566
|
return this.modules[name].exports;
|
|
12318
12567
|
});
|
|
12568
|
+
__publicField(this, "register", (exports) => {
|
|
12569
|
+
return exports.map((exportModule) => {
|
|
12570
|
+
return this.registerPlugin(exportModule.__PLUGIN_NAME__, exportModule);
|
|
12571
|
+
});
|
|
12572
|
+
});
|
|
12319
12573
|
this._baseUrl = options.baseUrl;
|
|
12320
12574
|
}
|
|
12321
12575
|
get baseUrl() {
|
|
@@ -12355,6 +12609,7 @@ const baseUrl = src.slice(0, src.lastIndexOf("/"));
|
|
|
12355
12609
|
const loader = new Loader({
|
|
12356
12610
|
baseUrl
|
|
12357
12611
|
});
|
|
12612
|
+
const registerPlugin = loader.registerPlugin;
|
|
12358
12613
|
const register2 = loader.register;
|
|
12359
12614
|
function setModuleSystem(moduleSystem) {
|
|
12360
12615
|
loader.setModuleSystem(moduleSystem);
|
|
@@ -12544,7 +12799,7 @@ class Autoplay extends Plugin {
|
|
|
12544
12799
|
}
|
|
12545
12800
|
wxCanPlayFn() {
|
|
12546
12801
|
window.WeixinJSBridge && window.WeixinJSBridge.invoke("getNetworkType", {}, () => {
|
|
12547
|
-
this._wxTimer = setTimeout(() => {
|
|
12802
|
+
this._wxTimer = window.setTimeout(() => {
|
|
12548
12803
|
this._wxTimer && clearTimeout(this._wxTimer);
|
|
12549
12804
|
const ret = this.player.play();
|
|
12550
12805
|
if (ret && ret.then) {
|
|
@@ -12618,8 +12873,8 @@ class Autoplay extends Plugin {
|
|
|
12618
12873
|
this._state.showUnmuteBt = true;
|
|
12619
12874
|
this._state.mode = 1;
|
|
12620
12875
|
this.renderUnmuteBt();
|
|
12621
|
-
this._timer = setTimeout(() => {
|
|
12622
|
-
this._timer && clearTimeout(this._timer);
|
|
12876
|
+
this._timer = window.setTimeout(() => {
|
|
12877
|
+
this._timer && window.clearTimeout(this._timer);
|
|
12623
12878
|
const ret = this.player.play();
|
|
12624
12879
|
if (ret && ret.then) {
|
|
12625
12880
|
ret.then(() => {
|
|
@@ -13022,6 +13277,7 @@ const EN$1 = {
|
|
|
13022
13277
|
MEDIA_ERR_CODEC_NOT_SUPPORTED: "Audio/video codec is not supported",
|
|
13023
13278
|
MEDIA_ERR_URL_EMPTY: "The stream address is not specified",
|
|
13024
13279
|
DRM: "Permission verification failed",
|
|
13280
|
+
DRM_LICENSE: "Commercial DRM Permission verification failed",
|
|
13025
13281
|
OTHER: "Unknown error",
|
|
13026
13282
|
RUNTIME: "An error occurred, Please try again",
|
|
13027
13283
|
MODULE_LOAD_ERROR: "CDN fetch error",
|
|
@@ -13048,6 +13304,7 @@ const ZH_CN$1 = {
|
|
|
13048
13304
|
MEDIA_ERR_CODEC_NOT_SUPPORTED: "不支持的音频/视频格式",
|
|
13049
13305
|
MEDIA_ERR_URL_EMPTY: "当前播放地址为空",
|
|
13050
13306
|
DRM: "权限验证失败",
|
|
13307
|
+
DRM_LICENSE: "商业 DRM LICENSE 鉴权失败",
|
|
13051
13308
|
OTHER: "其他报错",
|
|
13052
13309
|
RUNTIME: "播放异常,请重试",
|
|
13053
13310
|
MODULE_LOAD_ERROR: "插件模块加载异常",
|
|
@@ -13143,7 +13400,10 @@ const transformOption = (options) => {
|
|
|
13143
13400
|
return xgOptions;
|
|
13144
13401
|
};
|
|
13145
13402
|
class VePlayerBase {
|
|
13146
|
-
/**
|
|
13403
|
+
/** {zh}
|
|
13404
|
+
* @hidden
|
|
13405
|
+
*/
|
|
13406
|
+
/** {en}
|
|
13147
13407
|
* @hidden
|
|
13148
13408
|
*/
|
|
13149
13409
|
constructor(options = {}) {
|
|
@@ -13196,7 +13456,7 @@ class VePlayerBase {
|
|
|
13196
13456
|
this._errorCallback = (err) => this._handleFallback(err);
|
|
13197
13457
|
this._player.on(ERROR, this._errorCallback);
|
|
13198
13458
|
}
|
|
13199
|
-
/**
|
|
13459
|
+
/** {zh}
|
|
13200
13460
|
* @brief 获取视频的就绪状态,其状态枚举值、枚举名称和说明如下:
|
|
13201
13461
|
* - `0`:HAVE_NOTHING,没有关于媒体资源的可用信息
|
|
13202
13462
|
* - `1`:HAVE_METADATA,已检索到足够多的媒体资源来初始化元数据, 快进/快退不会引发异常
|
|
@@ -13204,68 +13464,107 @@ class VePlayerBase {
|
|
|
13204
13464
|
* - `3`:HAVE_FUTURE_DATA,当前播放位置以及未来至少一小段时间的数据是可用的(至少有两帧以上的数据)
|
|
13205
13465
|
* - `4`:HAVE_ENOUGH_DATA,有足够的数据可用,并且下载速率足够,媒体可以不间断地播放到最后
|
|
13206
13466
|
*/
|
|
13467
|
+
/** {en}
|
|
13468
|
+
* @brief Gets the readiness of the video.
|
|
13469
|
+
* - `0`: HAVE_NOTHING, which means there is no information about the media resources.
|
|
13470
|
+
* - `1`: HAVE_METADATA, which means enough media resources have been retrieved to initialize the metadata and fast-forward/rewind will not raise an exception.
|
|
13471
|
+
* - `2`: HAVE_CURRENT_DATA, which means the data for the current playback position is available, but there is not enough data to play the next frame.
|
|
13472
|
+
* - `3`: HAVE_FUTURE_DATA, which means there is enough data for the current playback position and at least a short period in the future (at least two following frames).
|
|
13473
|
+
* - `4`: HAVE_ENOUGH_DATA, which means there is enough data and the download rate is sufficient for the video to be played without interruption until the end.
|
|
13474
|
+
*/
|
|
13207
13475
|
get readyState() {
|
|
13208
13476
|
return this._player.readyState;
|
|
13209
13477
|
}
|
|
13210
|
-
/**
|
|
13478
|
+
/** {zh}
|
|
13211
13479
|
* @brief 获取当前已缓冲的时间范围。
|
|
13212
13480
|
*/
|
|
13481
|
+
/** {en}
|
|
13482
|
+
* @brief Gets the currently buffered time range.
|
|
13483
|
+
*/
|
|
13213
13484
|
get buffered() {
|
|
13214
13485
|
return this._player.buffered;
|
|
13215
13486
|
}
|
|
13216
|
-
/**
|
|
13487
|
+
/** {zh}
|
|
13217
13488
|
* @brief 获取已经播放的音频/视频的时间范围。
|
|
13218
13489
|
*/
|
|
13490
|
+
/** {en}
|
|
13491
|
+
* @brief Gets the time range of the audio/video that has been played.
|
|
13492
|
+
*/
|
|
13219
13493
|
get played() {
|
|
13220
13494
|
return this._player.played;
|
|
13221
13495
|
}
|
|
13222
|
-
/**
|
|
13496
|
+
/** {zh}
|
|
13223
13497
|
* @brief 设置/获取视频当前的播放时间, 单位为 s。
|
|
13224
13498
|
*/
|
|
13499
|
+
/** {en}
|
|
13500
|
+
* @brief Sets or gets the current playback position of the video, in seconds.
|
|
13501
|
+
*/
|
|
13225
13502
|
get cumulateTime() {
|
|
13226
13503
|
return this._player.cumulateTime;
|
|
13227
13504
|
}
|
|
13228
|
-
/**
|
|
13505
|
+
/** {zh}
|
|
13229
13506
|
* @brief 获取是否处于焦点状态,处于焦点状态会显示控制栏。
|
|
13230
13507
|
*/
|
|
13508
|
+
/** {en}
|
|
13509
|
+
* @brief Gets whether the player has focus. The control bar is displayed when the player has focus.
|
|
13510
|
+
*/
|
|
13231
13511
|
get isFocused() {
|
|
13232
13512
|
return this._player.isActive;
|
|
13233
13513
|
}
|
|
13234
|
-
/**
|
|
13514
|
+
/** {zh}
|
|
13235
13515
|
* @brief 获取播放器是否处于全屏状态。
|
|
13236
13516
|
*/
|
|
13517
|
+
/** {en}
|
|
13518
|
+
* @brief Gets whether the player is in full-screen mode, in which the player covers the entire desktop.
|
|
13519
|
+
*/
|
|
13237
13520
|
get isFullscreen() {
|
|
13238
13521
|
return this._player.isFullscreen;
|
|
13239
13522
|
}
|
|
13240
|
-
/**
|
|
13523
|
+
/** {zh}
|
|
13241
13524
|
* @brief 获取播放器是否处于网页全屏状态。
|
|
13242
13525
|
*/
|
|
13526
|
+
/** {en}
|
|
13527
|
+
* @brief Gets whether the player is in full-window mode, in which the player covers the entire browser window.
|
|
13528
|
+
*/
|
|
13243
13529
|
get isCssFullscreen() {
|
|
13244
13530
|
return this._player.isCssfullScreen;
|
|
13245
13531
|
}
|
|
13246
|
-
/**
|
|
13532
|
+
/** {zh}
|
|
13247
13533
|
* @brief 获取视频的网络状态,其状态枚举值、枚举名称和说明如下:
|
|
13248
13534
|
* - `0`:NETWORK_EMPTY,目前还没有数据,readyState 的值是 HAVE_NOTHING
|
|
13249
13535
|
* - `1`:NETWORK_IDLE,HTMLMediaElement 处于活动状态并已选择资源,但未使用网络
|
|
13250
13536
|
* - `2`:NETWORK_LOADING,浏览器正在下载 HTMLMediaElement 数据
|
|
13251
13537
|
* - `3`:NETWORK_NO_SOURCE,未找到 HTMLMediaElement src。
|
|
13252
13538
|
*/
|
|
13539
|
+
/** {en}
|
|
13540
|
+
* @brief Gets the network condition of the video.
|
|
13541
|
+
* - `0`: NETWORK_EMPTY, which means there is no data yet, and `readyState` is `HAVE_NOTHING`.
|
|
13542
|
+
* - `1`: NETWORK_IDLE, which means the `HTMLMediaElement` element is active and the resources have been selected, but the network is not in use.
|
|
13543
|
+
* - `2`: NETWORK_LOADING, which means the browser is downloading the data of the `HTMLMediaElement` element.
|
|
13544
|
+
* - `3`: NETWORK_NO_SOURCE, the media source is not found according to the `src` property of the `HTMLMediaElement` element.
|
|
13545
|
+
*/
|
|
13253
13546
|
get networkState() {
|
|
13254
13547
|
return this._player.networkState;
|
|
13255
13548
|
}
|
|
13256
|
-
/**
|
|
13549
|
+
/** {zh}
|
|
13257
13550
|
* @brief 获取当前视频是否处于暂停状态。
|
|
13258
13551
|
*/
|
|
13552
|
+
/** {en}
|
|
13553
|
+
* @brief Gets whether the current video is suspended.
|
|
13554
|
+
*/
|
|
13259
13555
|
get paused() {
|
|
13260
13556
|
return this._player.paused;
|
|
13261
13557
|
}
|
|
13262
|
-
/**
|
|
13558
|
+
/** {zh}
|
|
13263
13559
|
* @brief 获取当前视频是否播放结束。
|
|
13264
13560
|
*/
|
|
13561
|
+
/** {en}
|
|
13562
|
+
* @brief Gets whether the current video has finished playing.
|
|
13563
|
+
*/
|
|
13265
13564
|
get ended() {
|
|
13266
13565
|
return this._player.ended;
|
|
13267
13566
|
}
|
|
13268
|
-
/**
|
|
13567
|
+
/** {zh}
|
|
13269
13568
|
* @brief 获取播放器当前所处的状态,其状态枚举值、枚举名称和说明如下:
|
|
13270
13569
|
* - `0`:ERROR,播放出现错误
|
|
13271
13570
|
* - `1`:INITIAL,初始化
|
|
@@ -13277,81 +13576,130 @@ class VePlayerBase {
|
|
|
13277
13576
|
* - `7`:ENDED,播放结束
|
|
13278
13577
|
* - `8`:DESTROYED,播放器实例处于已被销毁
|
|
13279
13578
|
*/
|
|
13579
|
+
/** {en}
|
|
13580
|
+
* @brief Gets the current state of the player.
|
|
13581
|
+
* - `0`: ERROR, which means a playback error occurred
|
|
13582
|
+
* - `1`: INITIAL, which means initialization
|
|
13583
|
+
* - `2`: READY, which means the configuration/event/plug-in has been initialized/bound/instantiated
|
|
13584
|
+
* - `3`: ATTACHING, which means the media object is being mounted.
|
|
13585
|
+
* - `4`: ATTACHED, which means the media object has been mounted in the DOM
|
|
13586
|
+
* - `5`: NOTALLOW, which means the playback is blocked
|
|
13587
|
+
* - `6`: RUNNING, which means the playback has started successfully
|
|
13588
|
+
* - `7`: ENDED, which means the playback has ended
|
|
13589
|
+
* - `8`: DESTROYED, which means the player instance is destroyed
|
|
13590
|
+
*/
|
|
13280
13591
|
get state() {
|
|
13281
13592
|
return this._player.state;
|
|
13282
13593
|
}
|
|
13283
|
-
/**
|
|
13594
|
+
/** {zh}
|
|
13284
13595
|
* 获取当前播放视频的拉流地址。
|
|
13285
13596
|
*/
|
|
13597
|
+
/** {en}
|
|
13598
|
+
* Gets the current pull stream address.
|
|
13599
|
+
*/
|
|
13286
13600
|
get url() {
|
|
13287
13601
|
return this._player.config.url;
|
|
13288
13602
|
}
|
|
13289
|
-
/**
|
|
13290
|
-
* @brief
|
|
13603
|
+
/** {zh}
|
|
13604
|
+
* @brief 获取当前播放视频的线路名称唯一标识(name)。
|
|
13605
|
+
*/
|
|
13606
|
+
/** {en}
|
|
13607
|
+
* @brief Gets the current playback source ID.
|
|
13291
13608
|
*/
|
|
13292
13609
|
get source() {
|
|
13293
13610
|
var _a;
|
|
13294
13611
|
return (_a = this._sourceManager.source) == null ? void 0 : _a.name;
|
|
13295
13612
|
}
|
|
13296
|
-
/**
|
|
13613
|
+
/** {zh}
|
|
13297
13614
|
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|
|
13298
13615
|
*/
|
|
13616
|
+
/** {en}
|
|
13617
|
+
* @brief Gets the current resolution ID.
|
|
13618
|
+
*/
|
|
13299
13619
|
get definition() {
|
|
13300
13620
|
var _a;
|
|
13301
13621
|
return (_a = this._sourceManager.definition) == null ? void 0 : _a.definition;
|
|
13302
13622
|
}
|
|
13303
|
-
/**
|
|
13623
|
+
/** {zh}
|
|
13304
13624
|
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
13305
13625
|
*/
|
|
13626
|
+
/** {en}
|
|
13627
|
+
* @brief Gets the player's cross-domain configurations. For more information, refer to [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin).
|
|
13628
|
+
*/
|
|
13306
13629
|
get crossOrigin() {
|
|
13307
13630
|
return this._player.crossOrigin;
|
|
13308
13631
|
}
|
|
13309
|
-
/**
|
|
13632
|
+
/** {zh}
|
|
13310
13633
|
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
13311
13634
|
*/
|
|
13635
|
+
/** {en}
|
|
13636
|
+
* @brief Sets the player's cross-domain configurations. For more information, refer to the [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin).
|
|
13637
|
+
*/
|
|
13312
13638
|
set crossOrigin(crossOrigin) {
|
|
13313
13639
|
this._player.crossOrigin = crossOrigin;
|
|
13314
13640
|
}
|
|
13315
|
-
/**
|
|
13641
|
+
/** {zh}
|
|
13316
13642
|
* @brief 获取和设置视频的音量,取值范围为 [0,1]。
|
|
13317
13643
|
*/
|
|
13644
|
+
/** {en}
|
|
13645
|
+
* @brief Gets the volume of the video. The value range is [0,1].
|
|
13646
|
+
*/
|
|
13318
13647
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
13319
13648
|
get volume() {
|
|
13320
13649
|
return this._player.volume;
|
|
13321
13650
|
}
|
|
13322
|
-
/**
|
|
13651
|
+
/** {zh}
|
|
13323
13652
|
* @brief 获取和设置视频的音量,取值范围为 [0,1]。
|
|
13324
13653
|
*/
|
|
13654
|
+
/** {en}
|
|
13655
|
+
* @brief Sets the volume of the video. Valid range: [0,1].
|
|
13656
|
+
*/
|
|
13325
13657
|
set volume(volume) {
|
|
13326
13658
|
this._player.volume = volume;
|
|
13327
13659
|
}
|
|
13328
|
-
/**
|
|
13660
|
+
/** {zh}
|
|
13329
13661
|
* @brief 获取和设置视频静音状态。
|
|
13330
13662
|
* - `true`:静音
|
|
13331
13663
|
* - `false`:非静音
|
|
13332
13664
|
*/
|
|
13665
|
+
/** {en}
|
|
13666
|
+
* @brief Gets whether the video is muted.
|
|
13667
|
+
* - `true`: Muted.
|
|
13668
|
+
* - `false`: Not muted.
|
|
13669
|
+
*/
|
|
13333
13670
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
13334
13671
|
get muted() {
|
|
13335
13672
|
return this._player.muted;
|
|
13336
13673
|
}
|
|
13337
|
-
/**
|
|
13674
|
+
/** {zh}
|
|
13338
13675
|
* @brief 获取和设置视频静音状态。
|
|
13339
13676
|
* - `true`:静音
|
|
13340
13677
|
* - `false`:非静音
|
|
13341
13678
|
*/
|
|
13679
|
+
/** {en}
|
|
13680
|
+
* @brief Mute or unmute the video.
|
|
13681
|
+
* - `true`: Mute the video.
|
|
13682
|
+
* - `false`: Unmute the video.
|
|
13683
|
+
*/
|
|
13342
13684
|
set muted(isMuted) {
|
|
13343
13685
|
this._player.muted = isMuted;
|
|
13344
13686
|
}
|
|
13345
|
-
/**
|
|
13687
|
+
/** {zh}
|
|
13346
13688
|
* @brief 获取和设置当前语言。
|
|
13347
13689
|
*/
|
|
13690
|
+
/** {en}
|
|
13691
|
+
* @brief Gets the current language.
|
|
13692
|
+
*/
|
|
13348
13693
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
13349
13694
|
get lang() {
|
|
13350
13695
|
return this._i18nManager.getLang();
|
|
13351
13696
|
}
|
|
13352
|
-
/**
|
|
13697
|
+
/** {zh}
|
|
13353
13698
|
* @brief 获取和设置当前语言。
|
|
13354
13699
|
*/
|
|
13700
|
+
/** {en}
|
|
13701
|
+
* @brief Sets the current language.
|
|
13702
|
+
*/
|
|
13355
13703
|
set lang(lang) {
|
|
13356
13704
|
var _a, _b;
|
|
13357
13705
|
if (this._player.lang === lang) {
|
|
@@ -13373,7 +13721,10 @@ class VePlayerBase {
|
|
|
13373
13721
|
get _src() {
|
|
13374
13722
|
return this._player.currentSrc;
|
|
13375
13723
|
}
|
|
13376
|
-
/**
|
|
13724
|
+
/** {zh}
|
|
13725
|
+
* @hidden
|
|
13726
|
+
*/
|
|
13727
|
+
/** {en}
|
|
13377
13728
|
* @hidden
|
|
13378
13729
|
*/
|
|
13379
13730
|
static async create(options = {}, Constructor) {
|
|
@@ -13403,11 +13754,16 @@ class VePlayerBase {
|
|
|
13403
13754
|
sourceManager
|
|
13404
13755
|
});
|
|
13405
13756
|
}
|
|
13406
|
-
/**
|
|
13757
|
+
/** {zh}
|
|
13407
13758
|
* @brief 调用此方法切换拉流地址、线路、清晰度。
|
|
13408
13759
|
* @param target 目标地址,可以是播放地址,也可以是线路和清晰度
|
|
13409
13760
|
* @param options 更多配置信息
|
|
13410
13761
|
*/
|
|
13762
|
+
/** {en}
|
|
13763
|
+
* @brief Switches the pull stream address, playback source, or resolution.
|
|
13764
|
+
* @param target The target pull stream address, playback source, or resolution.
|
|
13765
|
+
* @param options More configurations.
|
|
13766
|
+
*/
|
|
13411
13767
|
async switch(target, options) {
|
|
13412
13768
|
var _a, _b;
|
|
13413
13769
|
if (typeof target === "string" && this._sourceManager.sources.length === 1 && ((_b = (_a = this._sourceManager.sources) == null ? void 0 : _a[0].definitions) == null ? void 0 : _b.length) === 1) {
|
|
@@ -13424,20 +13780,31 @@ class VePlayerBase {
|
|
|
13424
13780
|
await this._switch(targetDefinition);
|
|
13425
13781
|
return targetDefinition;
|
|
13426
13782
|
}
|
|
13427
|
-
/**
|
|
13783
|
+
/** {zh}
|
|
13428
13784
|
* @brief 调用此方法更新拉流地址列表。
|
|
13429
13785
|
* @param playlist 要更新的播放列表。
|
|
13430
13786
|
* @param target 更新后默认播放的资源。
|
|
13431
13787
|
*/
|
|
13788
|
+
/** {en}
|
|
13789
|
+
* @brief Updates the list of pull stream addresses.
|
|
13790
|
+
* @param Playlist The updated list.
|
|
13791
|
+
* @param Target The default playback resource after the update.
|
|
13792
|
+
*/
|
|
13432
13793
|
updatePlaylist(playlist, target) {
|
|
13433
13794
|
const sourceManager = this._sourceManager.updateSources(playlist, target);
|
|
13434
13795
|
return this._switch(sourceManager.definition);
|
|
13435
13796
|
}
|
|
13436
13797
|
// TODO: 等西瓜播放器完善错误码后增加函数重载以提供更好的类型
|
|
13437
13798
|
/**
|
|
13799
|
+
/** {zh}
|
|
13438
13800
|
* @brief 调用此方法监听指定事件,事件处理函数只执行一次。
|
|
13439
13801
|
* @param event 表示事件的名称。
|
|
13440
|
-
* @param callback
|
|
13802
|
+
* @param callback 表示事件的回调函数。
|
|
13803
|
+
*/
|
|
13804
|
+
/** {en}
|
|
13805
|
+
* @brief Listens for a specified event. The event handler is executed only once.
|
|
13806
|
+
* @param event The event name.
|
|
13807
|
+
* @param callback The callback function for the event.
|
|
13441
13808
|
*/
|
|
13442
13809
|
once(event, callback) {
|
|
13443
13810
|
var _a;
|
|
@@ -13450,10 +13817,15 @@ class VePlayerBase {
|
|
|
13450
13817
|
this._player.once(xgEventName, xgCallback);
|
|
13451
13818
|
}
|
|
13452
13819
|
}
|
|
13453
|
-
/**
|
|
13820
|
+
/** {zh}
|
|
13454
13821
|
* @brief 调用此方法解绑或移除指定事件的事件监听。
|
|
13455
13822
|
* @param event 表示事件的名称。
|
|
13456
|
-
* @param callback
|
|
13823
|
+
* @param callback 表示事件的回调函数。
|
|
13824
|
+
*/
|
|
13825
|
+
/** {en}
|
|
13826
|
+
* @brief Stops listening for a specified event.
|
|
13827
|
+
* @param event The event name.
|
|
13828
|
+
* @param callback The callback function for the event.
|
|
13457
13829
|
*/
|
|
13458
13830
|
off(event, callback) {
|
|
13459
13831
|
var _a;
|
|
@@ -13464,26 +13836,39 @@ class VePlayerBase {
|
|
|
13464
13836
|
this._events[event].delete(callback);
|
|
13465
13837
|
}
|
|
13466
13838
|
}
|
|
13467
|
-
/**
|
|
13839
|
+
/** {zh}
|
|
13468
13840
|
* @brief 调用此方法触发指定事件。
|
|
13469
13841
|
* @param event 表示事件的名称。
|
|
13470
13842
|
* @param data 事件信息。
|
|
13471
13843
|
*/
|
|
13844
|
+
/** {en}
|
|
13845
|
+
* @brief Triggers a specified event.
|
|
13846
|
+
* @param event The event name.
|
|
13847
|
+
* @param data The event information.
|
|
13848
|
+
*/
|
|
13472
13849
|
emit(event, data) {
|
|
13473
13850
|
const { xgEventName } = this._transformEvent(event);
|
|
13474
13851
|
this._player.emit(xgEventName, data);
|
|
13475
13852
|
}
|
|
13476
|
-
/**
|
|
13853
|
+
/** {zh}
|
|
13477
13854
|
* @brief 调用此方法解绑或移除指定事件的所有事件监听。
|
|
13478
13855
|
*/
|
|
13856
|
+
/** {en}
|
|
13857
|
+
* @brief Stops listening to any player event.
|
|
13858
|
+
*/
|
|
13479
13859
|
offAll() {
|
|
13480
13860
|
this._events = {};
|
|
13481
13861
|
this._player.offAll();
|
|
13482
13862
|
}
|
|
13483
|
-
/**
|
|
13863
|
+
/** {zh}
|
|
13484
13864
|
* @brief 调用此方法监听指定事件。
|
|
13485
|
-
* @param event
|
|
13486
|
-
* @param callback
|
|
13865
|
+
* @param event 表示事件名称。
|
|
13866
|
+
* @param callback 表示事件的回调函数。
|
|
13867
|
+
*/
|
|
13868
|
+
/** {en}
|
|
13869
|
+
* @brief Listens for a specified event.
|
|
13870
|
+
* @param event The event name.
|
|
13871
|
+
* @param callback The callback function for the event.
|
|
13487
13872
|
*/
|
|
13488
13873
|
on(event, callback) {
|
|
13489
13874
|
var _a;
|
|
@@ -13496,102 +13881,153 @@ class VePlayerBase {
|
|
|
13496
13881
|
this._player.on(xgEventName, xgCallback);
|
|
13497
13882
|
}
|
|
13498
13883
|
}
|
|
13499
|
-
/**
|
|
13884
|
+
/** {zh}
|
|
13500
13885
|
* @brief 调用此方法开始播放 。
|
|
13501
13886
|
*/
|
|
13887
|
+
/** {en}
|
|
13888
|
+
* @brief Starts playback.
|
|
13889
|
+
*/
|
|
13502
13890
|
play() {
|
|
13503
13891
|
/* istanbul ignore next -- @preserve */
|
|
13504
13892
|
return this._player.play();
|
|
13505
13893
|
}
|
|
13506
|
-
/**
|
|
13894
|
+
/** {zh}
|
|
13507
13895
|
* @brief 调用此方法暂停播放。
|
|
13508
13896
|
*/
|
|
13897
|
+
/** {en}
|
|
13898
|
+
* @brief Pauses playback.
|
|
13899
|
+
*/
|
|
13509
13900
|
pause() {
|
|
13510
13901
|
/* istanbul ignore next -- @preserve */
|
|
13511
13902
|
return this._player.pause();
|
|
13512
13903
|
}
|
|
13513
|
-
/**
|
|
13904
|
+
/** {zh}
|
|
13514
13905
|
* @brief 调用此方法打开画中画。
|
|
13515
13906
|
*/
|
|
13907
|
+
/** {en}
|
|
13908
|
+
* @brief Turns on Picture-in-Picture (PIP).
|
|
13909
|
+
*/
|
|
13516
13910
|
requestPIP() {
|
|
13517
13911
|
var _a;
|
|
13518
13912
|
/* istanbul ignore next -- @preserve */
|
|
13519
13913
|
(_a = this._player.plugins.pip) == null ? void 0 : _a.requestPIP();
|
|
13520
13914
|
}
|
|
13521
|
-
/**
|
|
13915
|
+
/** {zh}
|
|
13522
13916
|
* @brief 调用此方法关闭画中画。
|
|
13523
13917
|
*/
|
|
13918
|
+
/** {en}
|
|
13919
|
+
* @brief Turns off Picture-in-Picture (PIP).
|
|
13920
|
+
*/
|
|
13524
13921
|
exitPIP() {
|
|
13525
13922
|
var _a;
|
|
13526
13923
|
/* istanbul ignore next -- @preserve */
|
|
13527
13924
|
(_a = this._player.plugins.pip) == null ? void 0 : _a.exitPIP();
|
|
13528
13925
|
}
|
|
13529
|
-
/**
|
|
13926
|
+
/** {zh}
|
|
13530
13927
|
* @brief 调用此方法重新拉流。
|
|
13531
13928
|
*/
|
|
13929
|
+
/** {en}
|
|
13930
|
+
* @brief Retries stream-pulling.
|
|
13931
|
+
*/
|
|
13532
13932
|
retry() {
|
|
13533
13933
|
return this._player.retry();
|
|
13534
13934
|
}
|
|
13535
|
-
/**
|
|
13935
|
+
/** {zh}
|
|
13536
13936
|
* @brief 播放器获取焦点,调用该方法 `veplayer.isFocused` 将会变为 `true`,并触发 `PLAYER_FOCUS` 事件。
|
|
13537
13937
|
* @param data 播放器获取焦点配置信息。
|
|
13538
13938
|
*/
|
|
13939
|
+
/** {en}
|
|
13940
|
+
* @brief The player gets focus. When the method is called, `veplayer.isFocused` will become `true` and the `PLAYER_FOCUS` event will be triggered.
|
|
13941
|
+
* @param data Related configurations.
|
|
13942
|
+
*/
|
|
13539
13943
|
focus(data) {
|
|
13540
13944
|
return this._player.focus(data);
|
|
13541
13945
|
}
|
|
13542
|
-
/**
|
|
13946
|
+
/** {zh}
|
|
13543
13947
|
* @brief 播放器失去焦点,调用该方法 `veplayer.isFocused` 将会变为 `false`,并触发 `PLAYER_BLUR` 事件。
|
|
13544
13948
|
* @param data 播放器失去焦点配置信息。
|
|
13545
13949
|
*/
|
|
13950
|
+
/** {en}
|
|
13951
|
+
* @brief The player loses focus. When the method is called, `veplayer.isFocused` will become `false` and the `PLAYER_BLUR` event will be triggered.
|
|
13952
|
+
* @param data The related configurations.
|
|
13953
|
+
*/
|
|
13546
13954
|
blur(data) {
|
|
13547
13955
|
return this._player.blur(data);
|
|
13548
13956
|
}
|
|
13549
|
-
/**
|
|
13957
|
+
/** {zh}
|
|
13550
13958
|
* @brief 调用此方法进入系统全屏状态。如果该方法调用的时候处于网页全屏状态会自动退出网页全屏,下发事件 `Events.FULLSCREEN_CHANGE`。
|
|
13551
13959
|
* @param el 全屏作用的 DOM 节点。
|
|
13552
13960
|
*/
|
|
13961
|
+
/** {en}
|
|
13962
|
+
* @brief Turns the player into full-screen mode, in which the player covers the entire desktop. If the player is in full-window mode when the method is called, it will automatically exit full-window mode, and the `Events.FULLSCREEN_CHANGE` event will be triggered.
|
|
13963
|
+
* @param el The DOM node in which the player is displayed in full-screen mode.
|
|
13964
|
+
*/
|
|
13553
13965
|
requestFullscreen(el) {
|
|
13554
13966
|
return this._player.getFullscreen(el);
|
|
13555
13967
|
}
|
|
13556
|
-
/**
|
|
13968
|
+
/** {zh}
|
|
13557
13969
|
* @brief 调用此方法退出系统全屏状态,调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.FULLSCREEN_CHANGE` 事件。
|
|
13558
13970
|
* @param el 全屏作用的 DOM 节点。
|
|
13559
13971
|
*/
|
|
13972
|
+
/** {en}
|
|
13973
|
+
* @brief Exits full-screen mode. After the method is called, `veplayer.isFullscreen` will become `false` and the `Events.FULLSCREEN_CHANGE` event will be triggered.
|
|
13974
|
+
* @param el The DOM node of the full screen effect.
|
|
13975
|
+
*/
|
|
13560
13976
|
exitFullscreen(el) {
|
|
13561
13977
|
return this._player.exitFullscreen(el);
|
|
13562
13978
|
}
|
|
13563
|
-
/**
|
|
13979
|
+
/** {zh}
|
|
13564
13980
|
* @brief 调用此方法进入网页样式全屏状态,播放器进入网页全屏,利用 CSS 模拟实现全屏效果。如果该接口调用的时候处于全屏状态,会自动退出全屏,下发事件 `Events.CSS_FULLSCREEN_CHANGE`。
|
|
13565
13981
|
* @param el 全屏作用的 DOM 节点。
|
|
13566
13982
|
*/
|
|
13983
|
+
/** {en}
|
|
13984
|
+
* @brief Turns the player into full-window mode, in which the player covers the entire browser window. If the player is in full-screen mode when the method is called, it will automatically exit full-screen mode, and the `Events.CSS_FULLSCREEN_CHANGE` event will be triggered.
|
|
13985
|
+
* @param el The DOM node in which the player is displayed in full-window mode.
|
|
13986
|
+
*/
|
|
13567
13987
|
requestCssFullscreen(el) {
|
|
13568
13988
|
return this._player.getCssFullscreen(el);
|
|
13569
13989
|
}
|
|
13570
|
-
/**
|
|
13990
|
+
/** {zh}
|
|
13571
13991
|
* @brief 调用此方法退出网页样式全屏状态。 调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.CSS_FULLSCREEN_CHANGE` 事件。
|
|
13572
13992
|
*/
|
|
13993
|
+
/** {en}
|
|
13994
|
+
* @brief Exits the full-window mode. When the method is called, `veplayer.isFullscreen` will become `false` and the `Events.CSS_FULLSCREEN_CHANGE` event will be triggered.
|
|
13995
|
+
*/
|
|
13573
13996
|
exitCssFullscreen() {
|
|
13574
13997
|
return this._player.exitCssFullscreen();
|
|
13575
13998
|
}
|
|
13576
|
-
/**
|
|
13999
|
+
/** {zh}
|
|
13577
14000
|
* @brief 调用此方法在当前播放器上注册指定插件。
|
|
13578
14001
|
* @param plugin 插件构造函数。
|
|
13579
14002
|
* @param config 插件的配置列表。
|
|
13580
14003
|
*/
|
|
14004
|
+
/** {en}
|
|
14005
|
+
* @brief Registers a specified plug-in to the current player.
|
|
14006
|
+
* @param Plugin The plugin constructor.
|
|
14007
|
+
* @param config The plugin configurations.
|
|
14008
|
+
*/
|
|
13581
14009
|
registerPlugin(plugin, config) {
|
|
13582
14010
|
return this._player.registerPlugin(plugin, config);
|
|
13583
14011
|
}
|
|
13584
|
-
/**
|
|
14012
|
+
/** {zh}
|
|
13585
14013
|
* @brief 调用此方法在当前播放器上销毁/注销指定插件。
|
|
13586
14014
|
* @param plugin 插件实例或者插件名称。
|
|
13587
14015
|
*/
|
|
14016
|
+
/** {en}
|
|
14017
|
+
* @brief Destroys or unregisters a specified plugin from the player.
|
|
14018
|
+
* @param Plugin The plugin instance or name.
|
|
14019
|
+
*/
|
|
13588
14020
|
unRegisterPlugin(plugin) {
|
|
13589
14021
|
return this._player.unRegisterPlugin(plugin);
|
|
13590
14022
|
}
|
|
13591
|
-
/**
|
|
14023
|
+
/** {zh}
|
|
13592
14024
|
* @brief 调用此接口显示指定插件图标。
|
|
13593
14025
|
* @param pluginNames 插件名称
|
|
13594
14026
|
*/
|
|
14027
|
+
/** {en}
|
|
14028
|
+
* @brief Displays the icon of a specified plugin.
|
|
14029
|
+
* @param PluginNames The plugin name.
|
|
14030
|
+
*/
|
|
13595
14031
|
showIcon(pluginNames) {
|
|
13596
14032
|
const morePlugin = this._player.getPlugin("more");
|
|
13597
14033
|
pluginNames.forEach((pluginName) => {
|
|
@@ -13605,10 +14041,14 @@ class VePlayerBase {
|
|
|
13605
14041
|
}
|
|
13606
14042
|
});
|
|
13607
14043
|
}
|
|
13608
|
-
/**
|
|
14044
|
+
/** {zh}
|
|
13609
14045
|
* @brief 调用此接口隐藏指定插件图标。
|
|
13610
14046
|
* @param pluginNames 插件名称
|
|
13611
14047
|
*/
|
|
14048
|
+
/** {en}
|
|
14049
|
+
* @brief Hides the icon of a specified plugin.
|
|
14050
|
+
* @param PluginNames The plugin name.
|
|
14051
|
+
*/
|
|
13612
14052
|
hideIcon(pluginNames) {
|
|
13613
14053
|
const morePlugin = this._player.getPlugin("more");
|
|
13614
14054
|
pluginNames.forEach((pluginName) => {
|
|
@@ -13622,14 +14062,20 @@ class VePlayerBase {
|
|
|
13622
14062
|
}
|
|
13623
14063
|
});
|
|
13624
14064
|
}
|
|
13625
|
-
/**
|
|
14065
|
+
/** {zh}
|
|
13626
14066
|
* @brief 调用此方法销毁播放器实例。
|
|
13627
14067
|
*/
|
|
14068
|
+
/** {en}
|
|
14069
|
+
* @brief Destroys the player instance.
|
|
14070
|
+
*/
|
|
13628
14071
|
destroy() {
|
|
13629
14072
|
this._player.off(ERROR, this._errorCallback);
|
|
13630
14073
|
this._player.destroy();
|
|
13631
14074
|
}
|
|
13632
|
-
/**
|
|
14075
|
+
/** {zh}
|
|
14076
|
+
* @hidden
|
|
14077
|
+
*/
|
|
14078
|
+
/** {en}
|
|
13633
14079
|
* @hidden
|
|
13634
14080
|
*/
|
|
13635
14081
|
async prepare(url) {
|
|
@@ -18555,6 +19001,29 @@ const getRtmStrategy = async (options, player) => {
|
|
|
18555
19001
|
plugins: rtmCdn ? [rtmCdn] : []
|
|
18556
19002
|
};
|
|
18557
19003
|
};
|
|
19004
|
+
var DrmType = /* @__PURE__ */ ((DrmType2) => {
|
|
19005
|
+
DrmType2["Fairplay"] = "fairplay";
|
|
19006
|
+
return DrmType2;
|
|
19007
|
+
})(DrmType || {});
|
|
19008
|
+
function getDrmType(drm) {
|
|
19009
|
+
if ((drm == null ? void 0 : drm.fairplay) && (sniffer$1.browser === "safari" || sniffer$1.os.isIos)) {
|
|
19010
|
+
return "fairplay";
|
|
19011
|
+
}
|
|
19012
|
+
return;
|
|
19013
|
+
}
|
|
19014
|
+
function isMseSupportedWithDrm({
|
|
19015
|
+
drm,
|
|
19016
|
+
streamType
|
|
19017
|
+
}) {
|
|
19018
|
+
const drmType = getDrmType(drm);
|
|
19019
|
+
if (!drmType) {
|
|
19020
|
+
return true;
|
|
19021
|
+
}
|
|
19022
|
+
if (drmType === "fairplay" && streamType === "hls") {
|
|
19023
|
+
return false;
|
|
19024
|
+
}
|
|
19025
|
+
return true;
|
|
19026
|
+
}
|
|
18558
19027
|
const getTypeStrategy = async (options, player) => {
|
|
18559
19028
|
const type = options.url ? util.getStreamType(options.url) : "";
|
|
18560
19029
|
if (!type || type === "unknown") {
|
|
@@ -18567,6 +19036,9 @@ const getTypeStrategy = async (options, player) => {
|
|
|
18567
19036
|
return await getFlvStrategy(options);
|
|
18568
19037
|
}
|
|
18569
19038
|
if (type === "hls") {
|
|
19039
|
+
if (!isMseSupportedWithDrm({ drm: options.drm, streamType: type })) {
|
|
19040
|
+
return { options: {}, plugins: [] };
|
|
19041
|
+
}
|
|
18570
19042
|
return await getHlsStrategy(options);
|
|
18571
19043
|
}
|
|
18572
19044
|
return { options: {}, plugins: [] };
|
|
@@ -18701,9 +19173,9 @@ var debounce$1 = /* @__PURE__ */ getDefaultExportFromCjs(lodash_debounce);
|
|
|
18701
19173
|
const Events = {
|
|
18702
19174
|
...Events$1,
|
|
18703
19175
|
// 直播的Events
|
|
18704
|
-
TIME_SHIFT_CHANGE: "
|
|
19176
|
+
TIME_SHIFT_CHANGE: "timeShiftChange",
|
|
18705
19177
|
// 切换时移状态
|
|
18706
|
-
REFRESH_CLICK: "
|
|
19178
|
+
REFRESH_CLICK: "refreshClick"
|
|
18707
19179
|
// 触发刷新
|
|
18708
19180
|
};
|
|
18709
19181
|
function RefreshIcon() {
|
|
@@ -21243,9 +21715,6 @@ const hashCode = (str) => {
|
|
|
21243
21715
|
const generateSessionId = () => {
|
|
21244
21716
|
return v4().replace(/-/g, "") + "." + Date.now() + "." + hashCode(v4().replace(/-/g, ""));
|
|
21245
21717
|
};
|
|
21246
|
-
const CN_APPID = 468759;
|
|
21247
|
-
const CHANNEL = "cn";
|
|
21248
|
-
const CHANNEL_DOMAIN = "//mcs.volceapplog.com";
|
|
21249
21718
|
class Logger extends Plugin {
|
|
21250
21719
|
constructor() {
|
|
21251
21720
|
super(...arguments);
|
|
@@ -21300,9 +21769,8 @@ class Logger extends Plugin {
|
|
|
21300
21769
|
}
|
|
21301
21770
|
_createTea() {
|
|
21302
21771
|
q.init({
|
|
21303
|
-
app_id:
|
|
21304
|
-
channel:
|
|
21305
|
-
channel_domain: CHANNEL_DOMAIN
|
|
21772
|
+
app_id: 468759,
|
|
21773
|
+
channel: "cn"
|
|
21306
21774
|
});
|
|
21307
21775
|
q.start();
|
|
21308
21776
|
q.config({
|
|
@@ -21321,9 +21789,9 @@ class Logger extends Plugin {
|
|
|
21321
21789
|
user_id: this._userId,
|
|
21322
21790
|
device_id: this._deviceId,
|
|
21323
21791
|
ext: {
|
|
21324
|
-
veplayer_version: "2.
|
|
21325
|
-
flv_version: "3.0.
|
|
21326
|
-
hls_version: "3.0.
|
|
21792
|
+
veplayer_version: "2.3.0-rc.1",
|
|
21793
|
+
flv_version: "3.0.12",
|
|
21794
|
+
hls_version: "3.0.12",
|
|
21327
21795
|
rts_version: "0.2.0-alpha.5"
|
|
21328
21796
|
}
|
|
21329
21797
|
});
|
|
@@ -21471,7 +21939,7 @@ class InfoPanel extends Plugin {
|
|
|
21471
21939
|
_tick() {
|
|
21472
21940
|
clearTimeout(this._pollTimer);
|
|
21473
21941
|
this._renderPanel();
|
|
21474
|
-
this._pollTimer = setTimeout(() => {
|
|
21942
|
+
this._pollTimer = window.setTimeout(() => {
|
|
21475
21943
|
this._tick();
|
|
21476
21944
|
}, this.config.interval);
|
|
21477
21945
|
}
|
|
@@ -21587,6 +22055,37 @@ const ZH_CN = {
|
|
|
21587
22055
|
DECODE_INFO: "软解信息",
|
|
21588
22056
|
REFRESH: "刷新"
|
|
21589
22057
|
};
|
|
22058
|
+
const getDrmStrategy = async (options, player) => {
|
|
22059
|
+
var _a;
|
|
22060
|
+
const drmType = getDrmType(options.drm);
|
|
22061
|
+
if (options.url && drmType === DrmType.Fairplay) {
|
|
22062
|
+
try {
|
|
22063
|
+
const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
|
|
22064
|
+
const [drmPlugin, drmConfig] = await Promise.all([
|
|
22065
|
+
load(DynamicModule.PluginDrm).then((module) => module.DrmPlugin).catch(() => void 0),
|
|
22066
|
+
getDrmConfig == null ? void 0 : getDrmConfig({
|
|
22067
|
+
url: options.url
|
|
22068
|
+
})
|
|
22069
|
+
]);
|
|
22070
|
+
const fairplayDrmConfig = Object.assign(
|
|
22071
|
+
{},
|
|
22072
|
+
originFairplayConfig,
|
|
22073
|
+
options == null ? void 0 : options.drm,
|
|
22074
|
+
drmConfig
|
|
22075
|
+
);
|
|
22076
|
+
drmConfig && (player == null ? void 0 : player.updateDrmConfig(drmConfig));
|
|
22077
|
+
return {
|
|
22078
|
+
options: {
|
|
22079
|
+
drm: fairplayDrmConfig
|
|
22080
|
+
},
|
|
22081
|
+
plugins: drmPlugin ? [drmPlugin] : []
|
|
22082
|
+
};
|
|
22083
|
+
} catch (error2) {
|
|
22084
|
+
console.log(error2);
|
|
22085
|
+
}
|
|
22086
|
+
}
|
|
22087
|
+
return {};
|
|
22088
|
+
};
|
|
21590
22089
|
VeI18n.extend([
|
|
21591
22090
|
{
|
|
21592
22091
|
LANG: "zh-cn",
|
|
@@ -21606,7 +22105,11 @@ var RTMCodec = /* @__PURE__ */ ((RTMCodec2) => {
|
|
|
21606
22105
|
return RTMCodec2;
|
|
21607
22106
|
})(RTMCodec || {});
|
|
21608
22107
|
class VePlayerLive extends VePlayerBase {
|
|
21609
|
-
/**
|
|
22108
|
+
/** {zh}
|
|
22109
|
+
* @hidden
|
|
22110
|
+
* @param options
|
|
22111
|
+
*/
|
|
22112
|
+
/** {en}
|
|
21610
22113
|
* @hidden
|
|
21611
22114
|
* @param options
|
|
21612
22115
|
*/
|
|
@@ -21616,6 +22119,9 @@ class VePlayerLive extends VePlayerBase {
|
|
|
21616
22119
|
/** {zh}
|
|
21617
22120
|
* @brief 调用此方法开启直播日志上报。
|
|
21618
22121
|
*/
|
|
22122
|
+
/** {en}
|
|
22123
|
+
* @brief Enables log upload.
|
|
22124
|
+
*/
|
|
21619
22125
|
openLog() {
|
|
21620
22126
|
var _a;
|
|
21621
22127
|
(_a = this._player.plugins) == null ? void 0 : _a.logger.open();
|
|
@@ -21623,6 +22129,9 @@ class VePlayerLive extends VePlayerBase {
|
|
|
21623
22129
|
/** {zh}
|
|
21624
22130
|
* @brief 调用此方法关闭直播日志上报。
|
|
21625
22131
|
*/
|
|
22132
|
+
/** {en}
|
|
22133
|
+
* @brief Disables log upload.
|
|
22134
|
+
*/
|
|
21626
22135
|
closeLog() {
|
|
21627
22136
|
var _a;
|
|
21628
22137
|
(_a = this._player.plugins) == null ? void 0 : _a.logger.close();
|
|
@@ -21630,6 +22139,9 @@ class VePlayerLive extends VePlayerBase {
|
|
|
21630
22139
|
/** {zh}
|
|
21631
22140
|
* @brief 调用此方法将打开直播信息面板,面板将展示拉流格式、帧率、码率、GOP、视频分辨率、编码方式、Buffer 水位、播放进度等基础信息。如果当前是软解,还会显示软解解码效率和解码消耗。
|
|
21632
22141
|
*/
|
|
22142
|
+
/** {en}
|
|
22143
|
+
* @brief Turns on the information panel, which displays basic information including stream format, frame rate, bitrate, GOP, video resolution, codec, buffer time, and playback progress. If software decoding is used, the software decoding efficiency and CPU consumption will also be displayed.
|
|
22144
|
+
*/
|
|
21633
22145
|
openInfoPanel() {
|
|
21634
22146
|
var _a;
|
|
21635
22147
|
(_a = this._player.plugins) == null ? void 0 : _a.infopanel.open();
|
|
@@ -21638,10 +22150,22 @@ class VePlayerLive extends VePlayerBase {
|
|
|
21638
22150
|
* @brief 调用此方法关闭直播信息面板。
|
|
21639
22151
|
*
|
|
21640
22152
|
*/
|
|
22153
|
+
/** {en}
|
|
22154
|
+
* @brief Turns off the information panel.
|
|
22155
|
+
*
|
|
22156
|
+
*/
|
|
21641
22157
|
closeInfoPanel() {
|
|
21642
22158
|
var _a;
|
|
21643
22159
|
(_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
|
|
21644
22160
|
}
|
|
22161
|
+
/** {zh}
|
|
22162
|
+
* @brief 调用此方法更新 DRM 鉴权配置。
|
|
22163
|
+
* @hidden
|
|
22164
|
+
*/
|
|
22165
|
+
updateDrmConfig(config) {
|
|
22166
|
+
var _a, _b, _c;
|
|
22167
|
+
(_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
|
|
22168
|
+
}
|
|
21645
22169
|
}
|
|
21646
22170
|
async function createLivePlayer(options) {
|
|
21647
22171
|
var _a, _b;
|
|
@@ -21666,7 +22190,16 @@ async function createLivePlayer(options) {
|
|
|
21666
22190
|
};
|
|
21667
22191
|
},
|
|
21668
22192
|
async preparePlugins(url) {
|
|
21669
|
-
|
|
22193
|
+
const [typeStrategy, drmStrategy] = await Promise.all([
|
|
22194
|
+
getTypeStrategy({ ...finalOptions, url }, player),
|
|
22195
|
+
getDrmStrategy({ ...finalOptions, url }, player)
|
|
22196
|
+
]);
|
|
22197
|
+
const { options: options2, plugins } = typeStrategy ?? {};
|
|
22198
|
+
const { options: drmOptions, plugins: drmPlugins } = drmStrategy ?? {};
|
|
22199
|
+
return {
|
|
22200
|
+
options: Object.assign({}, options2, drmOptions),
|
|
22201
|
+
plugins: [...plugins ?? [], ...drmPlugins ?? []]
|
|
22202
|
+
};
|
|
21670
22203
|
}
|
|
21671
22204
|
},
|
|
21672
22205
|
VePlayerLive
|
|
@@ -21699,6 +22232,7 @@ export {
|
|
|
21699
22232
|
Degradation,
|
|
21700
22233
|
DynamicModule,
|
|
21701
22234
|
EN$1 as EN,
|
|
22235
|
+
ListType,
|
|
21702
22236
|
POSITIONS$1 as POSITIONS,
|
|
21703
22237
|
Plugin,
|
|
21704
22238
|
RTMCodec,
|
|
@@ -21712,5 +22246,6 @@ export {
|
|
|
21712
22246
|
live,
|
|
21713
22247
|
load,
|
|
21714
22248
|
register2 as register,
|
|
22249
|
+
registerPlugin,
|
|
21715
22250
|
util
|
|
21716
22251
|
};
|