@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
|
@@ -43,8 +43,8 @@ function _typeof(obj) {
|
|
|
43
43
|
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
44
44
|
}, _typeof(obj);
|
|
45
45
|
}
|
|
46
|
-
function _classCallCheck(
|
|
47
|
-
if (!(
|
|
46
|
+
function _classCallCheck(instance2, Constructor) {
|
|
47
|
+
if (!(instance2 instanceof Constructor)) {
|
|
48
48
|
throw new TypeError("Cannot call a class as a function");
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1449,7 +1449,7 @@ var sniffer = {
|
|
|
1449
1449
|
}
|
|
1450
1450
|
}
|
|
1451
1451
|
};
|
|
1452
|
-
var version = "3.0.
|
|
1452
|
+
var version = "3.0.12";
|
|
1453
1453
|
var ERROR_TYPE_MAP = {
|
|
1454
1454
|
1: "media",
|
|
1455
1455
|
2: "media",
|
|
@@ -2311,10 +2311,10 @@ var INDEXDB = /* @__PURE__ */ function() {
|
|
|
2311
2311
|
}, {
|
|
2312
2312
|
key: "addData",
|
|
2313
2313
|
value: function addData(storename, data) {
|
|
2314
|
-
var
|
|
2314
|
+
var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
|
|
2315
2315
|
var request;
|
|
2316
2316
|
for (var i = 0; i < data.length; i++) {
|
|
2317
|
-
request =
|
|
2317
|
+
request = store2.add(data[i]);
|
|
2318
2318
|
request.onerror = function() {
|
|
2319
2319
|
};
|
|
2320
2320
|
request.onsuccess = function() {
|
|
@@ -2324,10 +2324,10 @@ var INDEXDB = /* @__PURE__ */ function() {
|
|
|
2324
2324
|
}, {
|
|
2325
2325
|
key: "putData",
|
|
2326
2326
|
value: function putData(storename, data) {
|
|
2327
|
-
var
|
|
2327
|
+
var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
|
|
2328
2328
|
var request;
|
|
2329
2329
|
for (var i = 0; i < data.length; i++) {
|
|
2330
|
-
request =
|
|
2330
|
+
request = store2.put(data[i]);
|
|
2331
2331
|
request.onerror = function() {
|
|
2332
2332
|
};
|
|
2333
2333
|
request.onsuccess = function() {
|
|
@@ -2338,8 +2338,8 @@ var INDEXDB = /* @__PURE__ */ function() {
|
|
|
2338
2338
|
key: "getDataByKey",
|
|
2339
2339
|
value: function getDataByKey(storename, key, callback) {
|
|
2340
2340
|
var self2 = this;
|
|
2341
|
-
var
|
|
2342
|
-
var request =
|
|
2341
|
+
var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
|
|
2342
|
+
var request = store2.get(key);
|
|
2343
2343
|
request.onerror = function() {
|
|
2344
2344
|
callback.call(self2, null);
|
|
2345
2345
|
};
|
|
@@ -2351,14 +2351,14 @@ var INDEXDB = /* @__PURE__ */ function() {
|
|
|
2351
2351
|
}, {
|
|
2352
2352
|
key: "deleteData",
|
|
2353
2353
|
value: function deleteData(storename, key) {
|
|
2354
|
-
var
|
|
2355
|
-
|
|
2354
|
+
var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
|
|
2355
|
+
store2.delete(key);
|
|
2356
2356
|
}
|
|
2357
2357
|
}, {
|
|
2358
2358
|
key: "clearData",
|
|
2359
2359
|
value: function clearData(storename) {
|
|
2360
|
-
var
|
|
2361
|
-
|
|
2360
|
+
var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
|
|
2361
|
+
store2.clear();
|
|
2362
2362
|
}
|
|
2363
2363
|
}]);
|
|
2364
2364
|
return INDEXDB2;
|
|
@@ -2475,24 +2475,24 @@ function removePluginHooks(pluginName) {
|
|
|
2475
2475
|
return plugin.removeHooks && plugin.removeHooks.apply(plugin, args);
|
|
2476
2476
|
}
|
|
2477
2477
|
}
|
|
2478
|
-
function hooksDescriptor(
|
|
2478
|
+
function hooksDescriptor(instance2) {
|
|
2479
2479
|
var presetHooks = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
2480
|
-
|
|
2480
|
+
instance2.__hooks = {};
|
|
2481
2481
|
presetHooks && presetHooks.map(function(item) {
|
|
2482
|
-
|
|
2482
|
+
instance2.__hooks[item] = null;
|
|
2483
2483
|
});
|
|
2484
|
-
Object.defineProperty(
|
|
2484
|
+
Object.defineProperty(instance2, "hooks", {
|
|
2485
2485
|
get: function get() {
|
|
2486
|
-
return
|
|
2487
|
-
if (
|
|
2486
|
+
return instance2.__hooks && Object.keys(instance2.__hooks).map(function(key) {
|
|
2487
|
+
if (instance2.__hooks[key]) {
|
|
2488
2488
|
return key;
|
|
2489
2489
|
}
|
|
2490
2490
|
});
|
|
2491
2491
|
}
|
|
2492
2492
|
});
|
|
2493
2493
|
}
|
|
2494
|
-
function delHooksDescriptor(
|
|
2495
|
-
|
|
2494
|
+
function delHooksDescriptor(instance2) {
|
|
2495
|
+
instance2.__hooks = null;
|
|
2496
2496
|
}
|
|
2497
2497
|
function runHooks(obj, hookName, handler) {
|
|
2498
2498
|
for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
|
|
@@ -3208,7 +3208,7 @@ var Plugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
3208
3208
|
var cs = window.getComputedStyle(this.root, null);
|
|
3209
3209
|
var cssDisplayValue = cs.getPropertyValue("display");
|
|
3210
3210
|
if (cssDisplayValue === "none") {
|
|
3211
|
-
|
|
3211
|
+
this.root.style.display = "block";
|
|
3212
3212
|
}
|
|
3213
3213
|
}
|
|
3214
3214
|
}, {
|
|
@@ -3465,28 +3465,11 @@ var pluginsManager = {
|
|
|
3465
3465
|
!player.config.closeResizeObserver && addObserver(player.root, function() {
|
|
3466
3466
|
player.resize();
|
|
3467
3467
|
});
|
|
3468
|
-
if (Object.keys(this.pluginGroup).length === 0) {
|
|
3469
|
-
player.isUserActive = true;
|
|
3470
|
-
}
|
|
3471
3468
|
this.pluginGroup[cgid] = {
|
|
3472
|
-
_player: player,
|
|
3473
3469
|
_originalOptions: player.config || {},
|
|
3474
3470
|
_plugins: {}
|
|
3475
3471
|
};
|
|
3476
3472
|
},
|
|
3477
|
-
checkPlayerRoot: function checkPlayerRoot(root) {
|
|
3478
|
-
if (this.pluginGroup) {
|
|
3479
|
-
var _keys = Object.keys(this.pluginGroup);
|
|
3480
|
-
for (var i = 0; i < _keys.length; i++) {
|
|
3481
|
-
var _p = this.pluginGroup[_keys[i]]._player;
|
|
3482
|
-
if (_p.root === root) {
|
|
3483
|
-
return _p;
|
|
3484
|
-
}
|
|
3485
|
-
}
|
|
3486
|
-
return null;
|
|
3487
|
-
}
|
|
3488
|
-
return null;
|
|
3489
|
-
},
|
|
3490
3473
|
formatPluginInfo: function formatPluginInfo(plugin, config) {
|
|
3491
3474
|
var PLUFGIN = null;
|
|
3492
3475
|
var options = null;
|
|
@@ -3561,7 +3544,7 @@ var pluginsManager = {
|
|
|
3561
3544
|
}
|
|
3562
3545
|
var plugins = this.pluginGroup[cgid]._plugins;
|
|
3563
3546
|
var originalOptions = this.pluginGroup[cgid]._originalOptions;
|
|
3564
|
-
options.player =
|
|
3547
|
+
options.player = player;
|
|
3565
3548
|
var pluginName = options.pluginName || plugin.pluginName;
|
|
3566
3549
|
if (!pluginName) {
|
|
3567
3550
|
throw new Error("The property pluginName is necessary");
|
|
@@ -3760,37 +3743,6 @@ var pluginsManager = {
|
|
|
3760
3743
|
}
|
|
3761
3744
|
});
|
|
3762
3745
|
},
|
|
3763
|
-
setCurrentUserActive: function setCurrentUserActive(playerId, isActive) {
|
|
3764
|
-
if (!this.pluginGroup[playerId]) {
|
|
3765
|
-
return;
|
|
3766
|
-
}
|
|
3767
|
-
if (!isActive) {
|
|
3768
|
-
this.pluginGroup[playerId]._player.isUserActive = isActive;
|
|
3769
|
-
return playerId;
|
|
3770
|
-
}
|
|
3771
|
-
var keys = Object.keys(this.pluginGroup);
|
|
3772
|
-
for (var i = 0; i < keys.length; i++) {
|
|
3773
|
-
var c = this.pluginGroup[keys[i]];
|
|
3774
|
-
if (c && c._player) {
|
|
3775
|
-
this.pluginGroup[keys[i]]._player.isUserActive = false;
|
|
3776
|
-
}
|
|
3777
|
-
}
|
|
3778
|
-
this.pluginGroup[playerId]._player.isUserActive = isActive;
|
|
3779
|
-
return playerId;
|
|
3780
|
-
},
|
|
3781
|
-
getCurrentUseActiveId: function getCurrentUseActiveId() {
|
|
3782
|
-
if (!this.pluginGroup) {
|
|
3783
|
-
return;
|
|
3784
|
-
}
|
|
3785
|
-
var keys = Object.keys(this.pluginGroup);
|
|
3786
|
-
for (var i = 0; i < keys.length; i++) {
|
|
3787
|
-
var c = this.pluginGroup[keys[i]];
|
|
3788
|
-
if (c && c._player && c._player.isUserActive) {
|
|
3789
|
-
return keys[i];
|
|
3790
|
-
}
|
|
3791
|
-
}
|
|
3792
|
-
return null;
|
|
3793
|
-
},
|
|
3794
3746
|
destroy: function destroy(player) {
|
|
3795
3747
|
var cgid = player._pluginInfoId;
|
|
3796
3748
|
if (!this.pluginGroup[cgid]) {
|
|
@@ -4046,7 +3998,7 @@ var Controls = /* @__PURE__ */ function(_Plugin) {
|
|
|
4046
3998
|
}
|
|
4047
3999
|
}, {
|
|
4048
4000
|
key: "show",
|
|
4049
|
-
value: function show() {
|
|
4001
|
+
value: function show(value) {
|
|
4050
4002
|
this.root.style.display = "";
|
|
4051
4003
|
this.player.focus();
|
|
4052
4004
|
}
|
|
@@ -4339,9 +4291,158 @@ var STATES = {
|
|
|
4339
4291
|
DESTROYED: 8
|
|
4340
4292
|
};
|
|
4341
4293
|
var STATE_ARRAY = ["ERROR", "INITIAL", "READY", "ATTACHING", "ATTACHED", "NOTALLOW", "RUNNING", "ENDED", "DESTROYED"];
|
|
4294
|
+
var store = {};
|
|
4295
|
+
var instance = null;
|
|
4296
|
+
var InstManager = /* @__PURE__ */ function(_EventEmitter) {
|
|
4297
|
+
_inherits(InstManager2, _EventEmitter);
|
|
4298
|
+
var _super = _createSuper(InstManager2);
|
|
4299
|
+
function InstManager2() {
|
|
4300
|
+
_classCallCheck(this, InstManager2);
|
|
4301
|
+
return _super.apply(this, arguments);
|
|
4302
|
+
}
|
|
4303
|
+
_createClass(InstManager2, [{
|
|
4304
|
+
key: "add",
|
|
4305
|
+
value: function add(player) {
|
|
4306
|
+
if (!player) {
|
|
4307
|
+
return;
|
|
4308
|
+
}
|
|
4309
|
+
store[player.playerId] = player;
|
|
4310
|
+
if (Object.keys(store).length === 1) {
|
|
4311
|
+
this.setActive(player.playerId, true);
|
|
4312
|
+
}
|
|
4313
|
+
}
|
|
4314
|
+
}, {
|
|
4315
|
+
key: "remove",
|
|
4316
|
+
value: function remove(player) {
|
|
4317
|
+
if (!player) {
|
|
4318
|
+
return;
|
|
4319
|
+
}
|
|
4320
|
+
player.isUserActive;
|
|
4321
|
+
delete store[player.playerId];
|
|
4322
|
+
}
|
|
4323
|
+
}, {
|
|
4324
|
+
key: "_iterate",
|
|
4325
|
+
value: function _iterate(fn) {
|
|
4326
|
+
var endEarly = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
4327
|
+
for (var key in store) {
|
|
4328
|
+
if (Object.prototype.hasOwnProperty.call(store, key)) {
|
|
4329
|
+
var player = store[key];
|
|
4330
|
+
if (endEarly) {
|
|
4331
|
+
if (fn(player)) {
|
|
4332
|
+
break;
|
|
4333
|
+
}
|
|
4334
|
+
} else {
|
|
4335
|
+
fn(player);
|
|
4336
|
+
}
|
|
4337
|
+
}
|
|
4338
|
+
}
|
|
4339
|
+
}
|
|
4340
|
+
}, {
|
|
4341
|
+
key: "forEach",
|
|
4342
|
+
value: function forEach(fn) {
|
|
4343
|
+
this._iterate(fn);
|
|
4344
|
+
}
|
|
4345
|
+
}, {
|
|
4346
|
+
key: "find",
|
|
4347
|
+
value: function find(fn) {
|
|
4348
|
+
var result = null;
|
|
4349
|
+
this._iterate(function(player) {
|
|
4350
|
+
var flag = fn(player);
|
|
4351
|
+
if (flag) {
|
|
4352
|
+
result = player;
|
|
4353
|
+
}
|
|
4354
|
+
return flag;
|
|
4355
|
+
}, true);
|
|
4356
|
+
return result;
|
|
4357
|
+
}
|
|
4358
|
+
}, {
|
|
4359
|
+
key: "findAll",
|
|
4360
|
+
value: function findAll(fn) {
|
|
4361
|
+
var results = [];
|
|
4362
|
+
this._iterate(function(player) {
|
|
4363
|
+
if (fn(player)) {
|
|
4364
|
+
results.push(player);
|
|
4365
|
+
}
|
|
4366
|
+
});
|
|
4367
|
+
return results;
|
|
4368
|
+
}
|
|
4369
|
+
}, {
|
|
4370
|
+
key: "setActive",
|
|
4371
|
+
value: function setActive(playerId) {
|
|
4372
|
+
var isActive = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
4373
|
+
if (!store[playerId]) {
|
|
4374
|
+
return;
|
|
4375
|
+
}
|
|
4376
|
+
if (isActive) {
|
|
4377
|
+
this.forEach(function(inst) {
|
|
4378
|
+
if (playerId === inst.playerId) {
|
|
4379
|
+
inst.isUserActive = true;
|
|
4380
|
+
inst.isInstNext = false;
|
|
4381
|
+
} else {
|
|
4382
|
+
inst.isUserActive = false;
|
|
4383
|
+
}
|
|
4384
|
+
});
|
|
4385
|
+
} else {
|
|
4386
|
+
store[playerId].isUserActive = isActive;
|
|
4387
|
+
}
|
|
4388
|
+
return playerId;
|
|
4389
|
+
}
|
|
4390
|
+
}, {
|
|
4391
|
+
key: "getActiveId",
|
|
4392
|
+
value: function getActiveId() {
|
|
4393
|
+
var keys = Object.keys(store);
|
|
4394
|
+
for (var i = 0; i < keys.length; i++) {
|
|
4395
|
+
var c = store[keys[i]];
|
|
4396
|
+
if (c && c.isUserActive) {
|
|
4397
|
+
return keys[i];
|
|
4398
|
+
}
|
|
4399
|
+
}
|
|
4400
|
+
return null;
|
|
4401
|
+
}
|
|
4402
|
+
}, {
|
|
4403
|
+
key: "setNext",
|
|
4404
|
+
value: function setNext(playerId) {
|
|
4405
|
+
var isNext = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
4406
|
+
if (!store[playerId]) {
|
|
4407
|
+
return;
|
|
4408
|
+
}
|
|
4409
|
+
if (isNext) {
|
|
4410
|
+
this.forEach(function(inst) {
|
|
4411
|
+
if (playerId === inst.playerId) {
|
|
4412
|
+
inst.isUserActive = false;
|
|
4413
|
+
inst.isInstNext = true;
|
|
4414
|
+
} else {
|
|
4415
|
+
inst.isInstNext = false;
|
|
4416
|
+
}
|
|
4417
|
+
});
|
|
4418
|
+
} else {
|
|
4419
|
+
store[playerId].isInstNext = isNext;
|
|
4420
|
+
}
|
|
4421
|
+
return playerId;
|
|
4422
|
+
}
|
|
4423
|
+
}], [{
|
|
4424
|
+
key: "getInstance",
|
|
4425
|
+
value: function getInstance() {
|
|
4426
|
+
instance || (instance = new InstManager2());
|
|
4427
|
+
return instance;
|
|
4428
|
+
}
|
|
4429
|
+
}]);
|
|
4430
|
+
return InstManager2;
|
|
4431
|
+
}(eventemitter3Exports.EventEmitter);
|
|
4432
|
+
function checkPlayerRoot(root) {
|
|
4433
|
+
var keys = Object.keys(store);
|
|
4434
|
+
for (var i = 0; i < keys.length; i++) {
|
|
4435
|
+
var p = store[keys[i]];
|
|
4436
|
+
if (p.root === root) {
|
|
4437
|
+
return p;
|
|
4438
|
+
}
|
|
4439
|
+
}
|
|
4440
|
+
return null;
|
|
4441
|
+
}
|
|
4342
4442
|
var PlAYER_HOOKS = ["play", "pause", "replay", "retry"];
|
|
4343
4443
|
var REAL_TIME_SPEED = 0;
|
|
4344
4444
|
var AVG_SPEED = 0;
|
|
4445
|
+
var instManager = null;
|
|
4345
4446
|
var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
4346
4447
|
_inherits(Player2, _MediaProxy);
|
|
4347
4448
|
var _super = _createSuper(Player2);
|
|
@@ -4354,11 +4455,11 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4354
4455
|
if (!_this.config) {
|
|
4355
4456
|
return;
|
|
4356
4457
|
}
|
|
4357
|
-
var _this$config = _this.config, autoplay2 = _this$config.autoplay,
|
|
4358
|
-
XG_DEBUG.logInfo("player", "canPlayFunc, startTime",
|
|
4359
|
-
if (
|
|
4360
|
-
_this.currentTime =
|
|
4361
|
-
_this.
|
|
4458
|
+
var _this$config = _this.config, autoplay2 = _this$config.autoplay, defaultPlaybackRate = _this$config.defaultPlaybackRate;
|
|
4459
|
+
XG_DEBUG.logInfo("player", "canPlayFunc, startTime", _this.__startTime);
|
|
4460
|
+
if (_this.__startTime > 0 && _this.duration > 0) {
|
|
4461
|
+
_this.currentTime = _this.__startTime > _this.duration ? _this.duration : _this.__startTime;
|
|
4462
|
+
_this.__startTime = -1;
|
|
4362
4463
|
}
|
|
4363
4464
|
_this.playbackRate = defaultPlaybackRate;
|
|
4364
4465
|
(autoplay2 || _this._useAutoplay) && _this.mediaPlay();
|
|
@@ -4449,6 +4550,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4449
4550
|
_this.isSeeking = false;
|
|
4450
4551
|
_this.isCanplay = false;
|
|
4451
4552
|
_this._useAutoplay = false;
|
|
4553
|
+
_this.__startTime = -1;
|
|
4452
4554
|
_this.rotateDeg = 0;
|
|
4453
4555
|
_this.isActive = false;
|
|
4454
4556
|
_this.fullscreen = false;
|
|
@@ -4503,6 +4605,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4503
4605
|
_this.innerStates = {
|
|
4504
4606
|
isActiveLocked: false
|
|
4505
4607
|
};
|
|
4608
|
+
_this.instManager = instManager;
|
|
4506
4609
|
var rootInit = _this._initDOM();
|
|
4507
4610
|
if (!rootInit) {
|
|
4508
4611
|
console.error(new Error("can't find the dom which id is ".concat(_this.config.id, " or this.config.el does not exist")));
|
|
@@ -4540,7 +4643,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4540
4643
|
_createClass(Player2, [{
|
|
4541
4644
|
key: "_initDOM",
|
|
4542
4645
|
value: function _initDOM() {
|
|
4543
|
-
var _this2 = this;
|
|
4646
|
+
var _instManager, _this2 = this;
|
|
4544
4647
|
this.root = this.config.id ? document.getElementById(this.config.id) : null;
|
|
4545
4648
|
if (!this.root) {
|
|
4546
4649
|
var el = this.config.el;
|
|
@@ -4556,12 +4659,13 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4556
4659
|
return false;
|
|
4557
4660
|
}
|
|
4558
4661
|
}
|
|
4559
|
-
var ret =
|
|
4662
|
+
var ret = checkPlayerRoot(this.root);
|
|
4560
4663
|
if (ret) {
|
|
4561
4664
|
XG_DEBUG.logWarn("The is an Player instance already exists in this.root, destroy it and reinitialize");
|
|
4562
4665
|
ret.destroy();
|
|
4563
4666
|
}
|
|
4564
4667
|
this.root.setAttribute(PLATER_ID, this.playerId);
|
|
4668
|
+
(_instManager = instManager) === null || _instManager === void 0 ? void 0 : _instManager.add(this);
|
|
4565
4669
|
pluginsManager.init(this);
|
|
4566
4670
|
this._initBaseDoms();
|
|
4567
4671
|
var XgVideoProxy = this.constructor.XgVideoProxy;
|
|
@@ -4704,10 +4808,13 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4704
4808
|
!util.isMSE(this.media) && this.load();
|
|
4705
4809
|
(sniffer.os.isIpad || sniffer.os.isPhone) && this.mediaPlay();
|
|
4706
4810
|
}
|
|
4707
|
-
|
|
4811
|
+
var startTime = this.config.startTime;
|
|
4812
|
+
this.__startTime = startTime > 0 ? startTime : -1;
|
|
4813
|
+
this.config.startTime = 0;
|
|
4814
|
+
if (readyState >= 2 && this.duration > 0) {
|
|
4708
4815
|
this.canPlayFunc();
|
|
4709
4816
|
} else {
|
|
4710
|
-
this.
|
|
4817
|
+
this.on(CANPLAY, this.canPlayFunc);
|
|
4711
4818
|
}
|
|
4712
4819
|
if (!this.hasStart || this.state < STATES.ATTACHED) {
|
|
4713
4820
|
pluginsManager.afterInit(this);
|
|
@@ -4949,6 +5056,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4949
5056
|
}
|
|
4950
5057
|
_src = this.preProcessUrl(_src).url;
|
|
4951
5058
|
var curTime = this.currentTime;
|
|
5059
|
+
this.__startTime = curTime;
|
|
4952
5060
|
var isPaused = this.paused && !this.isError;
|
|
4953
5061
|
this.src = _src;
|
|
4954
5062
|
return new Promise(function(resolve, reject) {
|
|
@@ -4958,7 +5066,10 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4958
5066
|
reject(e);
|
|
4959
5067
|
};
|
|
4960
5068
|
var _canplay = function _canplay2() {
|
|
4961
|
-
_this9.
|
|
5069
|
+
if (_this9.duration > 0 && _this9.__startTime > 0) {
|
|
5070
|
+
_this9.currentTime = _this9.__startTime;
|
|
5071
|
+
_this9.__startTime = -1;
|
|
5072
|
+
}
|
|
4962
5073
|
if (isPaused) {
|
|
4963
5074
|
_this9.pause();
|
|
4964
5075
|
}
|
|
@@ -5185,7 +5296,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5185
5296
|
clsList.forEach(function(cls) {
|
|
5186
5297
|
_this16.removeClass(cls);
|
|
5187
5298
|
});
|
|
5188
|
-
this.addClass(STATE_CLASS.
|
|
5299
|
+
this.addClass(STATE_CLASS.NO_START);
|
|
5189
5300
|
this.emit(RESET);
|
|
5190
5301
|
}
|
|
5191
5302
|
}, {
|
|
@@ -5214,7 +5325,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5214
5325
|
}, {
|
|
5215
5326
|
key: "destroy",
|
|
5216
5327
|
value: function destroy2() {
|
|
5217
|
-
var _this18 = this;
|
|
5328
|
+
var _instManager2, _this18 = this;
|
|
5218
5329
|
var innerContainer = this.innerContainer, root = this.root, media = this.media;
|
|
5219
5330
|
if (!root || !media) {
|
|
5220
5331
|
return;
|
|
@@ -5227,6 +5338,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5227
5338
|
this._detachSourceEvents(this.media);
|
|
5228
5339
|
util.clearAllTimers(this);
|
|
5229
5340
|
this.emit(DESTROY);
|
|
5341
|
+
(_instManager2 = instManager) === null || _instManager2 === void 0 ? void 0 : _instManager2.remove(this);
|
|
5230
5342
|
pluginsManager.destroy(this);
|
|
5231
5343
|
delHooksDescriptor(this);
|
|
5232
5344
|
_get(_getPrototypeOf(Player2.prototype), "destroy", this).call(this);
|
|
@@ -5578,6 +5690,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5578
5690
|
this.isCanplay = true;
|
|
5579
5691
|
this.waitTimer && util.clearTimeout(this, this.waitTimer);
|
|
5580
5692
|
}
|
|
5693
|
+
}, {
|
|
5694
|
+
key: "onDurationchange",
|
|
5695
|
+
value: function onDurationchange() {
|
|
5696
|
+
if (this.__startTime > 0 && this.duration > 0) {
|
|
5697
|
+
this.currentTime = this.__startTime;
|
|
5698
|
+
this.__startTime = -1;
|
|
5699
|
+
}
|
|
5700
|
+
}
|
|
5581
5701
|
}, {
|
|
5582
5702
|
key: "onLoadeddata",
|
|
5583
5703
|
value: function onLoadeddata() {
|
|
@@ -5755,8 +5875,9 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5755
5875
|
}, {
|
|
5756
5876
|
key: "resizePosition",
|
|
5757
5877
|
value: function resizePosition() {
|
|
5758
|
-
var _this$videoPos = this.videoPos,
|
|
5759
|
-
|
|
5878
|
+
var _this$videoPos = this.videoPos, vy = _this$videoPos.vy, vx = _this$videoPos.vx, h = _this$videoPos.h, w = _this$videoPos.w;
|
|
5879
|
+
var rotate = this.videoPos.rotate;
|
|
5880
|
+
if (rotate < 0 && h < 0 && w < 0) {
|
|
5760
5881
|
return;
|
|
5761
5882
|
}
|
|
5762
5883
|
var _pi = this.videoPos._pi;
|
|
@@ -5767,6 +5888,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5767
5888
|
return;
|
|
5768
5889
|
}
|
|
5769
5890
|
this.videoPos.pi = _pi;
|
|
5891
|
+
rotate = rotate < 0 ? 0 : rotate;
|
|
5770
5892
|
var _pos = {
|
|
5771
5893
|
rotate
|
|
5772
5894
|
};
|
|
@@ -6199,7 +6321,8 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
6199
6321
|
}
|
|
6200
6322
|
}, {
|
|
6201
6323
|
key: "setUserActive",
|
|
6202
|
-
value: function setUserActive(isActive
|
|
6324
|
+
value: function setUserActive(isActive) {
|
|
6325
|
+
var isMuted = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
6203
6326
|
if (typeof isMuted === "boolean" && isMuted !== this.muted) {
|
|
6204
6327
|
this.addInnerOP("volumechange");
|
|
6205
6328
|
this.muted = isMuted;
|
|
@@ -6214,15 +6337,25 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
6214
6337
|
set: function set(value) {
|
|
6215
6338
|
XG_DEBUG.config.debug = value;
|
|
6216
6339
|
}
|
|
6340
|
+
}, {
|
|
6341
|
+
key: "instManager",
|
|
6342
|
+
get: function get() {
|
|
6343
|
+
return instManager;
|
|
6344
|
+
},
|
|
6345
|
+
set: function set(value) {
|
|
6346
|
+
instManager = value;
|
|
6347
|
+
}
|
|
6217
6348
|
}, {
|
|
6218
6349
|
key: "getCurrentUserActivePlayerId",
|
|
6219
6350
|
value: function getCurrentUserActivePlayerId() {
|
|
6220
|
-
|
|
6351
|
+
var _instManager3;
|
|
6352
|
+
return (_instManager3 = instManager) === null || _instManager3 === void 0 ? void 0 : _instManager3.getActiveId();
|
|
6221
6353
|
}
|
|
6222
6354
|
}, {
|
|
6223
6355
|
key: "setCurrentUserActive",
|
|
6224
|
-
value: function
|
|
6225
|
-
|
|
6356
|
+
value: function setCurrentUserActive(playerId, isActive) {
|
|
6357
|
+
var _instManager4;
|
|
6358
|
+
(_instManager4 = instManager) === null || _instManager4 === void 0 ? void 0 : _instManager4.setActive(playerId, isActive);
|
|
6226
6359
|
}
|
|
6227
6360
|
}, {
|
|
6228
6361
|
key: "isHevcSupported",
|
|
@@ -6257,6 +6390,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
6257
6390
|
}(MediaProxy);
|
|
6258
6391
|
_defineProperty(Player, "defaultPreset", null);
|
|
6259
6392
|
_defineProperty(Player, "XgVideoProxy", null);
|
|
6393
|
+
Player.instManager = InstManager.getInstance();
|
|
6260
6394
|
var index_min = "";
|
|
6261
6395
|
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
6262
6396
|
ErrorCode2[ErrorCode2["MANIFEST_HLS_ERROR"] = 1100] = "MANIFEST_HLS_ERROR";
|
|
@@ -6383,6 +6517,14 @@ const ERROR_INFO = {
|
|
|
6383
6517
|
messageTextKey: "MODULE_LOAD_ERROR",
|
|
6384
6518
|
level: "Fatal"
|
|
6385
6519
|
/* Fatal */
|
|
6520
|
+
},
|
|
6521
|
+
[
|
|
6522
|
+
7100
|
|
6523
|
+
/* DRM_LICENSE */
|
|
6524
|
+
]: {
|
|
6525
|
+
messageTextKey: "DRM_LICENSE",
|
|
6526
|
+
level: "Fatal"
|
|
6527
|
+
/* Fatal */
|
|
6386
6528
|
}
|
|
6387
6529
|
};
|
|
6388
6530
|
const ERROR_TYPE_INFO = {
|
|
@@ -6452,7 +6594,12 @@ const ERROR_TYPE_INFO = {
|
|
|
6452
6594
|
}
|
|
6453
6595
|
};
|
|
6454
6596
|
class VeError extends Error {
|
|
6455
|
-
/**
|
|
6597
|
+
/** {zh}
|
|
6598
|
+
* @hidden
|
|
6599
|
+
* @param error
|
|
6600
|
+
* @param i18n
|
|
6601
|
+
*/
|
|
6602
|
+
/** {en}
|
|
6456
6603
|
* @hidden
|
|
6457
6604
|
* @param error
|
|
6458
6605
|
* @param i18n
|
|
@@ -6465,16 +6612,25 @@ class VeError extends Error {
|
|
|
6465
6612
|
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"));
|
|
6466
6613
|
super(message);
|
|
6467
6614
|
/**
|
|
6468
|
-
* @brief
|
|
6615
|
+
* @brief 错误码。
|
|
6616
|
+
*/
|
|
6617
|
+
/** {en}
|
|
6618
|
+
* @brief The error code.
|
|
6469
6619
|
*/
|
|
6470
6620
|
__publicField(this, "errorCode");
|
|
6471
|
-
/**
|
|
6621
|
+
/** {zh}
|
|
6472
6622
|
* @brief 错误等级。
|
|
6473
6623
|
*/
|
|
6624
|
+
/** {en}
|
|
6625
|
+
* @brief The error level.
|
|
6626
|
+
*/
|
|
6474
6627
|
__publicField(this, "level");
|
|
6475
|
-
/**
|
|
6628
|
+
/** {zh}
|
|
6476
6629
|
* @brief 其他错误信息。
|
|
6477
6630
|
*/
|
|
6631
|
+
/** {en}
|
|
6632
|
+
* @brief Other error messages.
|
|
6633
|
+
*/
|
|
6478
6634
|
__publicField(this, "ext");
|
|
6479
6635
|
this.errorCode = (errorInfo == null ? void 0 : errorInfo.errorCode) ?? "UNKNOWN";
|
|
6480
6636
|
this.level = (errorInfo == null ? void 0 : errorInfo.level) ?? "Error";
|
|
@@ -6527,7 +6683,7 @@ var Poster = /* @__PURE__ */ function(_Plugin) {
|
|
|
6527
6683
|
}
|
|
6528
6684
|
}, {
|
|
6529
6685
|
key: "show",
|
|
6530
|
-
value: function show() {
|
|
6686
|
+
value: function show(value) {
|
|
6531
6687
|
util.removeClass(this.root, "hide");
|
|
6532
6688
|
}
|
|
6533
6689
|
}, {
|
|
@@ -6606,10 +6762,11 @@ var Poster = /* @__PURE__ */ function(_Plugin) {
|
|
|
6606
6762
|
}, {
|
|
6607
6763
|
key: "render",
|
|
6608
6764
|
value: function render() {
|
|
6609
|
-
var _this$config = this.config, poster = _this$config.poster, hideCanplay = _this$config.hideCanplay, fillMode = _this$config.fillMode;
|
|
6765
|
+
var _this$config = this.config, poster = _this$config.poster, hideCanplay = _this$config.hideCanplay, fillMode = _this$config.fillMode, notHidden = _this$config.notHidden;
|
|
6610
6766
|
var _bg = this.getBgSize(fillMode);
|
|
6611
6767
|
var style = poster ? "background-image:url(".concat(poster, ");").concat(_bg) : _bg;
|
|
6612
|
-
|
|
6768
|
+
var className = notHidden ? "xg-not-hidden" : hideCanplay ? "xg-showplay" : "";
|
|
6769
|
+
return '<xg-poster class="xgplayer-poster '.concat(className, '" style="').concat(style, '">\n </xg-poster>');
|
|
6613
6770
|
}
|
|
6614
6771
|
}], [{
|
|
6615
6772
|
key: "pluginName",
|
|
@@ -6622,6 +6779,7 @@ var Poster = /* @__PURE__ */ function(_Plugin) {
|
|
|
6622
6779
|
return {
|
|
6623
6780
|
isEndedShow: true,
|
|
6624
6781
|
hideCanplay: false,
|
|
6782
|
+
notHidden: false,
|
|
6625
6783
|
poster: "",
|
|
6626
6784
|
fillMode: "fixWidth"
|
|
6627
6785
|
};
|
|
@@ -6765,7 +6923,7 @@ var Start = /* @__PURE__ */ function(_Plugin) {
|
|
|
6765
6923
|
}
|
|
6766
6924
|
}, {
|
|
6767
6925
|
key: "show",
|
|
6768
|
-
value: function show() {
|
|
6926
|
+
value: function show(value) {
|
|
6769
6927
|
util.removeClass(this.root, "hide");
|
|
6770
6928
|
}
|
|
6771
6929
|
}, {
|
|
@@ -7727,14 +7885,14 @@ var PCPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
7727
7885
|
key: "initEvents",
|
|
7728
7886
|
value: function initEvents() {
|
|
7729
7887
|
var _this3 = this;
|
|
7730
|
-
var _this$player = this.player,
|
|
7888
|
+
var _this$player = this.player, media = _this$player.media, root = _this$player.root;
|
|
7731
7889
|
var enableContextmenu = this.playerConfig.enableContextmenu;
|
|
7732
7890
|
root && root.addEventListener("click", this.onVideoClick, false);
|
|
7733
7891
|
root && root.addEventListener("dblclick", this.onVideoDblClick, false);
|
|
7734
7892
|
Object.keys(MOUSE_EVENTS).map(function(item) {
|
|
7735
7893
|
root.addEventListener(item, _this3[MOUSE_EVENTS[item]], false);
|
|
7736
7894
|
});
|
|
7737
|
-
enableContextmenu &&
|
|
7895
|
+
!enableContextmenu && media && media.addEventListener("contextmenu", this.onContextmenu, false);
|
|
7738
7896
|
}
|
|
7739
7897
|
}, {
|
|
7740
7898
|
key: "switchPlayPause",
|
|
@@ -9458,16 +9616,6 @@ var Fullscreen = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
9458
9616
|
}
|
|
9459
9617
|
}
|
|
9460
9618
|
}
|
|
9461
|
-
}, {
|
|
9462
|
-
key: "show",
|
|
9463
|
-
value: function show() {
|
|
9464
|
-
_get(_getPrototypeOf(Fullscreen2.prototype), "show", this).call(this);
|
|
9465
|
-
}
|
|
9466
|
-
}, {
|
|
9467
|
-
key: "hide",
|
|
9468
|
-
value: function hide() {
|
|
9469
|
-
_get(_getPrototypeOf(Fullscreen2.prototype), "hide", this).call(this);
|
|
9470
|
-
}
|
|
9471
9619
|
}, {
|
|
9472
9620
|
key: "render",
|
|
9473
9621
|
value: function render() {
|
|
@@ -9923,11 +10071,14 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
9923
10071
|
}, 0);
|
|
9924
10072
|
!paused && player.mediaPlay();
|
|
9925
10073
|
_this3.setAttr("data-state", "normal");
|
|
10074
|
+
_this3.pipWindow = null;
|
|
9926
10075
|
player.emit(PIP_CHANGE, false);
|
|
9927
10076
|
};
|
|
9928
10077
|
this.enterPIPCallback = function(e) {
|
|
9929
10078
|
player.emit(PIP_CHANGE, true);
|
|
9930
|
-
|
|
10079
|
+
if (e !== null && e !== void 0 && e.pictureInPictureWindow) {
|
|
10080
|
+
_this3.pipWindow = e.pictureInPictureWindow;
|
|
10081
|
+
}
|
|
9931
10082
|
_this3.setAttr("data-state", "pip");
|
|
9932
10083
|
};
|
|
9933
10084
|
this.onWebkitpresentationmodechanged = function(e) {
|
|
@@ -9948,10 +10099,33 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
9948
10099
|
PIP2.checkWebkitSetPresentationMode(player.media) && player.media.addEventListener("webkitpresentationmodechanged", this.onWebkitpresentationmodechanged);
|
|
9949
10100
|
}
|
|
9950
10101
|
}
|
|
10102
|
+
}, {
|
|
10103
|
+
key: "copyStyleIntoPiPWindow",
|
|
10104
|
+
value: function copyStyleIntoPiPWindow(pipWin) {
|
|
10105
|
+
var textContent = _toConsumableArray(document.styleSheets).map(function(style2) {
|
|
10106
|
+
try {
|
|
10107
|
+
return _toConsumableArray(style2.cssRules).map(function(rule) {
|
|
10108
|
+
return rule.cssText;
|
|
10109
|
+
}).join("");
|
|
10110
|
+
} catch (e) {
|
|
10111
|
+
var link = document.createElement("link");
|
|
10112
|
+
link.rel = "stylesheet";
|
|
10113
|
+
link.type = style2.type;
|
|
10114
|
+
link.media = style2.media;
|
|
10115
|
+
link.href = style2.href;
|
|
10116
|
+
pipWin.document.head.appendChild(link);
|
|
10117
|
+
}
|
|
10118
|
+
return "";
|
|
10119
|
+
}).filter(Boolean).join("\n");
|
|
10120
|
+
var style = document.createElement("style");
|
|
10121
|
+
style.textContent = textContent;
|
|
10122
|
+
pipWin.document.head.appendChild(style);
|
|
10123
|
+
}
|
|
9951
10124
|
}, {
|
|
9952
10125
|
key: "requestPIP",
|
|
9953
10126
|
value: function requestPIP() {
|
|
9954
|
-
var
|
|
10127
|
+
var _this4 = this;
|
|
10128
|
+
var player = this.player, playerConfig = this.playerConfig, config = this.config;
|
|
9955
10129
|
if (!this.isPIPAvailable() || this.isPip) {
|
|
9956
10130
|
return;
|
|
9957
10131
|
}
|
|
@@ -9960,7 +10134,62 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
9960
10134
|
if (poster) {
|
|
9961
10135
|
player.media.poster = util.typeOf(poster) === "String" ? poster : poster.poster;
|
|
9962
10136
|
}
|
|
9963
|
-
|
|
10137
|
+
if (config.preferDocument && this.isDocPIPAvailable()) {
|
|
10138
|
+
var pipOptions = {};
|
|
10139
|
+
if (config.width && config.height) {
|
|
10140
|
+
pipOptions.width = config.width;
|
|
10141
|
+
pipOptions.height = config.height;
|
|
10142
|
+
} else {
|
|
10143
|
+
var playerRect = player.root.getBoundingClientRect();
|
|
10144
|
+
pipOptions.width = playerRect.width;
|
|
10145
|
+
pipOptions.height = playerRect.height;
|
|
10146
|
+
}
|
|
10147
|
+
documentPictureInPicture.requestWindow(pipOptions).then(function(pipWin) {
|
|
10148
|
+
var docPiPNode = config.docPiPNode, docPiPStyle = config.docPiPStyle;
|
|
10149
|
+
_this4.enterPIPCallback();
|
|
10150
|
+
var pipRoot = docPiPNode || player.root;
|
|
10151
|
+
var parentNode = pipRoot.parentElement;
|
|
10152
|
+
var previousSibling = pipRoot.previousSibling;
|
|
10153
|
+
var nextSibling = pipRoot.nextSibling;
|
|
10154
|
+
_this4.copyStyleIntoPiPWindow(pipWin);
|
|
10155
|
+
var styles = document.createElement("style");
|
|
10156
|
+
styles.append("body{padding:0; margin:0;}");
|
|
10157
|
+
if (docPiPStyle) {
|
|
10158
|
+
var cssContent = "";
|
|
10159
|
+
if (typeof docPiPStyle === "string") {
|
|
10160
|
+
cssContent = docPiPStyle;
|
|
10161
|
+
} else if (typeof docPiPStyle === "function") {
|
|
10162
|
+
cssContent = docPiPStyle.call(config);
|
|
10163
|
+
}
|
|
10164
|
+
if (cssContent) {
|
|
10165
|
+
styles.append(cssContent);
|
|
10166
|
+
}
|
|
10167
|
+
} else if (pipRoot === player.root) {
|
|
10168
|
+
styles.append("\n .xgplayer{width: 100%!important; height: 100%!important;}\n ");
|
|
10169
|
+
}
|
|
10170
|
+
pipWin.document.head.append(styles);
|
|
10171
|
+
pipWin.document.body.append(pipRoot);
|
|
10172
|
+
pipWin.addEventListener("pagehide", function(event) {
|
|
10173
|
+
if (parentNode) {
|
|
10174
|
+
if (nextSibling) {
|
|
10175
|
+
parentNode.insertBefore(pipRoot, nextSibling);
|
|
10176
|
+
} else if (previousSibling) {
|
|
10177
|
+
parentNode.insertBefore(pipRoot, previousSibling.nextSibling);
|
|
10178
|
+
} else {
|
|
10179
|
+
parentNode.appendChild(pipRoot);
|
|
10180
|
+
}
|
|
10181
|
+
} else {
|
|
10182
|
+
}
|
|
10183
|
+
_this4.leavePIPCallback();
|
|
10184
|
+
}, {
|
|
10185
|
+
once: true
|
|
10186
|
+
});
|
|
10187
|
+
});
|
|
10188
|
+
} else if (PIP2.checkWebkitSetPresentationMode(player.media)) {
|
|
10189
|
+
player.media.webkitSetPresentationMode("picture-in-picture");
|
|
10190
|
+
} else {
|
|
10191
|
+
player.media.requestPictureInPicture();
|
|
10192
|
+
}
|
|
9964
10193
|
return true;
|
|
9965
10194
|
} catch (reason) {
|
|
9966
10195
|
console.error("requestPiP", reason);
|
|
@@ -9973,7 +10202,14 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
9973
10202
|
var player = this.player;
|
|
9974
10203
|
try {
|
|
9975
10204
|
if (this.isPIPAvailable() && this.isPip) {
|
|
9976
|
-
|
|
10205
|
+
var _documentPictureInPic;
|
|
10206
|
+
if (this.isDocPIPAvailable() && (_documentPictureInPic = documentPictureInPicture) !== null && _documentPictureInPic !== void 0 && _documentPictureInPic.window) {
|
|
10207
|
+
documentPictureInPicture.window.close();
|
|
10208
|
+
} else if (PIP2.checkWebkitSetPresentationMode(player.media)) {
|
|
10209
|
+
player.media.webkitSetPresentationMode("inline");
|
|
10210
|
+
} else {
|
|
10211
|
+
document.exitPictureInPicture();
|
|
10212
|
+
}
|
|
9977
10213
|
}
|
|
9978
10214
|
return true;
|
|
9979
10215
|
} catch (reason) {
|
|
@@ -9984,15 +10220,21 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
9984
10220
|
}, {
|
|
9985
10221
|
key: "isPip",
|
|
9986
10222
|
get: function get() {
|
|
10223
|
+
var _documentPictureInPic2;
|
|
9987
10224
|
var player = this.player;
|
|
9988
|
-
return document.pictureInPictureElement && document.pictureInPictureElement === player.media || player.media.webkitPresentationMode === PresentationMode.PIP;
|
|
10225
|
+
return !!(this.isDocPIPAvailable() && (_documentPictureInPic2 = documentPictureInPicture) !== null && _documentPictureInPic2 !== void 0 && _documentPictureInPic2.window) || document.pictureInPictureElement && document.pictureInPictureElement === player.media || player.media.webkitPresentationMode === PresentationMode.PIP;
|
|
9989
10226
|
}
|
|
9990
10227
|
}, {
|
|
9991
10228
|
key: "isPIPAvailable",
|
|
9992
10229
|
value: function isPIPAvailable() {
|
|
9993
10230
|
var video = this.player.media;
|
|
9994
10231
|
var _isEnabled = util.typeOf(document.pictureInPictureEnabled) === "Boolean" ? document.pictureInPictureEnabled : true;
|
|
9995
|
-
return _isEnabled && (util.typeOf(video.disablePictureInPicture) === "Boolean" && !video.disablePictureInPicture || video.webkitSupportsPresentationMode && util.typeOf(video.webkitSetPresentationMode) === "Function");
|
|
10232
|
+
return _isEnabled && (util.typeOf(video.disablePictureInPicture) === "Boolean" && !video.disablePictureInPicture || video.webkitSupportsPresentationMode && util.typeOf(video.webkitSetPresentationMode) === "Function") || this.isDocPIPAvailable();
|
|
10233
|
+
}
|
|
10234
|
+
}, {
|
|
10235
|
+
key: "isDocPIPAvailable",
|
|
10236
|
+
value: function isDocPIPAvailable() {
|
|
10237
|
+
return "documentPictureInPicture" in window && /^(https|file)/.test(location.protocol);
|
|
9996
10238
|
}
|
|
9997
10239
|
}, {
|
|
9998
10240
|
key: "destroy",
|
|
@@ -10024,7 +10266,12 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
10024
10266
|
return {
|
|
10025
10267
|
position: POSITIONS$1.CONTROLS_RIGHT,
|
|
10026
10268
|
index: 6,
|
|
10027
|
-
showIcon: false
|
|
10269
|
+
showIcon: false,
|
|
10270
|
+
preferDocument: false,
|
|
10271
|
+
width: void 0,
|
|
10272
|
+
height: void 0,
|
|
10273
|
+
docPiPNode: void 0,
|
|
10274
|
+
docPiPStyle: void 0
|
|
10028
10275
|
};
|
|
10029
10276
|
}
|
|
10030
10277
|
}, {
|
|
@@ -12016,7 +12263,7 @@ class DefinitionPlugin extends OptionsIcon {
|
|
|
12016
12263
|
}
|
|
12017
12264
|
this._waitingStartTime = Date.now();
|
|
12018
12265
|
const currentTime = this.player.currentTime;
|
|
12019
|
-
this._timer = setTimeout(() => {
|
|
12266
|
+
this._timer = window.setTimeout(() => {
|
|
12020
12267
|
if (this.player && this.player.currentTime <= currentTime + 0.1) {
|
|
12021
12268
|
this.player.emit(Events.LONG_WAITING);
|
|
12022
12269
|
if (this.config.needFallback) {
|
|
@@ -12121,7 +12368,8 @@ const NAME_MAP = {
|
|
|
12121
12368
|
"plugin:hls": "veplayer.plugin.hls.[env].[ext]",
|
|
12122
12369
|
"plugin:shaka": "veplayer.plugin.shaka.[env].[ext]",
|
|
12123
12370
|
"plugin:rtm": "veplayer.plugin.rtm.[env].[ext]",
|
|
12124
|
-
"plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]"
|
|
12371
|
+
"plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]",
|
|
12372
|
+
"plugin:drm": "veplayer.plugin.drm.[env].[ext]"
|
|
12125
12373
|
};
|
|
12126
12374
|
var DynamicModule = /* @__PURE__ */ ((DynamicModule2) => {
|
|
12127
12375
|
DynamicModule2["BizVod"] = "biz:vod";
|
|
@@ -12132,6 +12380,7 @@ var DynamicModule = /* @__PURE__ */ ((DynamicModule2) => {
|
|
|
12132
12380
|
DynamicModule2["PluginShaka"] = "plugin:shaka";
|
|
12133
12381
|
DynamicModule2["PluginRtm"] = "plugin:rtm";
|
|
12134
12382
|
DynamicModule2["PluginXgvideo"] = "plugin:xgvideo";
|
|
12383
|
+
DynamicModule2["PluginDrm"] = "plugin:drm";
|
|
12135
12384
|
return DynamicModule2;
|
|
12136
12385
|
})(DynamicModule || {});
|
|
12137
12386
|
class Loader {
|
|
@@ -12175,13 +12424,13 @@ class Loader {
|
|
|
12175
12424
|
src: src2 ?? moduleSrc,
|
|
12176
12425
|
name,
|
|
12177
12426
|
state: 0,
|
|
12178
|
-
exports: {}
|
|
12427
|
+
exports: { __PLUGIN_NAME__: name }
|
|
12179
12428
|
};
|
|
12180
12429
|
this.modules[name] = module;
|
|
12181
12430
|
this.mountPromiseMap[name] = this._mount(module);
|
|
12182
12431
|
return this.mountPromiseMap[name];
|
|
12183
12432
|
});
|
|
12184
|
-
__publicField(this, "
|
|
12433
|
+
__publicField(this, "registerPlugin", (name, exports) => {
|
|
12185
12434
|
if (!this._moduleSystem) {
|
|
12186
12435
|
throw new Error(
|
|
12187
12436
|
`You have to specify moduleSystem first, call setModuleSystem(moduleSystem) to set module system`
|
|
@@ -12208,6 +12457,11 @@ class Loader {
|
|
|
12208
12457
|
}
|
|
12209
12458
|
return this.modules[name].exports;
|
|
12210
12459
|
});
|
|
12460
|
+
__publicField(this, "register", (exports) => {
|
|
12461
|
+
return exports.map((exportModule) => {
|
|
12462
|
+
return this.registerPlugin(exportModule.__PLUGIN_NAME__, exportModule);
|
|
12463
|
+
});
|
|
12464
|
+
});
|
|
12211
12465
|
this._baseUrl = options.baseUrl;
|
|
12212
12466
|
}
|
|
12213
12467
|
get baseUrl() {
|
|
@@ -12247,6 +12501,7 @@ const baseUrl = src.slice(0, src.lastIndexOf("/"));
|
|
|
12247
12501
|
const loader = new Loader({
|
|
12248
12502
|
baseUrl
|
|
12249
12503
|
});
|
|
12504
|
+
loader.registerPlugin;
|
|
12250
12505
|
const register2 = loader.register;
|
|
12251
12506
|
function setModuleSystem(moduleSystem) {
|
|
12252
12507
|
loader.setModuleSystem(moduleSystem);
|
|
@@ -12436,7 +12691,7 @@ class Autoplay extends Plugin {
|
|
|
12436
12691
|
}
|
|
12437
12692
|
wxCanPlayFn() {
|
|
12438
12693
|
window.WeixinJSBridge && window.WeixinJSBridge.invoke("getNetworkType", {}, () => {
|
|
12439
|
-
this._wxTimer = setTimeout(() => {
|
|
12694
|
+
this._wxTimer = window.setTimeout(() => {
|
|
12440
12695
|
this._wxTimer && clearTimeout(this._wxTimer);
|
|
12441
12696
|
const ret = this.player.play();
|
|
12442
12697
|
if (ret && ret.then) {
|
|
@@ -12510,8 +12765,8 @@ class Autoplay extends Plugin {
|
|
|
12510
12765
|
this._state.showUnmuteBt = true;
|
|
12511
12766
|
this._state.mode = 1;
|
|
12512
12767
|
this.renderUnmuteBt();
|
|
12513
|
-
this._timer = setTimeout(() => {
|
|
12514
|
-
this._timer && clearTimeout(this._timer);
|
|
12768
|
+
this._timer = window.setTimeout(() => {
|
|
12769
|
+
this._timer && window.clearTimeout(this._timer);
|
|
12515
12770
|
const ret = this.player.play();
|
|
12516
12771
|
if (ret && ret.then) {
|
|
12517
12772
|
ret.then(() => {
|
|
@@ -12983,7 +13238,10 @@ const transformOption = (options) => {
|
|
|
12983
13238
|
return xgOptions;
|
|
12984
13239
|
};
|
|
12985
13240
|
class VePlayerBase {
|
|
12986
|
-
/**
|
|
13241
|
+
/** {zh}
|
|
13242
|
+
* @hidden
|
|
13243
|
+
*/
|
|
13244
|
+
/** {en}
|
|
12987
13245
|
* @hidden
|
|
12988
13246
|
*/
|
|
12989
13247
|
constructor(options = {}) {
|
|
@@ -13036,7 +13294,7 @@ class VePlayerBase {
|
|
|
13036
13294
|
this._errorCallback = (err) => this._handleFallback(err);
|
|
13037
13295
|
this._player.on(ERROR, this._errorCallback);
|
|
13038
13296
|
}
|
|
13039
|
-
/**
|
|
13297
|
+
/** {zh}
|
|
13040
13298
|
* @brief 获取视频的就绪状态,其状态枚举值、枚举名称和说明如下:
|
|
13041
13299
|
* - `0`:HAVE_NOTHING,没有关于媒体资源的可用信息
|
|
13042
13300
|
* - `1`:HAVE_METADATA,已检索到足够多的媒体资源来初始化元数据, 快进/快退不会引发异常
|
|
@@ -13044,68 +13302,107 @@ class VePlayerBase {
|
|
|
13044
13302
|
* - `3`:HAVE_FUTURE_DATA,当前播放位置以及未来至少一小段时间的数据是可用的(至少有两帧以上的数据)
|
|
13045
13303
|
* - `4`:HAVE_ENOUGH_DATA,有足够的数据可用,并且下载速率足够,媒体可以不间断地播放到最后
|
|
13046
13304
|
*/
|
|
13305
|
+
/** {en}
|
|
13306
|
+
* @brief Gets the readiness of the video.
|
|
13307
|
+
* - `0`: HAVE_NOTHING, which means there is no information about the media resources.
|
|
13308
|
+
* - `1`: HAVE_METADATA, which means enough media resources have been retrieved to initialize the metadata and fast-forward/rewind will not raise an exception.
|
|
13309
|
+
* - `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.
|
|
13310
|
+
* - `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).
|
|
13311
|
+
* - `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.
|
|
13312
|
+
*/
|
|
13047
13313
|
get readyState() {
|
|
13048
13314
|
return this._player.readyState;
|
|
13049
13315
|
}
|
|
13050
|
-
/**
|
|
13316
|
+
/** {zh}
|
|
13051
13317
|
* @brief 获取当前已缓冲的时间范围。
|
|
13052
13318
|
*/
|
|
13319
|
+
/** {en}
|
|
13320
|
+
* @brief Gets the currently buffered time range.
|
|
13321
|
+
*/
|
|
13053
13322
|
get buffered() {
|
|
13054
13323
|
return this._player.buffered;
|
|
13055
13324
|
}
|
|
13056
|
-
/**
|
|
13325
|
+
/** {zh}
|
|
13057
13326
|
* @brief 获取已经播放的音频/视频的时间范围。
|
|
13058
13327
|
*/
|
|
13328
|
+
/** {en}
|
|
13329
|
+
* @brief Gets the time range of the audio/video that has been played.
|
|
13330
|
+
*/
|
|
13059
13331
|
get played() {
|
|
13060
13332
|
return this._player.played;
|
|
13061
13333
|
}
|
|
13062
|
-
/**
|
|
13334
|
+
/** {zh}
|
|
13063
13335
|
* @brief 设置/获取视频当前的播放时间, 单位为 s。
|
|
13064
13336
|
*/
|
|
13337
|
+
/** {en}
|
|
13338
|
+
* @brief Sets or gets the current playback position of the video, in seconds.
|
|
13339
|
+
*/
|
|
13065
13340
|
get cumulateTime() {
|
|
13066
13341
|
return this._player.cumulateTime;
|
|
13067
13342
|
}
|
|
13068
|
-
/**
|
|
13343
|
+
/** {zh}
|
|
13069
13344
|
* @brief 获取是否处于焦点状态,处于焦点状态会显示控制栏。
|
|
13070
13345
|
*/
|
|
13346
|
+
/** {en}
|
|
13347
|
+
* @brief Gets whether the player has focus. The control bar is displayed when the player has focus.
|
|
13348
|
+
*/
|
|
13071
13349
|
get isFocused() {
|
|
13072
13350
|
return this._player.isActive;
|
|
13073
13351
|
}
|
|
13074
|
-
/**
|
|
13352
|
+
/** {zh}
|
|
13075
13353
|
* @brief 获取播放器是否处于全屏状态。
|
|
13076
13354
|
*/
|
|
13355
|
+
/** {en}
|
|
13356
|
+
* @brief Gets whether the player is in full-screen mode, in which the player covers the entire desktop.
|
|
13357
|
+
*/
|
|
13077
13358
|
get isFullscreen() {
|
|
13078
13359
|
return this._player.isFullscreen;
|
|
13079
13360
|
}
|
|
13080
|
-
/**
|
|
13361
|
+
/** {zh}
|
|
13081
13362
|
* @brief 获取播放器是否处于网页全屏状态。
|
|
13082
13363
|
*/
|
|
13364
|
+
/** {en}
|
|
13365
|
+
* @brief Gets whether the player is in full-window mode, in which the player covers the entire browser window.
|
|
13366
|
+
*/
|
|
13083
13367
|
get isCssFullscreen() {
|
|
13084
13368
|
return this._player.isCssfullScreen;
|
|
13085
13369
|
}
|
|
13086
|
-
/**
|
|
13370
|
+
/** {zh}
|
|
13087
13371
|
* @brief 获取视频的网络状态,其状态枚举值、枚举名称和说明如下:
|
|
13088
13372
|
* - `0`:NETWORK_EMPTY,目前还没有数据,readyState 的值是 HAVE_NOTHING
|
|
13089
13373
|
* - `1`:NETWORK_IDLE,HTMLMediaElement 处于活动状态并已选择资源,但未使用网络
|
|
13090
13374
|
* - `2`:NETWORK_LOADING,浏览器正在下载 HTMLMediaElement 数据
|
|
13091
13375
|
* - `3`:NETWORK_NO_SOURCE,未找到 HTMLMediaElement src。
|
|
13092
13376
|
*/
|
|
13377
|
+
/** {en}
|
|
13378
|
+
* @brief Gets the network condition of the video.
|
|
13379
|
+
* - `0`: NETWORK_EMPTY, which means there is no data yet, and `readyState` is `HAVE_NOTHING`.
|
|
13380
|
+
* - `1`: NETWORK_IDLE, which means the `HTMLMediaElement` element is active and the resources have been selected, but the network is not in use.
|
|
13381
|
+
* - `2`: NETWORK_LOADING, which means the browser is downloading the data of the `HTMLMediaElement` element.
|
|
13382
|
+
* - `3`: NETWORK_NO_SOURCE, the media source is not found according to the `src` property of the `HTMLMediaElement` element.
|
|
13383
|
+
*/
|
|
13093
13384
|
get networkState() {
|
|
13094
13385
|
return this._player.networkState;
|
|
13095
13386
|
}
|
|
13096
|
-
/**
|
|
13387
|
+
/** {zh}
|
|
13097
13388
|
* @brief 获取当前视频是否处于暂停状态。
|
|
13098
13389
|
*/
|
|
13390
|
+
/** {en}
|
|
13391
|
+
* @brief Gets whether the current video is suspended.
|
|
13392
|
+
*/
|
|
13099
13393
|
get paused() {
|
|
13100
13394
|
return this._player.paused;
|
|
13101
13395
|
}
|
|
13102
|
-
/**
|
|
13396
|
+
/** {zh}
|
|
13103
13397
|
* @brief 获取当前视频是否播放结束。
|
|
13104
13398
|
*/
|
|
13399
|
+
/** {en}
|
|
13400
|
+
* @brief Gets whether the current video has finished playing.
|
|
13401
|
+
*/
|
|
13105
13402
|
get ended() {
|
|
13106
13403
|
return this._player.ended;
|
|
13107
13404
|
}
|
|
13108
|
-
/**
|
|
13405
|
+
/** {zh}
|
|
13109
13406
|
* @brief 获取播放器当前所处的状态,其状态枚举值、枚举名称和说明如下:
|
|
13110
13407
|
* - `0`:ERROR,播放出现错误
|
|
13111
13408
|
* - `1`:INITIAL,初始化
|
|
@@ -13117,81 +13414,130 @@ class VePlayerBase {
|
|
|
13117
13414
|
* - `7`:ENDED,播放结束
|
|
13118
13415
|
* - `8`:DESTROYED,播放器实例处于已被销毁
|
|
13119
13416
|
*/
|
|
13417
|
+
/** {en}
|
|
13418
|
+
* @brief Gets the current state of the player.
|
|
13419
|
+
* - `0`: ERROR, which means a playback error occurred
|
|
13420
|
+
* - `1`: INITIAL, which means initialization
|
|
13421
|
+
* - `2`: READY, which means the configuration/event/plug-in has been initialized/bound/instantiated
|
|
13422
|
+
* - `3`: ATTACHING, which means the media object is being mounted.
|
|
13423
|
+
* - `4`: ATTACHED, which means the media object has been mounted in the DOM
|
|
13424
|
+
* - `5`: NOTALLOW, which means the playback is blocked
|
|
13425
|
+
* - `6`: RUNNING, which means the playback has started successfully
|
|
13426
|
+
* - `7`: ENDED, which means the playback has ended
|
|
13427
|
+
* - `8`: DESTROYED, which means the player instance is destroyed
|
|
13428
|
+
*/
|
|
13120
13429
|
get state() {
|
|
13121
13430
|
return this._player.state;
|
|
13122
13431
|
}
|
|
13123
|
-
/**
|
|
13432
|
+
/** {zh}
|
|
13124
13433
|
* 获取当前播放视频的拉流地址。
|
|
13125
13434
|
*/
|
|
13435
|
+
/** {en}
|
|
13436
|
+
* Gets the current pull stream address.
|
|
13437
|
+
*/
|
|
13126
13438
|
get url() {
|
|
13127
13439
|
return this._player.config.url;
|
|
13128
13440
|
}
|
|
13129
|
-
/**
|
|
13130
|
-
* @brief
|
|
13441
|
+
/** {zh}
|
|
13442
|
+
* @brief 获取当前播放视频的线路名称唯一标识(name)。
|
|
13443
|
+
*/
|
|
13444
|
+
/** {en}
|
|
13445
|
+
* @brief Gets the current playback source ID.
|
|
13131
13446
|
*/
|
|
13132
13447
|
get source() {
|
|
13133
13448
|
var _a;
|
|
13134
13449
|
return (_a = this._sourceManager.source) == null ? void 0 : _a.name;
|
|
13135
13450
|
}
|
|
13136
|
-
/**
|
|
13451
|
+
/** {zh}
|
|
13137
13452
|
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|
|
13138
13453
|
*/
|
|
13454
|
+
/** {en}
|
|
13455
|
+
* @brief Gets the current resolution ID.
|
|
13456
|
+
*/
|
|
13139
13457
|
get definition() {
|
|
13140
13458
|
var _a;
|
|
13141
13459
|
return (_a = this._sourceManager.definition) == null ? void 0 : _a.definition;
|
|
13142
13460
|
}
|
|
13143
|
-
/**
|
|
13461
|
+
/** {zh}
|
|
13144
13462
|
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
13145
13463
|
*/
|
|
13464
|
+
/** {en}
|
|
13465
|
+
* @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).
|
|
13466
|
+
*/
|
|
13146
13467
|
get crossOrigin() {
|
|
13147
13468
|
return this._player.crossOrigin;
|
|
13148
13469
|
}
|
|
13149
|
-
/**
|
|
13470
|
+
/** {zh}
|
|
13150
13471
|
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
13151
13472
|
*/
|
|
13473
|
+
/** {en}
|
|
13474
|
+
* @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).
|
|
13475
|
+
*/
|
|
13152
13476
|
set crossOrigin(crossOrigin) {
|
|
13153
13477
|
this._player.crossOrigin = crossOrigin;
|
|
13154
13478
|
}
|
|
13155
|
-
/**
|
|
13479
|
+
/** {zh}
|
|
13156
13480
|
* @brief 获取和设置视频的音量,取值范围为 [0,1]。
|
|
13157
13481
|
*/
|
|
13482
|
+
/** {en}
|
|
13483
|
+
* @brief Gets the volume of the video. The value range is [0,1].
|
|
13484
|
+
*/
|
|
13158
13485
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
13159
13486
|
get volume() {
|
|
13160
13487
|
return this._player.volume;
|
|
13161
13488
|
}
|
|
13162
|
-
/**
|
|
13489
|
+
/** {zh}
|
|
13163
13490
|
* @brief 获取和设置视频的音量,取值范围为 [0,1]。
|
|
13164
13491
|
*/
|
|
13492
|
+
/** {en}
|
|
13493
|
+
* @brief Sets the volume of the video. Valid range: [0,1].
|
|
13494
|
+
*/
|
|
13165
13495
|
set volume(volume) {
|
|
13166
13496
|
this._player.volume = volume;
|
|
13167
13497
|
}
|
|
13168
|
-
/**
|
|
13498
|
+
/** {zh}
|
|
13169
13499
|
* @brief 获取和设置视频静音状态。
|
|
13170
13500
|
* - `true`:静音
|
|
13171
13501
|
* - `false`:非静音
|
|
13172
13502
|
*/
|
|
13503
|
+
/** {en}
|
|
13504
|
+
* @brief Gets whether the video is muted.
|
|
13505
|
+
* - `true`: Muted.
|
|
13506
|
+
* - `false`: Not muted.
|
|
13507
|
+
*/
|
|
13173
13508
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
13174
13509
|
get muted() {
|
|
13175
13510
|
return this._player.muted;
|
|
13176
13511
|
}
|
|
13177
|
-
/**
|
|
13512
|
+
/** {zh}
|
|
13178
13513
|
* @brief 获取和设置视频静音状态。
|
|
13179
13514
|
* - `true`:静音
|
|
13180
13515
|
* - `false`:非静音
|
|
13181
13516
|
*/
|
|
13517
|
+
/** {en}
|
|
13518
|
+
* @brief Mute or unmute the video.
|
|
13519
|
+
* - `true`: Mute the video.
|
|
13520
|
+
* - `false`: Unmute the video.
|
|
13521
|
+
*/
|
|
13182
13522
|
set muted(isMuted) {
|
|
13183
13523
|
this._player.muted = isMuted;
|
|
13184
13524
|
}
|
|
13185
|
-
/**
|
|
13525
|
+
/** {zh}
|
|
13186
13526
|
* @brief 获取和设置当前语言。
|
|
13187
13527
|
*/
|
|
13528
|
+
/** {en}
|
|
13529
|
+
* @brief Gets the current language.
|
|
13530
|
+
*/
|
|
13188
13531
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
13189
13532
|
get lang() {
|
|
13190
13533
|
return this._i18nManager.getLang();
|
|
13191
13534
|
}
|
|
13192
|
-
/**
|
|
13535
|
+
/** {zh}
|
|
13193
13536
|
* @brief 获取和设置当前语言。
|
|
13194
13537
|
*/
|
|
13538
|
+
/** {en}
|
|
13539
|
+
* @brief Sets the current language.
|
|
13540
|
+
*/
|
|
13195
13541
|
set lang(lang) {
|
|
13196
13542
|
var _a, _b;
|
|
13197
13543
|
if (this._player.lang === lang) {
|
|
@@ -13213,7 +13559,10 @@ class VePlayerBase {
|
|
|
13213
13559
|
get _src() {
|
|
13214
13560
|
return this._player.currentSrc;
|
|
13215
13561
|
}
|
|
13216
|
-
/**
|
|
13562
|
+
/** {zh}
|
|
13563
|
+
* @hidden
|
|
13564
|
+
*/
|
|
13565
|
+
/** {en}
|
|
13217
13566
|
* @hidden
|
|
13218
13567
|
*/
|
|
13219
13568
|
static async create(options = {}, Constructor) {
|
|
@@ -13243,11 +13592,16 @@ class VePlayerBase {
|
|
|
13243
13592
|
sourceManager
|
|
13244
13593
|
});
|
|
13245
13594
|
}
|
|
13246
|
-
/**
|
|
13595
|
+
/** {zh}
|
|
13247
13596
|
* @brief 调用此方法切换拉流地址、线路、清晰度。
|
|
13248
13597
|
* @param target 目标地址,可以是播放地址,也可以是线路和清晰度
|
|
13249
13598
|
* @param options 更多配置信息
|
|
13250
13599
|
*/
|
|
13600
|
+
/** {en}
|
|
13601
|
+
* @brief Switches the pull stream address, playback source, or resolution.
|
|
13602
|
+
* @param target The target pull stream address, playback source, or resolution.
|
|
13603
|
+
* @param options More configurations.
|
|
13604
|
+
*/
|
|
13251
13605
|
async switch(target, options) {
|
|
13252
13606
|
var _a, _b;
|
|
13253
13607
|
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) {
|
|
@@ -13264,20 +13618,31 @@ class VePlayerBase {
|
|
|
13264
13618
|
await this._switch(targetDefinition);
|
|
13265
13619
|
return targetDefinition;
|
|
13266
13620
|
}
|
|
13267
|
-
/**
|
|
13621
|
+
/** {zh}
|
|
13268
13622
|
* @brief 调用此方法更新拉流地址列表。
|
|
13269
13623
|
* @param playlist 要更新的播放列表。
|
|
13270
13624
|
* @param target 更新后默认播放的资源。
|
|
13271
13625
|
*/
|
|
13626
|
+
/** {en}
|
|
13627
|
+
* @brief Updates the list of pull stream addresses.
|
|
13628
|
+
* @param Playlist The updated list.
|
|
13629
|
+
* @param Target The default playback resource after the update.
|
|
13630
|
+
*/
|
|
13272
13631
|
updatePlaylist(playlist, target) {
|
|
13273
13632
|
const sourceManager = this._sourceManager.updateSources(playlist, target);
|
|
13274
13633
|
return this._switch(sourceManager.definition);
|
|
13275
13634
|
}
|
|
13276
13635
|
// TODO: 等西瓜播放器完善错误码后增加函数重载以提供更好的类型
|
|
13277
13636
|
/**
|
|
13637
|
+
/** {zh}
|
|
13278
13638
|
* @brief 调用此方法监听指定事件,事件处理函数只执行一次。
|
|
13279
13639
|
* @param event 表示事件的名称。
|
|
13280
|
-
* @param callback
|
|
13640
|
+
* @param callback 表示事件的回调函数。
|
|
13641
|
+
*/
|
|
13642
|
+
/** {en}
|
|
13643
|
+
* @brief Listens for a specified event. The event handler is executed only once.
|
|
13644
|
+
* @param event The event name.
|
|
13645
|
+
* @param callback The callback function for the event.
|
|
13281
13646
|
*/
|
|
13282
13647
|
once(event, callback) {
|
|
13283
13648
|
var _a;
|
|
@@ -13290,10 +13655,15 @@ class VePlayerBase {
|
|
|
13290
13655
|
this._player.once(xgEventName, xgCallback);
|
|
13291
13656
|
}
|
|
13292
13657
|
}
|
|
13293
|
-
/**
|
|
13658
|
+
/** {zh}
|
|
13294
13659
|
* @brief 调用此方法解绑或移除指定事件的事件监听。
|
|
13295
13660
|
* @param event 表示事件的名称。
|
|
13296
|
-
* @param callback
|
|
13661
|
+
* @param callback 表示事件的回调函数。
|
|
13662
|
+
*/
|
|
13663
|
+
/** {en}
|
|
13664
|
+
* @brief Stops listening for a specified event.
|
|
13665
|
+
* @param event The event name.
|
|
13666
|
+
* @param callback The callback function for the event.
|
|
13297
13667
|
*/
|
|
13298
13668
|
off(event, callback) {
|
|
13299
13669
|
var _a;
|
|
@@ -13304,26 +13674,39 @@ class VePlayerBase {
|
|
|
13304
13674
|
this._events[event].delete(callback);
|
|
13305
13675
|
}
|
|
13306
13676
|
}
|
|
13307
|
-
/**
|
|
13677
|
+
/** {zh}
|
|
13308
13678
|
* @brief 调用此方法触发指定事件。
|
|
13309
13679
|
* @param event 表示事件的名称。
|
|
13310
13680
|
* @param data 事件信息。
|
|
13311
13681
|
*/
|
|
13682
|
+
/** {en}
|
|
13683
|
+
* @brief Triggers a specified event.
|
|
13684
|
+
* @param event The event name.
|
|
13685
|
+
* @param data The event information.
|
|
13686
|
+
*/
|
|
13312
13687
|
emit(event, data) {
|
|
13313
13688
|
const { xgEventName } = this._transformEvent(event);
|
|
13314
13689
|
this._player.emit(xgEventName, data);
|
|
13315
13690
|
}
|
|
13316
|
-
/**
|
|
13691
|
+
/** {zh}
|
|
13317
13692
|
* @brief 调用此方法解绑或移除指定事件的所有事件监听。
|
|
13318
13693
|
*/
|
|
13694
|
+
/** {en}
|
|
13695
|
+
* @brief Stops listening to any player event.
|
|
13696
|
+
*/
|
|
13319
13697
|
offAll() {
|
|
13320
13698
|
this._events = {};
|
|
13321
13699
|
this._player.offAll();
|
|
13322
13700
|
}
|
|
13323
|
-
/**
|
|
13701
|
+
/** {zh}
|
|
13324
13702
|
* @brief 调用此方法监听指定事件。
|
|
13325
|
-
* @param event
|
|
13326
|
-
* @param callback
|
|
13703
|
+
* @param event 表示事件名称。
|
|
13704
|
+
* @param callback 表示事件的回调函数。
|
|
13705
|
+
*/
|
|
13706
|
+
/** {en}
|
|
13707
|
+
* @brief Listens for a specified event.
|
|
13708
|
+
* @param event The event name.
|
|
13709
|
+
* @param callback The callback function for the event.
|
|
13327
13710
|
*/
|
|
13328
13711
|
on(event, callback) {
|
|
13329
13712
|
var _a;
|
|
@@ -13336,102 +13719,153 @@ class VePlayerBase {
|
|
|
13336
13719
|
this._player.on(xgEventName, xgCallback);
|
|
13337
13720
|
}
|
|
13338
13721
|
}
|
|
13339
|
-
/**
|
|
13722
|
+
/** {zh}
|
|
13340
13723
|
* @brief 调用此方法开始播放 。
|
|
13341
13724
|
*/
|
|
13725
|
+
/** {en}
|
|
13726
|
+
* @brief Starts playback.
|
|
13727
|
+
*/
|
|
13342
13728
|
play() {
|
|
13343
13729
|
/* istanbul ignore next -- @preserve */
|
|
13344
13730
|
return this._player.play();
|
|
13345
13731
|
}
|
|
13346
|
-
/**
|
|
13732
|
+
/** {zh}
|
|
13347
13733
|
* @brief 调用此方法暂停播放。
|
|
13348
13734
|
*/
|
|
13735
|
+
/** {en}
|
|
13736
|
+
* @brief Pauses playback.
|
|
13737
|
+
*/
|
|
13349
13738
|
pause() {
|
|
13350
13739
|
/* istanbul ignore next -- @preserve */
|
|
13351
13740
|
return this._player.pause();
|
|
13352
13741
|
}
|
|
13353
|
-
/**
|
|
13742
|
+
/** {zh}
|
|
13354
13743
|
* @brief 调用此方法打开画中画。
|
|
13355
13744
|
*/
|
|
13745
|
+
/** {en}
|
|
13746
|
+
* @brief Turns on Picture-in-Picture (PIP).
|
|
13747
|
+
*/
|
|
13356
13748
|
requestPIP() {
|
|
13357
13749
|
var _a;
|
|
13358
13750
|
/* istanbul ignore next -- @preserve */
|
|
13359
13751
|
(_a = this._player.plugins.pip) == null ? void 0 : _a.requestPIP();
|
|
13360
13752
|
}
|
|
13361
|
-
/**
|
|
13753
|
+
/** {zh}
|
|
13362
13754
|
* @brief 调用此方法关闭画中画。
|
|
13363
13755
|
*/
|
|
13756
|
+
/** {en}
|
|
13757
|
+
* @brief Turns off Picture-in-Picture (PIP).
|
|
13758
|
+
*/
|
|
13364
13759
|
exitPIP() {
|
|
13365
13760
|
var _a;
|
|
13366
13761
|
/* istanbul ignore next -- @preserve */
|
|
13367
13762
|
(_a = this._player.plugins.pip) == null ? void 0 : _a.exitPIP();
|
|
13368
13763
|
}
|
|
13369
|
-
/**
|
|
13764
|
+
/** {zh}
|
|
13370
13765
|
* @brief 调用此方法重新拉流。
|
|
13371
13766
|
*/
|
|
13767
|
+
/** {en}
|
|
13768
|
+
* @brief Retries stream-pulling.
|
|
13769
|
+
*/
|
|
13372
13770
|
retry() {
|
|
13373
13771
|
return this._player.retry();
|
|
13374
13772
|
}
|
|
13375
|
-
/**
|
|
13773
|
+
/** {zh}
|
|
13376
13774
|
* @brief 播放器获取焦点,调用该方法 `veplayer.isFocused` 将会变为 `true`,并触发 `PLAYER_FOCUS` 事件。
|
|
13377
13775
|
* @param data 播放器获取焦点配置信息。
|
|
13378
13776
|
*/
|
|
13777
|
+
/** {en}
|
|
13778
|
+
* @brief The player gets focus. When the method is called, `veplayer.isFocused` will become `true` and the `PLAYER_FOCUS` event will be triggered.
|
|
13779
|
+
* @param data Related configurations.
|
|
13780
|
+
*/
|
|
13379
13781
|
focus(data) {
|
|
13380
13782
|
return this._player.focus(data);
|
|
13381
13783
|
}
|
|
13382
|
-
/**
|
|
13784
|
+
/** {zh}
|
|
13383
13785
|
* @brief 播放器失去焦点,调用该方法 `veplayer.isFocused` 将会变为 `false`,并触发 `PLAYER_BLUR` 事件。
|
|
13384
13786
|
* @param data 播放器失去焦点配置信息。
|
|
13385
13787
|
*/
|
|
13788
|
+
/** {en}
|
|
13789
|
+
* @brief The player loses focus. When the method is called, `veplayer.isFocused` will become `false` and the `PLAYER_BLUR` event will be triggered.
|
|
13790
|
+
* @param data The related configurations.
|
|
13791
|
+
*/
|
|
13386
13792
|
blur(data) {
|
|
13387
13793
|
return this._player.blur(data);
|
|
13388
13794
|
}
|
|
13389
|
-
/**
|
|
13795
|
+
/** {zh}
|
|
13390
13796
|
* @brief 调用此方法进入系统全屏状态。如果该方法调用的时候处于网页全屏状态会自动退出网页全屏,下发事件 `Events.FULLSCREEN_CHANGE`。
|
|
13391
13797
|
* @param el 全屏作用的 DOM 节点。
|
|
13392
13798
|
*/
|
|
13799
|
+
/** {en}
|
|
13800
|
+
* @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.
|
|
13801
|
+
* @param el The DOM node in which the player is displayed in full-screen mode.
|
|
13802
|
+
*/
|
|
13393
13803
|
requestFullscreen(el) {
|
|
13394
13804
|
return this._player.getFullscreen(el);
|
|
13395
13805
|
}
|
|
13396
|
-
/**
|
|
13806
|
+
/** {zh}
|
|
13397
13807
|
* @brief 调用此方法退出系统全屏状态,调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.FULLSCREEN_CHANGE` 事件。
|
|
13398
13808
|
* @param el 全屏作用的 DOM 节点。
|
|
13399
13809
|
*/
|
|
13810
|
+
/** {en}
|
|
13811
|
+
* @brief Exits full-screen mode. After the method is called, `veplayer.isFullscreen` will become `false` and the `Events.FULLSCREEN_CHANGE` event will be triggered.
|
|
13812
|
+
* @param el The DOM node of the full screen effect.
|
|
13813
|
+
*/
|
|
13400
13814
|
exitFullscreen(el) {
|
|
13401
13815
|
return this._player.exitFullscreen(el);
|
|
13402
13816
|
}
|
|
13403
|
-
/**
|
|
13817
|
+
/** {zh}
|
|
13404
13818
|
* @brief 调用此方法进入网页样式全屏状态,播放器进入网页全屏,利用 CSS 模拟实现全屏效果。如果该接口调用的时候处于全屏状态,会自动退出全屏,下发事件 `Events.CSS_FULLSCREEN_CHANGE`。
|
|
13405
13819
|
* @param el 全屏作用的 DOM 节点。
|
|
13406
13820
|
*/
|
|
13821
|
+
/** {en}
|
|
13822
|
+
* @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.
|
|
13823
|
+
* @param el The DOM node in which the player is displayed in full-window mode.
|
|
13824
|
+
*/
|
|
13407
13825
|
requestCssFullscreen(el) {
|
|
13408
13826
|
return this._player.getCssFullscreen(el);
|
|
13409
13827
|
}
|
|
13410
|
-
/**
|
|
13828
|
+
/** {zh}
|
|
13411
13829
|
* @brief 调用此方法退出网页样式全屏状态。 调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.CSS_FULLSCREEN_CHANGE` 事件。
|
|
13412
13830
|
*/
|
|
13831
|
+
/** {en}
|
|
13832
|
+
* @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.
|
|
13833
|
+
*/
|
|
13413
13834
|
exitCssFullscreen() {
|
|
13414
13835
|
return this._player.exitCssFullscreen();
|
|
13415
13836
|
}
|
|
13416
|
-
/**
|
|
13837
|
+
/** {zh}
|
|
13417
13838
|
* @brief 调用此方法在当前播放器上注册指定插件。
|
|
13418
13839
|
* @param plugin 插件构造函数。
|
|
13419
13840
|
* @param config 插件的配置列表。
|
|
13420
13841
|
*/
|
|
13842
|
+
/** {en}
|
|
13843
|
+
* @brief Registers a specified plug-in to the current player.
|
|
13844
|
+
* @param Plugin The plugin constructor.
|
|
13845
|
+
* @param config The plugin configurations.
|
|
13846
|
+
*/
|
|
13421
13847
|
registerPlugin(plugin, config) {
|
|
13422
13848
|
return this._player.registerPlugin(plugin, config);
|
|
13423
13849
|
}
|
|
13424
|
-
/**
|
|
13850
|
+
/** {zh}
|
|
13425
13851
|
* @brief 调用此方法在当前播放器上销毁/注销指定插件。
|
|
13426
13852
|
* @param plugin 插件实例或者插件名称。
|
|
13427
13853
|
*/
|
|
13854
|
+
/** {en}
|
|
13855
|
+
* @brief Destroys or unregisters a specified plugin from the player.
|
|
13856
|
+
* @param Plugin The plugin instance or name.
|
|
13857
|
+
*/
|
|
13428
13858
|
unRegisterPlugin(plugin) {
|
|
13429
13859
|
return this._player.unRegisterPlugin(plugin);
|
|
13430
13860
|
}
|
|
13431
|
-
/**
|
|
13861
|
+
/** {zh}
|
|
13432
13862
|
* @brief 调用此接口显示指定插件图标。
|
|
13433
13863
|
* @param pluginNames 插件名称
|
|
13434
13864
|
*/
|
|
13865
|
+
/** {en}
|
|
13866
|
+
* @brief Displays the icon of a specified plugin.
|
|
13867
|
+
* @param PluginNames The plugin name.
|
|
13868
|
+
*/
|
|
13435
13869
|
showIcon(pluginNames) {
|
|
13436
13870
|
const morePlugin = this._player.getPlugin("more");
|
|
13437
13871
|
pluginNames.forEach((pluginName) => {
|
|
@@ -13445,10 +13879,14 @@ class VePlayerBase {
|
|
|
13445
13879
|
}
|
|
13446
13880
|
});
|
|
13447
13881
|
}
|
|
13448
|
-
/**
|
|
13882
|
+
/** {zh}
|
|
13449
13883
|
* @brief 调用此接口隐藏指定插件图标。
|
|
13450
13884
|
* @param pluginNames 插件名称
|
|
13451
13885
|
*/
|
|
13886
|
+
/** {en}
|
|
13887
|
+
* @brief Hides the icon of a specified plugin.
|
|
13888
|
+
* @param PluginNames The plugin name.
|
|
13889
|
+
*/
|
|
13452
13890
|
hideIcon(pluginNames) {
|
|
13453
13891
|
const morePlugin = this._player.getPlugin("more");
|
|
13454
13892
|
pluginNames.forEach((pluginName) => {
|
|
@@ -13462,14 +13900,20 @@ class VePlayerBase {
|
|
|
13462
13900
|
}
|
|
13463
13901
|
});
|
|
13464
13902
|
}
|
|
13465
|
-
/**
|
|
13903
|
+
/** {zh}
|
|
13466
13904
|
* @brief 调用此方法销毁播放器实例。
|
|
13467
13905
|
*/
|
|
13906
|
+
/** {en}
|
|
13907
|
+
* @brief Destroys the player instance.
|
|
13908
|
+
*/
|
|
13468
13909
|
destroy() {
|
|
13469
13910
|
this._player.off(ERROR, this._errorCallback);
|
|
13470
13911
|
this._player.destroy();
|
|
13471
13912
|
}
|
|
13472
|
-
/**
|
|
13913
|
+
/** {zh}
|
|
13914
|
+
* @hidden
|
|
13915
|
+
*/
|
|
13916
|
+
/** {en}
|
|
13473
13917
|
* @hidden
|
|
13474
13918
|
*/
|
|
13475
13919
|
async prepare(url) {
|