@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
|
@@ -47,8 +47,8 @@ var __publicField = (obj, key, value) => {
|
|
|
47
47
|
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
48
48
|
}, _typeof(obj);
|
|
49
49
|
}
|
|
50
|
-
function _classCallCheck(
|
|
51
|
-
if (!(
|
|
50
|
+
function _classCallCheck(instance2, Constructor) {
|
|
51
|
+
if (!(instance2 instanceof Constructor)) {
|
|
52
52
|
throw new TypeError("Cannot call a class as a function");
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -1453,7 +1453,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1453
1453
|
}
|
|
1454
1454
|
}
|
|
1455
1455
|
};
|
|
1456
|
-
var version = "3.0.
|
|
1456
|
+
var version = "3.0.12";
|
|
1457
1457
|
var ERROR_TYPE_MAP = {
|
|
1458
1458
|
1: "media",
|
|
1459
1459
|
2: "media",
|
|
@@ -2315,10 +2315,10 @@ var __publicField = (obj, key, value) => {
|
|
|
2315
2315
|
}, {
|
|
2316
2316
|
key: "addData",
|
|
2317
2317
|
value: function addData(storename, data) {
|
|
2318
|
-
var
|
|
2318
|
+
var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
|
|
2319
2319
|
var request;
|
|
2320
2320
|
for (var i = 0; i < data.length; i++) {
|
|
2321
|
-
request =
|
|
2321
|
+
request = store2.add(data[i]);
|
|
2322
2322
|
request.onerror = function() {
|
|
2323
2323
|
};
|
|
2324
2324
|
request.onsuccess = function() {
|
|
@@ -2328,10 +2328,10 @@ var __publicField = (obj, key, value) => {
|
|
|
2328
2328
|
}, {
|
|
2329
2329
|
key: "putData",
|
|
2330
2330
|
value: function putData(storename, data) {
|
|
2331
|
-
var
|
|
2331
|
+
var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
|
|
2332
2332
|
var request;
|
|
2333
2333
|
for (var i = 0; i < data.length; i++) {
|
|
2334
|
-
request =
|
|
2334
|
+
request = store2.put(data[i]);
|
|
2335
2335
|
request.onerror = function() {
|
|
2336
2336
|
};
|
|
2337
2337
|
request.onsuccess = function() {
|
|
@@ -2342,8 +2342,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2342
2342
|
key: "getDataByKey",
|
|
2343
2343
|
value: function getDataByKey(storename, key, callback) {
|
|
2344
2344
|
var self2 = this;
|
|
2345
|
-
var
|
|
2346
|
-
var request =
|
|
2345
|
+
var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
|
|
2346
|
+
var request = store2.get(key);
|
|
2347
2347
|
request.onerror = function() {
|
|
2348
2348
|
callback.call(self2, null);
|
|
2349
2349
|
};
|
|
@@ -2355,14 +2355,14 @@ var __publicField = (obj, key, value) => {
|
|
|
2355
2355
|
}, {
|
|
2356
2356
|
key: "deleteData",
|
|
2357
2357
|
value: function deleteData(storename, key) {
|
|
2358
|
-
var
|
|
2359
|
-
|
|
2358
|
+
var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
|
|
2359
|
+
store2.delete(key);
|
|
2360
2360
|
}
|
|
2361
2361
|
}, {
|
|
2362
2362
|
key: "clearData",
|
|
2363
2363
|
value: function clearData(storename) {
|
|
2364
|
-
var
|
|
2365
|
-
|
|
2364
|
+
var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
|
|
2365
|
+
store2.clear();
|
|
2366
2366
|
}
|
|
2367
2367
|
}]);
|
|
2368
2368
|
return INDEXDB2;
|
|
@@ -2479,24 +2479,24 @@ var __publicField = (obj, key, value) => {
|
|
|
2479
2479
|
return plugin.removeHooks && plugin.removeHooks.apply(plugin, args);
|
|
2480
2480
|
}
|
|
2481
2481
|
}
|
|
2482
|
-
function hooksDescriptor(
|
|
2482
|
+
function hooksDescriptor(instance2) {
|
|
2483
2483
|
var presetHooks = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
2484
|
-
|
|
2484
|
+
instance2.__hooks = {};
|
|
2485
2485
|
presetHooks && presetHooks.map(function(item) {
|
|
2486
|
-
|
|
2486
|
+
instance2.__hooks[item] = null;
|
|
2487
2487
|
});
|
|
2488
|
-
Object.defineProperty(
|
|
2488
|
+
Object.defineProperty(instance2, "hooks", {
|
|
2489
2489
|
get: function get() {
|
|
2490
|
-
return
|
|
2491
|
-
if (
|
|
2490
|
+
return instance2.__hooks && Object.keys(instance2.__hooks).map(function(key) {
|
|
2491
|
+
if (instance2.__hooks[key]) {
|
|
2492
2492
|
return key;
|
|
2493
2493
|
}
|
|
2494
2494
|
});
|
|
2495
2495
|
}
|
|
2496
2496
|
});
|
|
2497
2497
|
}
|
|
2498
|
-
function delHooksDescriptor(
|
|
2499
|
-
|
|
2498
|
+
function delHooksDescriptor(instance2) {
|
|
2499
|
+
instance2.__hooks = null;
|
|
2500
2500
|
}
|
|
2501
2501
|
function runHooks(obj, hookName, handler) {
|
|
2502
2502
|
for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
|
|
@@ -2714,7 +2714,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2714
2714
|
}
|
|
2715
2715
|
}, {
|
|
2716
2716
|
key: "registerPlugin",
|
|
2717
|
-
value: function
|
|
2717
|
+
value: function registerPlugin2(plugin) {
|
|
2718
2718
|
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
2719
2719
|
var name = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
|
2720
2720
|
if (!this.player) {
|
|
@@ -3073,7 +3073,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3073
3073
|
}
|
|
3074
3074
|
}, {
|
|
3075
3075
|
key: "registerPlugin",
|
|
3076
|
-
value: function
|
|
3076
|
+
value: function registerPlugin2(plugin) {
|
|
3077
3077
|
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
3078
3078
|
var name = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
|
|
3079
3079
|
options.root = options.root || this.root;
|
|
@@ -3212,7 +3212,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3212
3212
|
var cs = window.getComputedStyle(this.root, null);
|
|
3213
3213
|
var cssDisplayValue = cs.getPropertyValue("display");
|
|
3214
3214
|
if (cssDisplayValue === "none") {
|
|
3215
|
-
|
|
3215
|
+
this.root.style.display = "block";
|
|
3216
3216
|
}
|
|
3217
3217
|
}
|
|
3218
3218
|
}, {
|
|
@@ -3469,28 +3469,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3469
3469
|
!player.config.closeResizeObserver && addObserver(player.root, function() {
|
|
3470
3470
|
player.resize();
|
|
3471
3471
|
});
|
|
3472
|
-
if (Object.keys(this.pluginGroup).length === 0) {
|
|
3473
|
-
player.isUserActive = true;
|
|
3474
|
-
}
|
|
3475
3472
|
this.pluginGroup[cgid] = {
|
|
3476
|
-
_player: player,
|
|
3477
3473
|
_originalOptions: player.config || {},
|
|
3478
3474
|
_plugins: {}
|
|
3479
3475
|
};
|
|
3480
3476
|
},
|
|
3481
|
-
checkPlayerRoot: function checkPlayerRoot(root) {
|
|
3482
|
-
if (this.pluginGroup) {
|
|
3483
|
-
var _keys = Object.keys(this.pluginGroup);
|
|
3484
|
-
for (var i = 0; i < _keys.length; i++) {
|
|
3485
|
-
var _p = this.pluginGroup[_keys[i]]._player;
|
|
3486
|
-
if (_p.root === root) {
|
|
3487
|
-
return _p;
|
|
3488
|
-
}
|
|
3489
|
-
}
|
|
3490
|
-
return null;
|
|
3491
|
-
}
|
|
3492
|
-
return null;
|
|
3493
|
-
},
|
|
3494
3477
|
formatPluginInfo: function formatPluginInfo(plugin, config) {
|
|
3495
3478
|
var PLUFGIN = null;
|
|
3496
3479
|
var options = null;
|
|
@@ -3565,7 +3548,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3565
3548
|
}
|
|
3566
3549
|
var plugins = this.pluginGroup[cgid]._plugins;
|
|
3567
3550
|
var originalOptions = this.pluginGroup[cgid]._originalOptions;
|
|
3568
|
-
options.player =
|
|
3551
|
+
options.player = player;
|
|
3569
3552
|
var pluginName = options.pluginName || plugin.pluginName;
|
|
3570
3553
|
if (!pluginName) {
|
|
3571
3554
|
throw new Error("The property pluginName is necessary");
|
|
@@ -3764,37 +3747,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3764
3747
|
}
|
|
3765
3748
|
});
|
|
3766
3749
|
},
|
|
3767
|
-
setCurrentUserActive: function setCurrentUserActive(playerId, isActive) {
|
|
3768
|
-
if (!this.pluginGroup[playerId]) {
|
|
3769
|
-
return;
|
|
3770
|
-
}
|
|
3771
|
-
if (!isActive) {
|
|
3772
|
-
this.pluginGroup[playerId]._player.isUserActive = isActive;
|
|
3773
|
-
return playerId;
|
|
3774
|
-
}
|
|
3775
|
-
var keys = Object.keys(this.pluginGroup);
|
|
3776
|
-
for (var i = 0; i < keys.length; i++) {
|
|
3777
|
-
var c = this.pluginGroup[keys[i]];
|
|
3778
|
-
if (c && c._player) {
|
|
3779
|
-
this.pluginGroup[keys[i]]._player.isUserActive = false;
|
|
3780
|
-
}
|
|
3781
|
-
}
|
|
3782
|
-
this.pluginGroup[playerId]._player.isUserActive = isActive;
|
|
3783
|
-
return playerId;
|
|
3784
|
-
},
|
|
3785
|
-
getCurrentUseActiveId: function getCurrentUseActiveId() {
|
|
3786
|
-
if (!this.pluginGroup) {
|
|
3787
|
-
return;
|
|
3788
|
-
}
|
|
3789
|
-
var keys = Object.keys(this.pluginGroup);
|
|
3790
|
-
for (var i = 0; i < keys.length; i++) {
|
|
3791
|
-
var c = this.pluginGroup[keys[i]];
|
|
3792
|
-
if (c && c._player && c._player.isUserActive) {
|
|
3793
|
-
return keys[i];
|
|
3794
|
-
}
|
|
3795
|
-
}
|
|
3796
|
-
return null;
|
|
3797
|
-
},
|
|
3798
3750
|
destroy: function destroy(player) {
|
|
3799
3751
|
var cgid = player._pluginInfoId;
|
|
3800
3752
|
if (!this.pluginGroup[cgid]) {
|
|
@@ -4050,7 +4002,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4050
4002
|
}
|
|
4051
4003
|
}, {
|
|
4052
4004
|
key: "show",
|
|
4053
|
-
value: function show() {
|
|
4005
|
+
value: function show(value) {
|
|
4054
4006
|
this.root.style.display = "";
|
|
4055
4007
|
this.player.focus();
|
|
4056
4008
|
}
|
|
@@ -4066,7 +4018,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4066
4018
|
}
|
|
4067
4019
|
}, {
|
|
4068
4020
|
key: "registerPlugin",
|
|
4069
|
-
value: function
|
|
4021
|
+
value: function registerPlugin2(plugin) {
|
|
4070
4022
|
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
4071
4023
|
var name = arguments.length > 2 ? arguments[2] : void 0;
|
|
4072
4024
|
if (!this.root) {
|
|
@@ -4343,9 +4295,158 @@ var __publicField = (obj, key, value) => {
|
|
|
4343
4295
|
DESTROYED: 8
|
|
4344
4296
|
};
|
|
4345
4297
|
var STATE_ARRAY = ["ERROR", "INITIAL", "READY", "ATTACHING", "ATTACHED", "NOTALLOW", "RUNNING", "ENDED", "DESTROYED"];
|
|
4298
|
+
var store = {};
|
|
4299
|
+
var instance = null;
|
|
4300
|
+
var InstManager = /* @__PURE__ */ function(_EventEmitter) {
|
|
4301
|
+
_inherits(InstManager2, _EventEmitter);
|
|
4302
|
+
var _super = _createSuper(InstManager2);
|
|
4303
|
+
function InstManager2() {
|
|
4304
|
+
_classCallCheck(this, InstManager2);
|
|
4305
|
+
return _super.apply(this, arguments);
|
|
4306
|
+
}
|
|
4307
|
+
_createClass(InstManager2, [{
|
|
4308
|
+
key: "add",
|
|
4309
|
+
value: function add(player) {
|
|
4310
|
+
if (!player) {
|
|
4311
|
+
return;
|
|
4312
|
+
}
|
|
4313
|
+
store[player.playerId] = player;
|
|
4314
|
+
if (Object.keys(store).length === 1) {
|
|
4315
|
+
this.setActive(player.playerId, true);
|
|
4316
|
+
}
|
|
4317
|
+
}
|
|
4318
|
+
}, {
|
|
4319
|
+
key: "remove",
|
|
4320
|
+
value: function remove(player) {
|
|
4321
|
+
if (!player) {
|
|
4322
|
+
return;
|
|
4323
|
+
}
|
|
4324
|
+
player.isUserActive;
|
|
4325
|
+
delete store[player.playerId];
|
|
4326
|
+
}
|
|
4327
|
+
}, {
|
|
4328
|
+
key: "_iterate",
|
|
4329
|
+
value: function _iterate(fn) {
|
|
4330
|
+
var endEarly = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
4331
|
+
for (var key in store) {
|
|
4332
|
+
if (Object.prototype.hasOwnProperty.call(store, key)) {
|
|
4333
|
+
var player = store[key];
|
|
4334
|
+
if (endEarly) {
|
|
4335
|
+
if (fn(player)) {
|
|
4336
|
+
break;
|
|
4337
|
+
}
|
|
4338
|
+
} else {
|
|
4339
|
+
fn(player);
|
|
4340
|
+
}
|
|
4341
|
+
}
|
|
4342
|
+
}
|
|
4343
|
+
}
|
|
4344
|
+
}, {
|
|
4345
|
+
key: "forEach",
|
|
4346
|
+
value: function forEach(fn) {
|
|
4347
|
+
this._iterate(fn);
|
|
4348
|
+
}
|
|
4349
|
+
}, {
|
|
4350
|
+
key: "find",
|
|
4351
|
+
value: function find(fn) {
|
|
4352
|
+
var result = null;
|
|
4353
|
+
this._iterate(function(player) {
|
|
4354
|
+
var flag = fn(player);
|
|
4355
|
+
if (flag) {
|
|
4356
|
+
result = player;
|
|
4357
|
+
}
|
|
4358
|
+
return flag;
|
|
4359
|
+
}, true);
|
|
4360
|
+
return result;
|
|
4361
|
+
}
|
|
4362
|
+
}, {
|
|
4363
|
+
key: "findAll",
|
|
4364
|
+
value: function findAll(fn) {
|
|
4365
|
+
var results = [];
|
|
4366
|
+
this._iterate(function(player) {
|
|
4367
|
+
if (fn(player)) {
|
|
4368
|
+
results.push(player);
|
|
4369
|
+
}
|
|
4370
|
+
});
|
|
4371
|
+
return results;
|
|
4372
|
+
}
|
|
4373
|
+
}, {
|
|
4374
|
+
key: "setActive",
|
|
4375
|
+
value: function setActive(playerId) {
|
|
4376
|
+
var isActive = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
4377
|
+
if (!store[playerId]) {
|
|
4378
|
+
return;
|
|
4379
|
+
}
|
|
4380
|
+
if (isActive) {
|
|
4381
|
+
this.forEach(function(inst) {
|
|
4382
|
+
if (playerId === inst.playerId) {
|
|
4383
|
+
inst.isUserActive = true;
|
|
4384
|
+
inst.isInstNext = false;
|
|
4385
|
+
} else {
|
|
4386
|
+
inst.isUserActive = false;
|
|
4387
|
+
}
|
|
4388
|
+
});
|
|
4389
|
+
} else {
|
|
4390
|
+
store[playerId].isUserActive = isActive;
|
|
4391
|
+
}
|
|
4392
|
+
return playerId;
|
|
4393
|
+
}
|
|
4394
|
+
}, {
|
|
4395
|
+
key: "getActiveId",
|
|
4396
|
+
value: function getActiveId() {
|
|
4397
|
+
var keys = Object.keys(store);
|
|
4398
|
+
for (var i = 0; i < keys.length; i++) {
|
|
4399
|
+
var c = store[keys[i]];
|
|
4400
|
+
if (c && c.isUserActive) {
|
|
4401
|
+
return keys[i];
|
|
4402
|
+
}
|
|
4403
|
+
}
|
|
4404
|
+
return null;
|
|
4405
|
+
}
|
|
4406
|
+
}, {
|
|
4407
|
+
key: "setNext",
|
|
4408
|
+
value: function setNext(playerId) {
|
|
4409
|
+
var isNext = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
4410
|
+
if (!store[playerId]) {
|
|
4411
|
+
return;
|
|
4412
|
+
}
|
|
4413
|
+
if (isNext) {
|
|
4414
|
+
this.forEach(function(inst) {
|
|
4415
|
+
if (playerId === inst.playerId) {
|
|
4416
|
+
inst.isUserActive = false;
|
|
4417
|
+
inst.isInstNext = true;
|
|
4418
|
+
} else {
|
|
4419
|
+
inst.isInstNext = false;
|
|
4420
|
+
}
|
|
4421
|
+
});
|
|
4422
|
+
} else {
|
|
4423
|
+
store[playerId].isInstNext = isNext;
|
|
4424
|
+
}
|
|
4425
|
+
return playerId;
|
|
4426
|
+
}
|
|
4427
|
+
}], [{
|
|
4428
|
+
key: "getInstance",
|
|
4429
|
+
value: function getInstance() {
|
|
4430
|
+
instance || (instance = new InstManager2());
|
|
4431
|
+
return instance;
|
|
4432
|
+
}
|
|
4433
|
+
}]);
|
|
4434
|
+
return InstManager2;
|
|
4435
|
+
}(eventemitter3Exports.EventEmitter);
|
|
4436
|
+
function checkPlayerRoot(root) {
|
|
4437
|
+
var keys = Object.keys(store);
|
|
4438
|
+
for (var i = 0; i < keys.length; i++) {
|
|
4439
|
+
var p = store[keys[i]];
|
|
4440
|
+
if (p.root === root) {
|
|
4441
|
+
return p;
|
|
4442
|
+
}
|
|
4443
|
+
}
|
|
4444
|
+
return null;
|
|
4445
|
+
}
|
|
4346
4446
|
var PlAYER_HOOKS = ["play", "pause", "replay", "retry"];
|
|
4347
4447
|
var REAL_TIME_SPEED = 0;
|
|
4348
4448
|
var AVG_SPEED = 0;
|
|
4449
|
+
var instManager = null;
|
|
4349
4450
|
var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
4350
4451
|
_inherits(Player2, _MediaProxy);
|
|
4351
4452
|
var _super = _createSuper(Player2);
|
|
@@ -4358,11 +4459,11 @@ var __publicField = (obj, key, value) => {
|
|
|
4358
4459
|
if (!_this.config) {
|
|
4359
4460
|
return;
|
|
4360
4461
|
}
|
|
4361
|
-
var _this$config = _this.config, autoplay2 = _this$config.autoplay,
|
|
4362
|
-
XG_DEBUG.logInfo("player", "canPlayFunc, startTime",
|
|
4363
|
-
if (
|
|
4364
|
-
_this.currentTime =
|
|
4365
|
-
_this.
|
|
4462
|
+
var _this$config = _this.config, autoplay2 = _this$config.autoplay, defaultPlaybackRate = _this$config.defaultPlaybackRate;
|
|
4463
|
+
XG_DEBUG.logInfo("player", "canPlayFunc, startTime", _this.__startTime);
|
|
4464
|
+
if (_this.__startTime > 0 && _this.duration > 0) {
|
|
4465
|
+
_this.currentTime = _this.__startTime > _this.duration ? _this.duration : _this.__startTime;
|
|
4466
|
+
_this.__startTime = -1;
|
|
4366
4467
|
}
|
|
4367
4468
|
_this.playbackRate = defaultPlaybackRate;
|
|
4368
4469
|
(autoplay2 || _this._useAutoplay) && _this.mediaPlay();
|
|
@@ -4453,6 +4554,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4453
4554
|
_this.isSeeking = false;
|
|
4454
4555
|
_this.isCanplay = false;
|
|
4455
4556
|
_this._useAutoplay = false;
|
|
4557
|
+
_this.__startTime = -1;
|
|
4456
4558
|
_this.rotateDeg = 0;
|
|
4457
4559
|
_this.isActive = false;
|
|
4458
4560
|
_this.fullscreen = false;
|
|
@@ -4507,6 +4609,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4507
4609
|
_this.innerStates = {
|
|
4508
4610
|
isActiveLocked: false
|
|
4509
4611
|
};
|
|
4612
|
+
_this.instManager = instManager;
|
|
4510
4613
|
var rootInit = _this._initDOM();
|
|
4511
4614
|
if (!rootInit) {
|
|
4512
4615
|
console.error(new Error("can't find the dom which id is ".concat(_this.config.id, " or this.config.el does not exist")));
|
|
@@ -4544,7 +4647,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4544
4647
|
_createClass(Player2, [{
|
|
4545
4648
|
key: "_initDOM",
|
|
4546
4649
|
value: function _initDOM() {
|
|
4547
|
-
var _this2 = this;
|
|
4650
|
+
var _instManager, _this2 = this;
|
|
4548
4651
|
this.root = this.config.id ? document.getElementById(this.config.id) : null;
|
|
4549
4652
|
if (!this.root) {
|
|
4550
4653
|
var el = this.config.el;
|
|
@@ -4560,12 +4663,13 @@ var __publicField = (obj, key, value) => {
|
|
|
4560
4663
|
return false;
|
|
4561
4664
|
}
|
|
4562
4665
|
}
|
|
4563
|
-
var ret =
|
|
4666
|
+
var ret = checkPlayerRoot(this.root);
|
|
4564
4667
|
if (ret) {
|
|
4565
4668
|
XG_DEBUG.logWarn("The is an Player instance already exists in this.root, destroy it and reinitialize");
|
|
4566
4669
|
ret.destroy();
|
|
4567
4670
|
}
|
|
4568
4671
|
this.root.setAttribute(PLATER_ID, this.playerId);
|
|
4672
|
+
(_instManager = instManager) === null || _instManager === void 0 ? void 0 : _instManager.add(this);
|
|
4569
4673
|
pluginsManager.init(this);
|
|
4570
4674
|
this._initBaseDoms();
|
|
4571
4675
|
var XgVideoProxy = this.constructor.XgVideoProxy;
|
|
@@ -4708,10 +4812,13 @@ var __publicField = (obj, key, value) => {
|
|
|
4708
4812
|
!util.isMSE(this.media) && this.load();
|
|
4709
4813
|
(sniffer.os.isIpad || sniffer.os.isPhone) && this.mediaPlay();
|
|
4710
4814
|
}
|
|
4711
|
-
|
|
4815
|
+
var startTime = this.config.startTime;
|
|
4816
|
+
this.__startTime = startTime > 0 ? startTime : -1;
|
|
4817
|
+
this.config.startTime = 0;
|
|
4818
|
+
if (readyState >= 2 && this.duration > 0) {
|
|
4712
4819
|
this.canPlayFunc();
|
|
4713
4820
|
} else {
|
|
4714
|
-
this.
|
|
4821
|
+
this.on(CANPLAY, this.canPlayFunc);
|
|
4715
4822
|
}
|
|
4716
4823
|
if (!this.hasStart || this.state < STATES.ATTACHED) {
|
|
4717
4824
|
pluginsManager.afterInit(this);
|
|
@@ -4804,7 +4911,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4804
4911
|
}
|
|
4805
4912
|
}, {
|
|
4806
4913
|
key: "registerPlugin",
|
|
4807
|
-
value: function
|
|
4914
|
+
value: function registerPlugin2(plugin, config) {
|
|
4808
4915
|
var _retPlugin = pluginsManager.formatPluginInfo(plugin, config);
|
|
4809
4916
|
var PLUFGIN = _retPlugin.PLUFGIN, options = _retPlugin.options;
|
|
4810
4917
|
var plugins = this.config.plugins;
|
|
@@ -4953,6 +5060,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4953
5060
|
}
|
|
4954
5061
|
_src = this.preProcessUrl(_src).url;
|
|
4955
5062
|
var curTime = this.currentTime;
|
|
5063
|
+
this.__startTime = curTime;
|
|
4956
5064
|
var isPaused = this.paused && !this.isError;
|
|
4957
5065
|
this.src = _src;
|
|
4958
5066
|
return new Promise(function(resolve, reject) {
|
|
@@ -4962,7 +5070,10 @@ var __publicField = (obj, key, value) => {
|
|
|
4962
5070
|
reject(e);
|
|
4963
5071
|
};
|
|
4964
5072
|
var _canplay = function _canplay2() {
|
|
4965
|
-
_this9.
|
|
5073
|
+
if (_this9.duration > 0 && _this9.__startTime > 0) {
|
|
5074
|
+
_this9.currentTime = _this9.__startTime;
|
|
5075
|
+
_this9.__startTime = -1;
|
|
5076
|
+
}
|
|
4966
5077
|
if (isPaused) {
|
|
4967
5078
|
_this9.pause();
|
|
4968
5079
|
}
|
|
@@ -5189,7 +5300,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5189
5300
|
clsList.forEach(function(cls) {
|
|
5190
5301
|
_this16.removeClass(cls);
|
|
5191
5302
|
});
|
|
5192
|
-
this.addClass(STATE_CLASS.
|
|
5303
|
+
this.addClass(STATE_CLASS.NO_START);
|
|
5193
5304
|
this.emit(RESET);
|
|
5194
5305
|
}
|
|
5195
5306
|
}, {
|
|
@@ -5218,7 +5329,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5218
5329
|
}, {
|
|
5219
5330
|
key: "destroy",
|
|
5220
5331
|
value: function destroy() {
|
|
5221
|
-
var _this18 = this;
|
|
5332
|
+
var _instManager2, _this18 = this;
|
|
5222
5333
|
var innerContainer = this.innerContainer, root = this.root, media = this.media;
|
|
5223
5334
|
if (!root || !media) {
|
|
5224
5335
|
return;
|
|
@@ -5231,6 +5342,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5231
5342
|
this._detachSourceEvents(this.media);
|
|
5232
5343
|
util.clearAllTimers(this);
|
|
5233
5344
|
this.emit(DESTROY);
|
|
5345
|
+
(_instManager2 = instManager) === null || _instManager2 === void 0 ? void 0 : _instManager2.remove(this);
|
|
5234
5346
|
pluginsManager.destroy(this);
|
|
5235
5347
|
delHooksDescriptor(this);
|
|
5236
5348
|
_get(_getPrototypeOf(Player2.prototype), "destroy", this).call(this);
|
|
@@ -5582,6 +5694,14 @@ var __publicField = (obj, key, value) => {
|
|
|
5582
5694
|
this.isCanplay = true;
|
|
5583
5695
|
this.waitTimer && util.clearTimeout(this, this.waitTimer);
|
|
5584
5696
|
}
|
|
5697
|
+
}, {
|
|
5698
|
+
key: "onDurationchange",
|
|
5699
|
+
value: function onDurationchange() {
|
|
5700
|
+
if (this.__startTime > 0 && this.duration > 0) {
|
|
5701
|
+
this.currentTime = this.__startTime;
|
|
5702
|
+
this.__startTime = -1;
|
|
5703
|
+
}
|
|
5704
|
+
}
|
|
5585
5705
|
}, {
|
|
5586
5706
|
key: "onLoadeddata",
|
|
5587
5707
|
value: function onLoadeddata() {
|
|
@@ -5759,8 +5879,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5759
5879
|
}, {
|
|
5760
5880
|
key: "resizePosition",
|
|
5761
5881
|
value: function resizePosition() {
|
|
5762
|
-
var _this$videoPos = this.videoPos,
|
|
5763
|
-
|
|
5882
|
+
var _this$videoPos = this.videoPos, vy = _this$videoPos.vy, vx = _this$videoPos.vx, h = _this$videoPos.h, w = _this$videoPos.w;
|
|
5883
|
+
var rotate = this.videoPos.rotate;
|
|
5884
|
+
if (rotate < 0 && h < 0 && w < 0) {
|
|
5764
5885
|
return;
|
|
5765
5886
|
}
|
|
5766
5887
|
var _pi = this.videoPos._pi;
|
|
@@ -5771,6 +5892,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5771
5892
|
return;
|
|
5772
5893
|
}
|
|
5773
5894
|
this.videoPos.pi = _pi;
|
|
5895
|
+
rotate = rotate < 0 ? 0 : rotate;
|
|
5774
5896
|
var _pos = {
|
|
5775
5897
|
rotate
|
|
5776
5898
|
};
|
|
@@ -6203,7 +6325,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6203
6325
|
}
|
|
6204
6326
|
}, {
|
|
6205
6327
|
key: "setUserActive",
|
|
6206
|
-
value: function setUserActive(isActive
|
|
6328
|
+
value: function setUserActive(isActive) {
|
|
6329
|
+
var isMuted = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
6207
6330
|
if (typeof isMuted === "boolean" && isMuted !== this.muted) {
|
|
6208
6331
|
this.addInnerOP("volumechange");
|
|
6209
6332
|
this.muted = isMuted;
|
|
@@ -6218,15 +6341,25 @@ var __publicField = (obj, key, value) => {
|
|
|
6218
6341
|
set: function set(value) {
|
|
6219
6342
|
XG_DEBUG.config.debug = value;
|
|
6220
6343
|
}
|
|
6344
|
+
}, {
|
|
6345
|
+
key: "instManager",
|
|
6346
|
+
get: function get() {
|
|
6347
|
+
return instManager;
|
|
6348
|
+
},
|
|
6349
|
+
set: function set(value) {
|
|
6350
|
+
instManager = value;
|
|
6351
|
+
}
|
|
6221
6352
|
}, {
|
|
6222
6353
|
key: "getCurrentUserActivePlayerId",
|
|
6223
6354
|
value: function getCurrentUserActivePlayerId() {
|
|
6224
|
-
|
|
6355
|
+
var _instManager3;
|
|
6356
|
+
return (_instManager3 = instManager) === null || _instManager3 === void 0 ? void 0 : _instManager3.getActiveId();
|
|
6225
6357
|
}
|
|
6226
6358
|
}, {
|
|
6227
6359
|
key: "setCurrentUserActive",
|
|
6228
6360
|
value: function setCurrentUserActive(playerId, isActive) {
|
|
6229
|
-
|
|
6361
|
+
var _instManager4;
|
|
6362
|
+
(_instManager4 = instManager) === null || _instManager4 === void 0 ? void 0 : _instManager4.setActive(playerId, isActive);
|
|
6230
6363
|
}
|
|
6231
6364
|
}, {
|
|
6232
6365
|
key: "isHevcSupported",
|
|
@@ -6261,6 +6394,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6261
6394
|
}(MediaProxy);
|
|
6262
6395
|
_defineProperty(Player, "defaultPreset", null);
|
|
6263
6396
|
_defineProperty(Player, "XgVideoProxy", null);
|
|
6397
|
+
Player.instManager = InstManager.getInstance();
|
|
6264
6398
|
var index_min = "";
|
|
6265
6399
|
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
6266
6400
|
ErrorCode2[ErrorCode2["MANIFEST_HLS_ERROR"] = 1100] = "MANIFEST_HLS_ERROR";
|
|
@@ -6387,6 +6521,14 @@ var __publicField = (obj, key, value) => {
|
|
|
6387
6521
|
messageTextKey: "MODULE_LOAD_ERROR",
|
|
6388
6522
|
level: "Fatal"
|
|
6389
6523
|
/* Fatal */
|
|
6524
|
+
},
|
|
6525
|
+
[
|
|
6526
|
+
7100
|
|
6527
|
+
/* DRM_LICENSE */
|
|
6528
|
+
]: {
|
|
6529
|
+
messageTextKey: "DRM_LICENSE",
|
|
6530
|
+
level: "Fatal"
|
|
6531
|
+
/* Fatal */
|
|
6390
6532
|
}
|
|
6391
6533
|
};
|
|
6392
6534
|
const ERROR_TYPE_INFO = {
|
|
@@ -6456,7 +6598,12 @@ var __publicField = (obj, key, value) => {
|
|
|
6456
6598
|
}
|
|
6457
6599
|
};
|
|
6458
6600
|
class VeError extends Error {
|
|
6459
|
-
/**
|
|
6601
|
+
/** {zh}
|
|
6602
|
+
* @hidden
|
|
6603
|
+
* @param error
|
|
6604
|
+
* @param i18n
|
|
6605
|
+
*/
|
|
6606
|
+
/** {en}
|
|
6460
6607
|
* @hidden
|
|
6461
6608
|
* @param error
|
|
6462
6609
|
* @param i18n
|
|
@@ -6469,16 +6616,25 @@ var __publicField = (obj, key, value) => {
|
|
|
6469
6616
|
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"));
|
|
6470
6617
|
super(message);
|
|
6471
6618
|
/**
|
|
6472
|
-
* @brief
|
|
6619
|
+
* @brief 错误码。
|
|
6620
|
+
*/
|
|
6621
|
+
/** {en}
|
|
6622
|
+
* @brief The error code.
|
|
6473
6623
|
*/
|
|
6474
6624
|
__publicField(this, "errorCode");
|
|
6475
|
-
/**
|
|
6625
|
+
/** {zh}
|
|
6476
6626
|
* @brief 错误等级。
|
|
6477
6627
|
*/
|
|
6628
|
+
/** {en}
|
|
6629
|
+
* @brief The error level.
|
|
6630
|
+
*/
|
|
6478
6631
|
__publicField(this, "level");
|
|
6479
|
-
/**
|
|
6632
|
+
/** {zh}
|
|
6480
6633
|
* @brief 其他错误信息。
|
|
6481
6634
|
*/
|
|
6635
|
+
/** {en}
|
|
6636
|
+
* @brief Other error messages.
|
|
6637
|
+
*/
|
|
6482
6638
|
__publicField(this, "ext");
|
|
6483
6639
|
this.errorCode = (errorInfo == null ? void 0 : errorInfo.errorCode) ?? "UNKNOWN";
|
|
6484
6640
|
this.level = (errorInfo == null ? void 0 : errorInfo.level) ?? "Error";
|
|
@@ -6531,7 +6687,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6531
6687
|
}
|
|
6532
6688
|
}, {
|
|
6533
6689
|
key: "show",
|
|
6534
|
-
value: function show() {
|
|
6690
|
+
value: function show(value) {
|
|
6535
6691
|
util.removeClass(this.root, "hide");
|
|
6536
6692
|
}
|
|
6537
6693
|
}, {
|
|
@@ -6610,10 +6766,11 @@ var __publicField = (obj, key, value) => {
|
|
|
6610
6766
|
}, {
|
|
6611
6767
|
key: "render",
|
|
6612
6768
|
value: function render() {
|
|
6613
|
-
var _this$config = this.config, poster = _this$config.poster, hideCanplay = _this$config.hideCanplay, fillMode = _this$config.fillMode;
|
|
6769
|
+
var _this$config = this.config, poster = _this$config.poster, hideCanplay = _this$config.hideCanplay, fillMode = _this$config.fillMode, notHidden = _this$config.notHidden;
|
|
6614
6770
|
var _bg = this.getBgSize(fillMode);
|
|
6615
6771
|
var style = poster ? "background-image:url(".concat(poster, ");").concat(_bg) : _bg;
|
|
6616
|
-
|
|
6772
|
+
var className = notHidden ? "xg-not-hidden" : hideCanplay ? "xg-showplay" : "";
|
|
6773
|
+
return '<xg-poster class="xgplayer-poster '.concat(className, '" style="').concat(style, '">\n </xg-poster>');
|
|
6617
6774
|
}
|
|
6618
6775
|
}], [{
|
|
6619
6776
|
key: "pluginName",
|
|
@@ -6626,6 +6783,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6626
6783
|
return {
|
|
6627
6784
|
isEndedShow: true,
|
|
6628
6785
|
hideCanplay: false,
|
|
6786
|
+
notHidden: false,
|
|
6629
6787
|
poster: "",
|
|
6630
6788
|
fillMode: "fixWidth"
|
|
6631
6789
|
};
|
|
@@ -6769,7 +6927,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6769
6927
|
}
|
|
6770
6928
|
}, {
|
|
6771
6929
|
key: "show",
|
|
6772
|
-
value: function show() {
|
|
6930
|
+
value: function show(value) {
|
|
6773
6931
|
util.removeClass(this.root, "hide");
|
|
6774
6932
|
}
|
|
6775
6933
|
}, {
|
|
@@ -7731,14 +7889,14 @@ var __publicField = (obj, key, value) => {
|
|
|
7731
7889
|
key: "initEvents",
|
|
7732
7890
|
value: function initEvents() {
|
|
7733
7891
|
var _this3 = this;
|
|
7734
|
-
var _this$player = this.player,
|
|
7892
|
+
var _this$player = this.player, media = _this$player.media, root = _this$player.root;
|
|
7735
7893
|
var enableContextmenu = this.playerConfig.enableContextmenu;
|
|
7736
7894
|
root && root.addEventListener("click", this.onVideoClick, false);
|
|
7737
7895
|
root && root.addEventListener("dblclick", this.onVideoDblClick, false);
|
|
7738
7896
|
Object.keys(MOUSE_EVENTS).map(function(item) {
|
|
7739
7897
|
root.addEventListener(item, _this3[MOUSE_EVENTS[item]], false);
|
|
7740
7898
|
});
|
|
7741
|
-
enableContextmenu &&
|
|
7899
|
+
!enableContextmenu && media && media.addEventListener("contextmenu", this.onContextmenu, false);
|
|
7742
7900
|
}
|
|
7743
7901
|
}, {
|
|
7744
7902
|
key: "switchPlayPause",
|
|
@@ -9462,16 +9620,6 @@ var __publicField = (obj, key, value) => {
|
|
|
9462
9620
|
}
|
|
9463
9621
|
}
|
|
9464
9622
|
}
|
|
9465
|
-
}, {
|
|
9466
|
-
key: "show",
|
|
9467
|
-
value: function show() {
|
|
9468
|
-
_get(_getPrototypeOf(Fullscreen2.prototype), "show", this).call(this);
|
|
9469
|
-
}
|
|
9470
|
-
}, {
|
|
9471
|
-
key: "hide",
|
|
9472
|
-
value: function hide() {
|
|
9473
|
-
_get(_getPrototypeOf(Fullscreen2.prototype), "hide", this).call(this);
|
|
9474
|
-
}
|
|
9475
9623
|
}, {
|
|
9476
9624
|
key: "render",
|
|
9477
9625
|
value: function render() {
|
|
@@ -9927,11 +10075,14 @@ var __publicField = (obj, key, value) => {
|
|
|
9927
10075
|
}, 0);
|
|
9928
10076
|
!paused && player.mediaPlay();
|
|
9929
10077
|
_this3.setAttr("data-state", "normal");
|
|
10078
|
+
_this3.pipWindow = null;
|
|
9930
10079
|
player.emit(PIP_CHANGE, false);
|
|
9931
10080
|
};
|
|
9932
10081
|
this.enterPIPCallback = function(e) {
|
|
9933
10082
|
player.emit(PIP_CHANGE, true);
|
|
9934
|
-
|
|
10083
|
+
if (e !== null && e !== void 0 && e.pictureInPictureWindow) {
|
|
10084
|
+
_this3.pipWindow = e.pictureInPictureWindow;
|
|
10085
|
+
}
|
|
9935
10086
|
_this3.setAttr("data-state", "pip");
|
|
9936
10087
|
};
|
|
9937
10088
|
this.onWebkitpresentationmodechanged = function(e) {
|
|
@@ -9952,10 +10103,33 @@ var __publicField = (obj, key, value) => {
|
|
|
9952
10103
|
PIP2.checkWebkitSetPresentationMode(player.media) && player.media.addEventListener("webkitpresentationmodechanged", this.onWebkitpresentationmodechanged);
|
|
9953
10104
|
}
|
|
9954
10105
|
}
|
|
10106
|
+
}, {
|
|
10107
|
+
key: "copyStyleIntoPiPWindow",
|
|
10108
|
+
value: function copyStyleIntoPiPWindow(pipWin) {
|
|
10109
|
+
var textContent = _toConsumableArray(document.styleSheets).map(function(style2) {
|
|
10110
|
+
try {
|
|
10111
|
+
return _toConsumableArray(style2.cssRules).map(function(rule) {
|
|
10112
|
+
return rule.cssText;
|
|
10113
|
+
}).join("");
|
|
10114
|
+
} catch (e) {
|
|
10115
|
+
var link = document.createElement("link");
|
|
10116
|
+
link.rel = "stylesheet";
|
|
10117
|
+
link.type = style2.type;
|
|
10118
|
+
link.media = style2.media;
|
|
10119
|
+
link.href = style2.href;
|
|
10120
|
+
pipWin.document.head.appendChild(link);
|
|
10121
|
+
}
|
|
10122
|
+
return "";
|
|
10123
|
+
}).filter(Boolean).join("\n");
|
|
10124
|
+
var style = document.createElement("style");
|
|
10125
|
+
style.textContent = textContent;
|
|
10126
|
+
pipWin.document.head.appendChild(style);
|
|
10127
|
+
}
|
|
9955
10128
|
}, {
|
|
9956
10129
|
key: "requestPIP",
|
|
9957
10130
|
value: function requestPIP() {
|
|
9958
|
-
var
|
|
10131
|
+
var _this4 = this;
|
|
10132
|
+
var player = this.player, playerConfig = this.playerConfig, config = this.config;
|
|
9959
10133
|
if (!this.isPIPAvailable() || this.isPip) {
|
|
9960
10134
|
return;
|
|
9961
10135
|
}
|
|
@@ -9964,7 +10138,62 @@ var __publicField = (obj, key, value) => {
|
|
|
9964
10138
|
if (poster) {
|
|
9965
10139
|
player.media.poster = util.typeOf(poster) === "String" ? poster : poster.poster;
|
|
9966
10140
|
}
|
|
9967
|
-
|
|
10141
|
+
if (config.preferDocument && this.isDocPIPAvailable()) {
|
|
10142
|
+
var pipOptions = {};
|
|
10143
|
+
if (config.width && config.height) {
|
|
10144
|
+
pipOptions.width = config.width;
|
|
10145
|
+
pipOptions.height = config.height;
|
|
10146
|
+
} else {
|
|
10147
|
+
var playerRect = player.root.getBoundingClientRect();
|
|
10148
|
+
pipOptions.width = playerRect.width;
|
|
10149
|
+
pipOptions.height = playerRect.height;
|
|
10150
|
+
}
|
|
10151
|
+
documentPictureInPicture.requestWindow(pipOptions).then(function(pipWin) {
|
|
10152
|
+
var docPiPNode = config.docPiPNode, docPiPStyle = config.docPiPStyle;
|
|
10153
|
+
_this4.enterPIPCallback();
|
|
10154
|
+
var pipRoot = docPiPNode || player.root;
|
|
10155
|
+
var parentNode = pipRoot.parentElement;
|
|
10156
|
+
var previousSibling = pipRoot.previousSibling;
|
|
10157
|
+
var nextSibling = pipRoot.nextSibling;
|
|
10158
|
+
_this4.copyStyleIntoPiPWindow(pipWin);
|
|
10159
|
+
var styles = document.createElement("style");
|
|
10160
|
+
styles.append("body{padding:0; margin:0;}");
|
|
10161
|
+
if (docPiPStyle) {
|
|
10162
|
+
var cssContent = "";
|
|
10163
|
+
if (typeof docPiPStyle === "string") {
|
|
10164
|
+
cssContent = docPiPStyle;
|
|
10165
|
+
} else if (typeof docPiPStyle === "function") {
|
|
10166
|
+
cssContent = docPiPStyle.call(config);
|
|
10167
|
+
}
|
|
10168
|
+
if (cssContent) {
|
|
10169
|
+
styles.append(cssContent);
|
|
10170
|
+
}
|
|
10171
|
+
} else if (pipRoot === player.root) {
|
|
10172
|
+
styles.append("\n .xgplayer{width: 100%!important; height: 100%!important;}\n ");
|
|
10173
|
+
}
|
|
10174
|
+
pipWin.document.head.append(styles);
|
|
10175
|
+
pipWin.document.body.append(pipRoot);
|
|
10176
|
+
pipWin.addEventListener("pagehide", function(event) {
|
|
10177
|
+
if (parentNode) {
|
|
10178
|
+
if (nextSibling) {
|
|
10179
|
+
parentNode.insertBefore(pipRoot, nextSibling);
|
|
10180
|
+
} else if (previousSibling) {
|
|
10181
|
+
parentNode.insertBefore(pipRoot, previousSibling.nextSibling);
|
|
10182
|
+
} else {
|
|
10183
|
+
parentNode.appendChild(pipRoot);
|
|
10184
|
+
}
|
|
10185
|
+
} else {
|
|
10186
|
+
}
|
|
10187
|
+
_this4.leavePIPCallback();
|
|
10188
|
+
}, {
|
|
10189
|
+
once: true
|
|
10190
|
+
});
|
|
10191
|
+
});
|
|
10192
|
+
} else if (PIP2.checkWebkitSetPresentationMode(player.media)) {
|
|
10193
|
+
player.media.webkitSetPresentationMode("picture-in-picture");
|
|
10194
|
+
} else {
|
|
10195
|
+
player.media.requestPictureInPicture();
|
|
10196
|
+
}
|
|
9968
10197
|
return true;
|
|
9969
10198
|
} catch (reason) {
|
|
9970
10199
|
console.error("requestPiP", reason);
|
|
@@ -9977,7 +10206,14 @@ var __publicField = (obj, key, value) => {
|
|
|
9977
10206
|
var player = this.player;
|
|
9978
10207
|
try {
|
|
9979
10208
|
if (this.isPIPAvailable() && this.isPip) {
|
|
9980
|
-
|
|
10209
|
+
var _documentPictureInPic;
|
|
10210
|
+
if (this.isDocPIPAvailable() && (_documentPictureInPic = documentPictureInPicture) !== null && _documentPictureInPic !== void 0 && _documentPictureInPic.window) {
|
|
10211
|
+
documentPictureInPicture.window.close();
|
|
10212
|
+
} else if (PIP2.checkWebkitSetPresentationMode(player.media)) {
|
|
10213
|
+
player.media.webkitSetPresentationMode("inline");
|
|
10214
|
+
} else {
|
|
10215
|
+
document.exitPictureInPicture();
|
|
10216
|
+
}
|
|
9981
10217
|
}
|
|
9982
10218
|
return true;
|
|
9983
10219
|
} catch (reason) {
|
|
@@ -9988,15 +10224,21 @@ var __publicField = (obj, key, value) => {
|
|
|
9988
10224
|
}, {
|
|
9989
10225
|
key: "isPip",
|
|
9990
10226
|
get: function get() {
|
|
10227
|
+
var _documentPictureInPic2;
|
|
9991
10228
|
var player = this.player;
|
|
9992
|
-
return document.pictureInPictureElement && document.pictureInPictureElement === player.media || player.media.webkitPresentationMode === PresentationMode.PIP;
|
|
10229
|
+
return !!(this.isDocPIPAvailable() && (_documentPictureInPic2 = documentPictureInPicture) !== null && _documentPictureInPic2 !== void 0 && _documentPictureInPic2.window) || document.pictureInPictureElement && document.pictureInPictureElement === player.media || player.media.webkitPresentationMode === PresentationMode.PIP;
|
|
9993
10230
|
}
|
|
9994
10231
|
}, {
|
|
9995
10232
|
key: "isPIPAvailable",
|
|
9996
10233
|
value: function isPIPAvailable() {
|
|
9997
10234
|
var video = this.player.media;
|
|
9998
10235
|
var _isEnabled = util.typeOf(document.pictureInPictureEnabled) === "Boolean" ? document.pictureInPictureEnabled : true;
|
|
9999
|
-
return _isEnabled && (util.typeOf(video.disablePictureInPicture) === "Boolean" && !video.disablePictureInPicture || video.webkitSupportsPresentationMode && util.typeOf(video.webkitSetPresentationMode) === "Function");
|
|
10236
|
+
return _isEnabled && (util.typeOf(video.disablePictureInPicture) === "Boolean" && !video.disablePictureInPicture || video.webkitSupportsPresentationMode && util.typeOf(video.webkitSetPresentationMode) === "Function") || this.isDocPIPAvailable();
|
|
10237
|
+
}
|
|
10238
|
+
}, {
|
|
10239
|
+
key: "isDocPIPAvailable",
|
|
10240
|
+
value: function isDocPIPAvailable() {
|
|
10241
|
+
return "documentPictureInPicture" in window && /^(https|file)/.test(location.protocol);
|
|
10000
10242
|
}
|
|
10001
10243
|
}, {
|
|
10002
10244
|
key: "destroy",
|
|
@@ -10028,7 +10270,12 @@ var __publicField = (obj, key, value) => {
|
|
|
10028
10270
|
return {
|
|
10029
10271
|
position: POSITIONS$1.CONTROLS_RIGHT,
|
|
10030
10272
|
index: 6,
|
|
10031
|
-
showIcon: false
|
|
10273
|
+
showIcon: false,
|
|
10274
|
+
preferDocument: false,
|
|
10275
|
+
width: void 0,
|
|
10276
|
+
height: void 0,
|
|
10277
|
+
docPiPNode: void 0,
|
|
10278
|
+
docPiPStyle: void 0
|
|
10032
10279
|
};
|
|
10033
10280
|
}
|
|
10034
10281
|
}, {
|
|
@@ -12020,7 +12267,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12020
12267
|
}
|
|
12021
12268
|
this._waitingStartTime = Date.now();
|
|
12022
12269
|
const currentTime = this.player.currentTime;
|
|
12023
|
-
this._timer = setTimeout(() => {
|
|
12270
|
+
this._timer = window.setTimeout(() => {
|
|
12024
12271
|
if (this.player && this.player.currentTime <= currentTime + 0.1) {
|
|
12025
12272
|
this.player.emit(Events.LONG_WAITING);
|
|
12026
12273
|
if (this.config.needFallback) {
|
|
@@ -12125,7 +12372,8 @@ var __publicField = (obj, key, value) => {
|
|
|
12125
12372
|
"plugin:hls": "veplayer.plugin.hls.[env].[ext]",
|
|
12126
12373
|
"plugin:shaka": "veplayer.plugin.shaka.[env].[ext]",
|
|
12127
12374
|
"plugin:rtm": "veplayer.plugin.rtm.[env].[ext]",
|
|
12128
|
-
"plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]"
|
|
12375
|
+
"plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]",
|
|
12376
|
+
"plugin:drm": "veplayer.plugin.drm.[env].[ext]"
|
|
12129
12377
|
};
|
|
12130
12378
|
var DynamicModule = /* @__PURE__ */ ((DynamicModule2) => {
|
|
12131
12379
|
DynamicModule2["BizVod"] = "biz:vod";
|
|
@@ -12136,6 +12384,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12136
12384
|
DynamicModule2["PluginShaka"] = "plugin:shaka";
|
|
12137
12385
|
DynamicModule2["PluginRtm"] = "plugin:rtm";
|
|
12138
12386
|
DynamicModule2["PluginXgvideo"] = "plugin:xgvideo";
|
|
12387
|
+
DynamicModule2["PluginDrm"] = "plugin:drm";
|
|
12139
12388
|
return DynamicModule2;
|
|
12140
12389
|
})(DynamicModule || {});
|
|
12141
12390
|
class Loader {
|
|
@@ -12179,13 +12428,13 @@ var __publicField = (obj, key, value) => {
|
|
|
12179
12428
|
src: src2 ?? moduleSrc,
|
|
12180
12429
|
name,
|
|
12181
12430
|
state: 0,
|
|
12182
|
-
exports: {}
|
|
12431
|
+
exports: { __PLUGIN_NAME__: name }
|
|
12183
12432
|
};
|
|
12184
12433
|
this.modules[name] = module2;
|
|
12185
12434
|
this.mountPromiseMap[name] = this._mount(module2);
|
|
12186
12435
|
return this.mountPromiseMap[name];
|
|
12187
12436
|
});
|
|
12188
|
-
__publicField(this, "
|
|
12437
|
+
__publicField(this, "registerPlugin", (name, exports3) => {
|
|
12189
12438
|
if (!this._moduleSystem) {
|
|
12190
12439
|
throw new Error(
|
|
12191
12440
|
`You have to specify moduleSystem first, call setModuleSystem(moduleSystem) to set module system`
|
|
@@ -12212,6 +12461,11 @@ var __publicField = (obj, key, value) => {
|
|
|
12212
12461
|
}
|
|
12213
12462
|
return this.modules[name].exports;
|
|
12214
12463
|
});
|
|
12464
|
+
__publicField(this, "register", (exports3) => {
|
|
12465
|
+
return exports3.map((exportModule) => {
|
|
12466
|
+
return this.registerPlugin(exportModule.__PLUGIN_NAME__, exportModule);
|
|
12467
|
+
});
|
|
12468
|
+
});
|
|
12215
12469
|
this._baseUrl = options.baseUrl;
|
|
12216
12470
|
}
|
|
12217
12471
|
get baseUrl() {
|
|
@@ -12251,6 +12505,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12251
12505
|
const loader = new Loader({
|
|
12252
12506
|
baseUrl
|
|
12253
12507
|
});
|
|
12508
|
+
const registerPlugin = loader.registerPlugin;
|
|
12254
12509
|
const register = loader.register;
|
|
12255
12510
|
function setModuleSystem(moduleSystem) {
|
|
12256
12511
|
loader.setModuleSystem(moduleSystem);
|
|
@@ -12440,7 +12695,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12440
12695
|
}
|
|
12441
12696
|
wxCanPlayFn() {
|
|
12442
12697
|
window.WeixinJSBridge && window.WeixinJSBridge.invoke("getNetworkType", {}, () => {
|
|
12443
|
-
this._wxTimer = setTimeout(() => {
|
|
12698
|
+
this._wxTimer = window.setTimeout(() => {
|
|
12444
12699
|
this._wxTimer && clearTimeout(this._wxTimer);
|
|
12445
12700
|
const ret = this.player.play();
|
|
12446
12701
|
if (ret && ret.then) {
|
|
@@ -12514,8 +12769,8 @@ var __publicField = (obj, key, value) => {
|
|
|
12514
12769
|
this._state.showUnmuteBt = true;
|
|
12515
12770
|
this._state.mode = 1;
|
|
12516
12771
|
this.renderUnmuteBt();
|
|
12517
|
-
this._timer = setTimeout(() => {
|
|
12518
|
-
this._timer && clearTimeout(this._timer);
|
|
12772
|
+
this._timer = window.setTimeout(() => {
|
|
12773
|
+
this._timer && window.clearTimeout(this._timer);
|
|
12519
12774
|
const ret = this.player.play();
|
|
12520
12775
|
if (ret && ret.then) {
|
|
12521
12776
|
ret.then(() => {
|
|
@@ -12987,7 +13242,10 @@ var __publicField = (obj, key, value) => {
|
|
|
12987
13242
|
return xgOptions;
|
|
12988
13243
|
};
|
|
12989
13244
|
class VePlayerBase {
|
|
12990
|
-
/**
|
|
13245
|
+
/** {zh}
|
|
13246
|
+
* @hidden
|
|
13247
|
+
*/
|
|
13248
|
+
/** {en}
|
|
12991
13249
|
* @hidden
|
|
12992
13250
|
*/
|
|
12993
13251
|
constructor(options = {}) {
|
|
@@ -13040,7 +13298,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13040
13298
|
this._errorCallback = (err) => this._handleFallback(err);
|
|
13041
13299
|
this._player.on(ERROR, this._errorCallback);
|
|
13042
13300
|
}
|
|
13043
|
-
/**
|
|
13301
|
+
/** {zh}
|
|
13044
13302
|
* @brief 获取视频的就绪状态,其状态枚举值、枚举名称和说明如下:
|
|
13045
13303
|
* - `0`:HAVE_NOTHING,没有关于媒体资源的可用信息
|
|
13046
13304
|
* - `1`:HAVE_METADATA,已检索到足够多的媒体资源来初始化元数据, 快进/快退不会引发异常
|
|
@@ -13048,68 +13306,107 @@ var __publicField = (obj, key, value) => {
|
|
|
13048
13306
|
* - `3`:HAVE_FUTURE_DATA,当前播放位置以及未来至少一小段时间的数据是可用的(至少有两帧以上的数据)
|
|
13049
13307
|
* - `4`:HAVE_ENOUGH_DATA,有足够的数据可用,并且下载速率足够,媒体可以不间断地播放到最后
|
|
13050
13308
|
*/
|
|
13309
|
+
/** {en}
|
|
13310
|
+
* @brief Gets the readiness of the video.
|
|
13311
|
+
* - `0`: HAVE_NOTHING, which means there is no information about the media resources.
|
|
13312
|
+
* - `1`: HAVE_METADATA, which means enough media resources have been retrieved to initialize the metadata and fast-forward/rewind will not raise an exception.
|
|
13313
|
+
* - `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.
|
|
13314
|
+
* - `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).
|
|
13315
|
+
* - `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.
|
|
13316
|
+
*/
|
|
13051
13317
|
get readyState() {
|
|
13052
13318
|
return this._player.readyState;
|
|
13053
13319
|
}
|
|
13054
|
-
/**
|
|
13320
|
+
/** {zh}
|
|
13055
13321
|
* @brief 获取当前已缓冲的时间范围。
|
|
13056
13322
|
*/
|
|
13323
|
+
/** {en}
|
|
13324
|
+
* @brief Gets the currently buffered time range.
|
|
13325
|
+
*/
|
|
13057
13326
|
get buffered() {
|
|
13058
13327
|
return this._player.buffered;
|
|
13059
13328
|
}
|
|
13060
|
-
/**
|
|
13329
|
+
/** {zh}
|
|
13061
13330
|
* @brief 获取已经播放的音频/视频的时间范围。
|
|
13062
13331
|
*/
|
|
13332
|
+
/** {en}
|
|
13333
|
+
* @brief Gets the time range of the audio/video that has been played.
|
|
13334
|
+
*/
|
|
13063
13335
|
get played() {
|
|
13064
13336
|
return this._player.played;
|
|
13065
13337
|
}
|
|
13066
|
-
/**
|
|
13338
|
+
/** {zh}
|
|
13067
13339
|
* @brief 设置/获取视频当前的播放时间, 单位为 s。
|
|
13068
13340
|
*/
|
|
13341
|
+
/** {en}
|
|
13342
|
+
* @brief Sets or gets the current playback position of the video, in seconds.
|
|
13343
|
+
*/
|
|
13069
13344
|
get cumulateTime() {
|
|
13070
13345
|
return this._player.cumulateTime;
|
|
13071
13346
|
}
|
|
13072
|
-
/**
|
|
13347
|
+
/** {zh}
|
|
13073
13348
|
* @brief 获取是否处于焦点状态,处于焦点状态会显示控制栏。
|
|
13074
13349
|
*/
|
|
13350
|
+
/** {en}
|
|
13351
|
+
* @brief Gets whether the player has focus. The control bar is displayed when the player has focus.
|
|
13352
|
+
*/
|
|
13075
13353
|
get isFocused() {
|
|
13076
13354
|
return this._player.isActive;
|
|
13077
13355
|
}
|
|
13078
|
-
/**
|
|
13356
|
+
/** {zh}
|
|
13079
13357
|
* @brief 获取播放器是否处于全屏状态。
|
|
13080
13358
|
*/
|
|
13359
|
+
/** {en}
|
|
13360
|
+
* @brief Gets whether the player is in full-screen mode, in which the player covers the entire desktop.
|
|
13361
|
+
*/
|
|
13081
13362
|
get isFullscreen() {
|
|
13082
13363
|
return this._player.isFullscreen;
|
|
13083
13364
|
}
|
|
13084
|
-
/**
|
|
13365
|
+
/** {zh}
|
|
13085
13366
|
* @brief 获取播放器是否处于网页全屏状态。
|
|
13086
13367
|
*/
|
|
13368
|
+
/** {en}
|
|
13369
|
+
* @brief Gets whether the player is in full-window mode, in which the player covers the entire browser window.
|
|
13370
|
+
*/
|
|
13087
13371
|
get isCssFullscreen() {
|
|
13088
13372
|
return this._player.isCssfullScreen;
|
|
13089
13373
|
}
|
|
13090
|
-
/**
|
|
13374
|
+
/** {zh}
|
|
13091
13375
|
* @brief 获取视频的网络状态,其状态枚举值、枚举名称和说明如下:
|
|
13092
13376
|
* - `0`:NETWORK_EMPTY,目前还没有数据,readyState 的值是 HAVE_NOTHING
|
|
13093
13377
|
* - `1`:NETWORK_IDLE,HTMLMediaElement 处于活动状态并已选择资源,但未使用网络
|
|
13094
13378
|
* - `2`:NETWORK_LOADING,浏览器正在下载 HTMLMediaElement 数据
|
|
13095
13379
|
* - `3`:NETWORK_NO_SOURCE,未找到 HTMLMediaElement src。
|
|
13096
13380
|
*/
|
|
13381
|
+
/** {en}
|
|
13382
|
+
* @brief Gets the network condition of the video.
|
|
13383
|
+
* - `0`: NETWORK_EMPTY, which means there is no data yet, and `readyState` is `HAVE_NOTHING`.
|
|
13384
|
+
* - `1`: NETWORK_IDLE, which means the `HTMLMediaElement` element is active and the resources have been selected, but the network is not in use.
|
|
13385
|
+
* - `2`: NETWORK_LOADING, which means the browser is downloading the data of the `HTMLMediaElement` element.
|
|
13386
|
+
* - `3`: NETWORK_NO_SOURCE, the media source is not found according to the `src` property of the `HTMLMediaElement` element.
|
|
13387
|
+
*/
|
|
13097
13388
|
get networkState() {
|
|
13098
13389
|
return this._player.networkState;
|
|
13099
13390
|
}
|
|
13100
|
-
/**
|
|
13391
|
+
/** {zh}
|
|
13101
13392
|
* @brief 获取当前视频是否处于暂停状态。
|
|
13102
13393
|
*/
|
|
13394
|
+
/** {en}
|
|
13395
|
+
* @brief Gets whether the current video is suspended.
|
|
13396
|
+
*/
|
|
13103
13397
|
get paused() {
|
|
13104
13398
|
return this._player.paused;
|
|
13105
13399
|
}
|
|
13106
|
-
/**
|
|
13400
|
+
/** {zh}
|
|
13107
13401
|
* @brief 获取当前视频是否播放结束。
|
|
13108
13402
|
*/
|
|
13403
|
+
/** {en}
|
|
13404
|
+
* @brief Gets whether the current video has finished playing.
|
|
13405
|
+
*/
|
|
13109
13406
|
get ended() {
|
|
13110
13407
|
return this._player.ended;
|
|
13111
13408
|
}
|
|
13112
|
-
/**
|
|
13409
|
+
/** {zh}
|
|
13113
13410
|
* @brief 获取播放器当前所处的状态,其状态枚举值、枚举名称和说明如下:
|
|
13114
13411
|
* - `0`:ERROR,播放出现错误
|
|
13115
13412
|
* - `1`:INITIAL,初始化
|
|
@@ -13121,81 +13418,130 @@ var __publicField = (obj, key, value) => {
|
|
|
13121
13418
|
* - `7`:ENDED,播放结束
|
|
13122
13419
|
* - `8`:DESTROYED,播放器实例处于已被销毁
|
|
13123
13420
|
*/
|
|
13421
|
+
/** {en}
|
|
13422
|
+
* @brief Gets the current state of the player.
|
|
13423
|
+
* - `0`: ERROR, which means a playback error occurred
|
|
13424
|
+
* - `1`: INITIAL, which means initialization
|
|
13425
|
+
* - `2`: READY, which means the configuration/event/plug-in has been initialized/bound/instantiated
|
|
13426
|
+
* - `3`: ATTACHING, which means the media object is being mounted.
|
|
13427
|
+
* - `4`: ATTACHED, which means the media object has been mounted in the DOM
|
|
13428
|
+
* - `5`: NOTALLOW, which means the playback is blocked
|
|
13429
|
+
* - `6`: RUNNING, which means the playback has started successfully
|
|
13430
|
+
* - `7`: ENDED, which means the playback has ended
|
|
13431
|
+
* - `8`: DESTROYED, which means the player instance is destroyed
|
|
13432
|
+
*/
|
|
13124
13433
|
get state() {
|
|
13125
13434
|
return this._player.state;
|
|
13126
13435
|
}
|
|
13127
|
-
/**
|
|
13436
|
+
/** {zh}
|
|
13128
13437
|
* 获取当前播放视频的拉流地址。
|
|
13129
13438
|
*/
|
|
13439
|
+
/** {en}
|
|
13440
|
+
* Gets the current pull stream address.
|
|
13441
|
+
*/
|
|
13130
13442
|
get url() {
|
|
13131
13443
|
return this._player.config.url;
|
|
13132
13444
|
}
|
|
13133
|
-
/**
|
|
13134
|
-
* @brief
|
|
13445
|
+
/** {zh}
|
|
13446
|
+
* @brief 获取当前播放视频的线路名称唯一标识(name)。
|
|
13447
|
+
*/
|
|
13448
|
+
/** {en}
|
|
13449
|
+
* @brief Gets the current playback source ID.
|
|
13135
13450
|
*/
|
|
13136
13451
|
get source() {
|
|
13137
13452
|
var _a;
|
|
13138
13453
|
return (_a = this._sourceManager.source) == null ? void 0 : _a.name;
|
|
13139
13454
|
}
|
|
13140
|
-
/**
|
|
13455
|
+
/** {zh}
|
|
13141
13456
|
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|
|
13142
13457
|
*/
|
|
13458
|
+
/** {en}
|
|
13459
|
+
* @brief Gets the current resolution ID.
|
|
13460
|
+
*/
|
|
13143
13461
|
get definition() {
|
|
13144
13462
|
var _a;
|
|
13145
13463
|
return (_a = this._sourceManager.definition) == null ? void 0 : _a.definition;
|
|
13146
13464
|
}
|
|
13147
|
-
/**
|
|
13465
|
+
/** {zh}
|
|
13148
13466
|
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
13149
13467
|
*/
|
|
13468
|
+
/** {en}
|
|
13469
|
+
* @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).
|
|
13470
|
+
*/
|
|
13150
13471
|
get crossOrigin() {
|
|
13151
13472
|
return this._player.crossOrigin;
|
|
13152
13473
|
}
|
|
13153
|
-
/**
|
|
13474
|
+
/** {zh}
|
|
13154
13475
|
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
13155
13476
|
*/
|
|
13477
|
+
/** {en}
|
|
13478
|
+
* @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).
|
|
13479
|
+
*/
|
|
13156
13480
|
set crossOrigin(crossOrigin) {
|
|
13157
13481
|
this._player.crossOrigin = crossOrigin;
|
|
13158
13482
|
}
|
|
13159
|
-
/**
|
|
13483
|
+
/** {zh}
|
|
13160
13484
|
* @brief 获取和设置视频的音量,取值范围为 [0,1]。
|
|
13161
13485
|
*/
|
|
13486
|
+
/** {en}
|
|
13487
|
+
* @brief Gets the volume of the video. The value range is [0,1].
|
|
13488
|
+
*/
|
|
13162
13489
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
13163
13490
|
get volume() {
|
|
13164
13491
|
return this._player.volume;
|
|
13165
13492
|
}
|
|
13166
|
-
/**
|
|
13493
|
+
/** {zh}
|
|
13167
13494
|
* @brief 获取和设置视频的音量,取值范围为 [0,1]。
|
|
13168
13495
|
*/
|
|
13496
|
+
/** {en}
|
|
13497
|
+
* @brief Sets the volume of the video. Valid range: [0,1].
|
|
13498
|
+
*/
|
|
13169
13499
|
set volume(volume) {
|
|
13170
13500
|
this._player.volume = volume;
|
|
13171
13501
|
}
|
|
13172
|
-
/**
|
|
13502
|
+
/** {zh}
|
|
13173
13503
|
* @brief 获取和设置视频静音状态。
|
|
13174
13504
|
* - `true`:静音
|
|
13175
13505
|
* - `false`:非静音
|
|
13176
13506
|
*/
|
|
13507
|
+
/** {en}
|
|
13508
|
+
* @brief Gets whether the video is muted.
|
|
13509
|
+
* - `true`: Muted.
|
|
13510
|
+
* - `false`: Not muted.
|
|
13511
|
+
*/
|
|
13177
13512
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
13178
13513
|
get muted() {
|
|
13179
13514
|
return this._player.muted;
|
|
13180
13515
|
}
|
|
13181
|
-
/**
|
|
13516
|
+
/** {zh}
|
|
13182
13517
|
* @brief 获取和设置视频静音状态。
|
|
13183
13518
|
* - `true`:静音
|
|
13184
13519
|
* - `false`:非静音
|
|
13185
13520
|
*/
|
|
13521
|
+
/** {en}
|
|
13522
|
+
* @brief Mute or unmute the video.
|
|
13523
|
+
* - `true`: Mute the video.
|
|
13524
|
+
* - `false`: Unmute the video.
|
|
13525
|
+
*/
|
|
13186
13526
|
set muted(isMuted) {
|
|
13187
13527
|
this._player.muted = isMuted;
|
|
13188
13528
|
}
|
|
13189
|
-
/**
|
|
13529
|
+
/** {zh}
|
|
13190
13530
|
* @brief 获取和设置当前语言。
|
|
13191
13531
|
*/
|
|
13532
|
+
/** {en}
|
|
13533
|
+
* @brief Gets the current language.
|
|
13534
|
+
*/
|
|
13192
13535
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
13193
13536
|
get lang() {
|
|
13194
13537
|
return this._i18nManager.getLang();
|
|
13195
13538
|
}
|
|
13196
|
-
/**
|
|
13539
|
+
/** {zh}
|
|
13197
13540
|
* @brief 获取和设置当前语言。
|
|
13198
13541
|
*/
|
|
13542
|
+
/** {en}
|
|
13543
|
+
* @brief Sets the current language.
|
|
13544
|
+
*/
|
|
13199
13545
|
set lang(lang) {
|
|
13200
13546
|
var _a, _b;
|
|
13201
13547
|
if (this._player.lang === lang) {
|
|
@@ -13217,7 +13563,10 @@ var __publicField = (obj, key, value) => {
|
|
|
13217
13563
|
get _src() {
|
|
13218
13564
|
return this._player.currentSrc;
|
|
13219
13565
|
}
|
|
13220
|
-
/**
|
|
13566
|
+
/** {zh}
|
|
13567
|
+
* @hidden
|
|
13568
|
+
*/
|
|
13569
|
+
/** {en}
|
|
13221
13570
|
* @hidden
|
|
13222
13571
|
*/
|
|
13223
13572
|
static async create(options = {}, Constructor) {
|
|
@@ -13247,11 +13596,16 @@ var __publicField = (obj, key, value) => {
|
|
|
13247
13596
|
sourceManager
|
|
13248
13597
|
});
|
|
13249
13598
|
}
|
|
13250
|
-
/**
|
|
13599
|
+
/** {zh}
|
|
13251
13600
|
* @brief 调用此方法切换拉流地址、线路、清晰度。
|
|
13252
13601
|
* @param target 目标地址,可以是播放地址,也可以是线路和清晰度
|
|
13253
13602
|
* @param options 更多配置信息
|
|
13254
13603
|
*/
|
|
13604
|
+
/** {en}
|
|
13605
|
+
* @brief Switches the pull stream address, playback source, or resolution.
|
|
13606
|
+
* @param target The target pull stream address, playback source, or resolution.
|
|
13607
|
+
* @param options More configurations.
|
|
13608
|
+
*/
|
|
13255
13609
|
async switch(target, options) {
|
|
13256
13610
|
var _a, _b;
|
|
13257
13611
|
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) {
|
|
@@ -13268,20 +13622,31 @@ var __publicField = (obj, key, value) => {
|
|
|
13268
13622
|
await this._switch(targetDefinition);
|
|
13269
13623
|
return targetDefinition;
|
|
13270
13624
|
}
|
|
13271
|
-
/**
|
|
13625
|
+
/** {zh}
|
|
13272
13626
|
* @brief 调用此方法更新拉流地址列表。
|
|
13273
13627
|
* @param playlist 要更新的播放列表。
|
|
13274
13628
|
* @param target 更新后默认播放的资源。
|
|
13275
13629
|
*/
|
|
13630
|
+
/** {en}
|
|
13631
|
+
* @brief Updates the list of pull stream addresses.
|
|
13632
|
+
* @param Playlist The updated list.
|
|
13633
|
+
* @param Target The default playback resource after the update.
|
|
13634
|
+
*/
|
|
13276
13635
|
updatePlaylist(playlist, target) {
|
|
13277
13636
|
const sourceManager = this._sourceManager.updateSources(playlist, target);
|
|
13278
13637
|
return this._switch(sourceManager.definition);
|
|
13279
13638
|
}
|
|
13280
13639
|
// TODO: 等西瓜播放器完善错误码后增加函数重载以提供更好的类型
|
|
13281
13640
|
/**
|
|
13641
|
+
/** {zh}
|
|
13282
13642
|
* @brief 调用此方法监听指定事件,事件处理函数只执行一次。
|
|
13283
13643
|
* @param event 表示事件的名称。
|
|
13284
|
-
* @param callback
|
|
13644
|
+
* @param callback 表示事件的回调函数。
|
|
13645
|
+
*/
|
|
13646
|
+
/** {en}
|
|
13647
|
+
* @brief Listens for a specified event. The event handler is executed only once.
|
|
13648
|
+
* @param event The event name.
|
|
13649
|
+
* @param callback The callback function for the event.
|
|
13285
13650
|
*/
|
|
13286
13651
|
once(event, callback) {
|
|
13287
13652
|
var _a;
|
|
@@ -13294,10 +13659,15 @@ var __publicField = (obj, key, value) => {
|
|
|
13294
13659
|
this._player.once(xgEventName, xgCallback);
|
|
13295
13660
|
}
|
|
13296
13661
|
}
|
|
13297
|
-
/**
|
|
13662
|
+
/** {zh}
|
|
13298
13663
|
* @brief 调用此方法解绑或移除指定事件的事件监听。
|
|
13299
13664
|
* @param event 表示事件的名称。
|
|
13300
|
-
* @param callback
|
|
13665
|
+
* @param callback 表示事件的回调函数。
|
|
13666
|
+
*/
|
|
13667
|
+
/** {en}
|
|
13668
|
+
* @brief Stops listening for a specified event.
|
|
13669
|
+
* @param event The event name.
|
|
13670
|
+
* @param callback The callback function for the event.
|
|
13301
13671
|
*/
|
|
13302
13672
|
off(event, callback) {
|
|
13303
13673
|
var _a;
|
|
@@ -13308,26 +13678,39 @@ var __publicField = (obj, key, value) => {
|
|
|
13308
13678
|
this._events[event].delete(callback);
|
|
13309
13679
|
}
|
|
13310
13680
|
}
|
|
13311
|
-
/**
|
|
13681
|
+
/** {zh}
|
|
13312
13682
|
* @brief 调用此方法触发指定事件。
|
|
13313
13683
|
* @param event 表示事件的名称。
|
|
13314
13684
|
* @param data 事件信息。
|
|
13315
13685
|
*/
|
|
13686
|
+
/** {en}
|
|
13687
|
+
* @brief Triggers a specified event.
|
|
13688
|
+
* @param event The event name.
|
|
13689
|
+
* @param data The event information.
|
|
13690
|
+
*/
|
|
13316
13691
|
emit(event, data) {
|
|
13317
13692
|
const { xgEventName } = this._transformEvent(event);
|
|
13318
13693
|
this._player.emit(xgEventName, data);
|
|
13319
13694
|
}
|
|
13320
|
-
/**
|
|
13695
|
+
/** {zh}
|
|
13321
13696
|
* @brief 调用此方法解绑或移除指定事件的所有事件监听。
|
|
13322
13697
|
*/
|
|
13698
|
+
/** {en}
|
|
13699
|
+
* @brief Stops listening to any player event.
|
|
13700
|
+
*/
|
|
13323
13701
|
offAll() {
|
|
13324
13702
|
this._events = {};
|
|
13325
13703
|
this._player.offAll();
|
|
13326
13704
|
}
|
|
13327
|
-
/**
|
|
13705
|
+
/** {zh}
|
|
13328
13706
|
* @brief 调用此方法监听指定事件。
|
|
13329
|
-
* @param event
|
|
13330
|
-
* @param callback
|
|
13707
|
+
* @param event 表示事件名称。
|
|
13708
|
+
* @param callback 表示事件的回调函数。
|
|
13709
|
+
*/
|
|
13710
|
+
/** {en}
|
|
13711
|
+
* @brief Listens for a specified event.
|
|
13712
|
+
* @param event The event name.
|
|
13713
|
+
* @param callback The callback function for the event.
|
|
13331
13714
|
*/
|
|
13332
13715
|
on(event, callback) {
|
|
13333
13716
|
var _a;
|
|
@@ -13340,102 +13723,153 @@ var __publicField = (obj, key, value) => {
|
|
|
13340
13723
|
this._player.on(xgEventName, xgCallback);
|
|
13341
13724
|
}
|
|
13342
13725
|
}
|
|
13343
|
-
/**
|
|
13726
|
+
/** {zh}
|
|
13344
13727
|
* @brief 调用此方法开始播放 。
|
|
13345
13728
|
*/
|
|
13729
|
+
/** {en}
|
|
13730
|
+
* @brief Starts playback.
|
|
13731
|
+
*/
|
|
13346
13732
|
play() {
|
|
13347
13733
|
/* istanbul ignore next -- @preserve */
|
|
13348
13734
|
return this._player.play();
|
|
13349
13735
|
}
|
|
13350
|
-
/**
|
|
13736
|
+
/** {zh}
|
|
13351
13737
|
* @brief 调用此方法暂停播放。
|
|
13352
13738
|
*/
|
|
13739
|
+
/** {en}
|
|
13740
|
+
* @brief Pauses playback.
|
|
13741
|
+
*/
|
|
13353
13742
|
pause() {
|
|
13354
13743
|
/* istanbul ignore next -- @preserve */
|
|
13355
13744
|
return this._player.pause();
|
|
13356
13745
|
}
|
|
13357
|
-
/**
|
|
13746
|
+
/** {zh}
|
|
13358
13747
|
* @brief 调用此方法打开画中画。
|
|
13359
13748
|
*/
|
|
13749
|
+
/** {en}
|
|
13750
|
+
* @brief Turns on Picture-in-Picture (PIP).
|
|
13751
|
+
*/
|
|
13360
13752
|
requestPIP() {
|
|
13361
13753
|
var _a;
|
|
13362
13754
|
/* istanbul ignore next -- @preserve */
|
|
13363
13755
|
(_a = this._player.plugins.pip) == null ? void 0 : _a.requestPIP();
|
|
13364
13756
|
}
|
|
13365
|
-
/**
|
|
13757
|
+
/** {zh}
|
|
13366
13758
|
* @brief 调用此方法关闭画中画。
|
|
13367
13759
|
*/
|
|
13760
|
+
/** {en}
|
|
13761
|
+
* @brief Turns off Picture-in-Picture (PIP).
|
|
13762
|
+
*/
|
|
13368
13763
|
exitPIP() {
|
|
13369
13764
|
var _a;
|
|
13370
13765
|
/* istanbul ignore next -- @preserve */
|
|
13371
13766
|
(_a = this._player.plugins.pip) == null ? void 0 : _a.exitPIP();
|
|
13372
13767
|
}
|
|
13373
|
-
/**
|
|
13768
|
+
/** {zh}
|
|
13374
13769
|
* @brief 调用此方法重新拉流。
|
|
13375
13770
|
*/
|
|
13771
|
+
/** {en}
|
|
13772
|
+
* @brief Retries stream-pulling.
|
|
13773
|
+
*/
|
|
13376
13774
|
retry() {
|
|
13377
13775
|
return this._player.retry();
|
|
13378
13776
|
}
|
|
13379
|
-
/**
|
|
13777
|
+
/** {zh}
|
|
13380
13778
|
* @brief 播放器获取焦点,调用该方法 `veplayer.isFocused` 将会变为 `true`,并触发 `PLAYER_FOCUS` 事件。
|
|
13381
13779
|
* @param data 播放器获取焦点配置信息。
|
|
13382
13780
|
*/
|
|
13781
|
+
/** {en}
|
|
13782
|
+
* @brief The player gets focus. When the method is called, `veplayer.isFocused` will become `true` and the `PLAYER_FOCUS` event will be triggered.
|
|
13783
|
+
* @param data Related configurations.
|
|
13784
|
+
*/
|
|
13383
13785
|
focus(data) {
|
|
13384
13786
|
return this._player.focus(data);
|
|
13385
13787
|
}
|
|
13386
|
-
/**
|
|
13788
|
+
/** {zh}
|
|
13387
13789
|
* @brief 播放器失去焦点,调用该方法 `veplayer.isFocused` 将会变为 `false`,并触发 `PLAYER_BLUR` 事件。
|
|
13388
13790
|
* @param data 播放器失去焦点配置信息。
|
|
13389
13791
|
*/
|
|
13792
|
+
/** {en}
|
|
13793
|
+
* @brief The player loses focus. When the method is called, `veplayer.isFocused` will become `false` and the `PLAYER_BLUR` event will be triggered.
|
|
13794
|
+
* @param data The related configurations.
|
|
13795
|
+
*/
|
|
13390
13796
|
blur(data) {
|
|
13391
13797
|
return this._player.blur(data);
|
|
13392
13798
|
}
|
|
13393
|
-
/**
|
|
13799
|
+
/** {zh}
|
|
13394
13800
|
* @brief 调用此方法进入系统全屏状态。如果该方法调用的时候处于网页全屏状态会自动退出网页全屏,下发事件 `Events.FULLSCREEN_CHANGE`。
|
|
13395
13801
|
* @param el 全屏作用的 DOM 节点。
|
|
13396
13802
|
*/
|
|
13803
|
+
/** {en}
|
|
13804
|
+
* @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.
|
|
13805
|
+
* @param el The DOM node in which the player is displayed in full-screen mode.
|
|
13806
|
+
*/
|
|
13397
13807
|
requestFullscreen(el) {
|
|
13398
13808
|
return this._player.getFullscreen(el);
|
|
13399
13809
|
}
|
|
13400
|
-
/**
|
|
13810
|
+
/** {zh}
|
|
13401
13811
|
* @brief 调用此方法退出系统全屏状态,调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.FULLSCREEN_CHANGE` 事件。
|
|
13402
13812
|
* @param el 全屏作用的 DOM 节点。
|
|
13403
13813
|
*/
|
|
13814
|
+
/** {en}
|
|
13815
|
+
* @brief Exits full-screen mode. After the method is called, `veplayer.isFullscreen` will become `false` and the `Events.FULLSCREEN_CHANGE` event will be triggered.
|
|
13816
|
+
* @param el The DOM node of the full screen effect.
|
|
13817
|
+
*/
|
|
13404
13818
|
exitFullscreen(el) {
|
|
13405
13819
|
return this._player.exitFullscreen(el);
|
|
13406
13820
|
}
|
|
13407
|
-
/**
|
|
13821
|
+
/** {zh}
|
|
13408
13822
|
* @brief 调用此方法进入网页样式全屏状态,播放器进入网页全屏,利用 CSS 模拟实现全屏效果。如果该接口调用的时候处于全屏状态,会自动退出全屏,下发事件 `Events.CSS_FULLSCREEN_CHANGE`。
|
|
13409
13823
|
* @param el 全屏作用的 DOM 节点。
|
|
13410
13824
|
*/
|
|
13825
|
+
/** {en}
|
|
13826
|
+
* @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.
|
|
13827
|
+
* @param el The DOM node in which the player is displayed in full-window mode.
|
|
13828
|
+
*/
|
|
13411
13829
|
requestCssFullscreen(el) {
|
|
13412
13830
|
return this._player.getCssFullscreen(el);
|
|
13413
13831
|
}
|
|
13414
|
-
/**
|
|
13832
|
+
/** {zh}
|
|
13415
13833
|
* @brief 调用此方法退出网页样式全屏状态。 调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.CSS_FULLSCREEN_CHANGE` 事件。
|
|
13416
13834
|
*/
|
|
13835
|
+
/** {en}
|
|
13836
|
+
* @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.
|
|
13837
|
+
*/
|
|
13417
13838
|
exitCssFullscreen() {
|
|
13418
13839
|
return this._player.exitCssFullscreen();
|
|
13419
13840
|
}
|
|
13420
|
-
/**
|
|
13841
|
+
/** {zh}
|
|
13421
13842
|
* @brief 调用此方法在当前播放器上注册指定插件。
|
|
13422
13843
|
* @param plugin 插件构造函数。
|
|
13423
13844
|
* @param config 插件的配置列表。
|
|
13424
13845
|
*/
|
|
13846
|
+
/** {en}
|
|
13847
|
+
* @brief Registers a specified plug-in to the current player.
|
|
13848
|
+
* @param Plugin The plugin constructor.
|
|
13849
|
+
* @param config The plugin configurations.
|
|
13850
|
+
*/
|
|
13425
13851
|
registerPlugin(plugin, config) {
|
|
13426
13852
|
return this._player.registerPlugin(plugin, config);
|
|
13427
13853
|
}
|
|
13428
|
-
/**
|
|
13854
|
+
/** {zh}
|
|
13429
13855
|
* @brief 调用此方法在当前播放器上销毁/注销指定插件。
|
|
13430
13856
|
* @param plugin 插件实例或者插件名称。
|
|
13431
13857
|
*/
|
|
13858
|
+
/** {en}
|
|
13859
|
+
* @brief Destroys or unregisters a specified plugin from the player.
|
|
13860
|
+
* @param Plugin The plugin instance or name.
|
|
13861
|
+
*/
|
|
13432
13862
|
unRegisterPlugin(plugin) {
|
|
13433
13863
|
return this._player.unRegisterPlugin(plugin);
|
|
13434
13864
|
}
|
|
13435
|
-
/**
|
|
13865
|
+
/** {zh}
|
|
13436
13866
|
* @brief 调用此接口显示指定插件图标。
|
|
13437
13867
|
* @param pluginNames 插件名称
|
|
13438
13868
|
*/
|
|
13869
|
+
/** {en}
|
|
13870
|
+
* @brief Displays the icon of a specified plugin.
|
|
13871
|
+
* @param PluginNames The plugin name.
|
|
13872
|
+
*/
|
|
13439
13873
|
showIcon(pluginNames) {
|
|
13440
13874
|
const morePlugin = this._player.getPlugin("more");
|
|
13441
13875
|
pluginNames.forEach((pluginName) => {
|
|
@@ -13449,10 +13883,14 @@ var __publicField = (obj, key, value) => {
|
|
|
13449
13883
|
}
|
|
13450
13884
|
});
|
|
13451
13885
|
}
|
|
13452
|
-
/**
|
|
13886
|
+
/** {zh}
|
|
13453
13887
|
* @brief 调用此接口隐藏指定插件图标。
|
|
13454
13888
|
* @param pluginNames 插件名称
|
|
13455
13889
|
*/
|
|
13890
|
+
/** {en}
|
|
13891
|
+
* @brief Hides the icon of a specified plugin.
|
|
13892
|
+
* @param PluginNames The plugin name.
|
|
13893
|
+
*/
|
|
13456
13894
|
hideIcon(pluginNames) {
|
|
13457
13895
|
const morePlugin = this._player.getPlugin("more");
|
|
13458
13896
|
pluginNames.forEach((pluginName) => {
|
|
@@ -13466,14 +13904,20 @@ var __publicField = (obj, key, value) => {
|
|
|
13466
13904
|
}
|
|
13467
13905
|
});
|
|
13468
13906
|
}
|
|
13469
|
-
/**
|
|
13907
|
+
/** {zh}
|
|
13470
13908
|
* @brief 调用此方法销毁播放器实例。
|
|
13471
13909
|
*/
|
|
13910
|
+
/** {en}
|
|
13911
|
+
* @brief Destroys the player instance.
|
|
13912
|
+
*/
|
|
13472
13913
|
destroy() {
|
|
13473
13914
|
this._player.off(ERROR, this._errorCallback);
|
|
13474
13915
|
this._player.destroy();
|
|
13475
13916
|
}
|
|
13476
|
-
/**
|
|
13917
|
+
/** {zh}
|
|
13918
|
+
* @hidden
|
|
13919
|
+
*/
|
|
13920
|
+
/** {en}
|
|
13477
13921
|
* @hidden
|
|
13478
13922
|
*/
|
|
13479
13923
|
async prepare(url) {
|
|
@@ -13621,11 +14065,11 @@ var __publicField = (obj, key, value) => {
|
|
|
13621
14065
|
});
|
|
13622
14066
|
}
|
|
13623
14067
|
if (typeof VePlayer.register !== "undefined") {
|
|
13624
|
-
VePlayer.
|
|
14068
|
+
VePlayer.registerPlugin(DynamicModule.BizVod, {
|
|
13625
14069
|
createVodPlayer
|
|
13626
14070
|
});
|
|
13627
14071
|
} else {
|
|
13628
|
-
|
|
14072
|
+
registerPlugin(DynamicModule.BizVod, {
|
|
13629
14073
|
createVodPlayer
|
|
13630
14074
|
});
|
|
13631
14075
|
}
|