@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.
Files changed (43) hide show
  1. package/LICENSE +20 -0
  2. package/esm/index.d.ts +1752 -294
  3. package/esm/veplayer.biz.live.development.js +122 -28
  4. package/esm/veplayer.biz.live.production.js +1 -1
  5. package/esm/veplayer.d.ts +3888 -648
  6. package/esm/veplayer.development.css +1 -1
  7. package/esm/veplayer.development.js +729 -194
  8. package/esm/veplayer.live.d.ts +3888 -648
  9. package/esm/veplayer.live.development.css +1 -1
  10. package/esm/veplayer.live.development.js +729 -194
  11. package/esm/veplayer.live.production.css +1 -1
  12. package/esm/veplayer.live.production.js +3 -3
  13. package/esm/veplayer.production.css +1 -1
  14. package/esm/veplayer.production.js +3 -3
  15. package/esm/veplayer.vod.d.ts +1752 -294
  16. package/esm/veplayer.vod.development.css +1 -1
  17. package/esm/veplayer.vod.development.js +620 -176
  18. package/esm/veplayer.vod.production.css +1 -1
  19. package/esm/veplayer.vod.production.js +2 -2
  20. package/package.json +1 -1
  21. package/umd/index.d.ts +1752 -294
  22. package/umd/veplayer.biz.live.development.js +125 -31
  23. package/umd/veplayer.biz.live.production.js +1 -1
  24. package/umd/veplayer.biz.vod.development.js +3 -2
  25. package/umd/veplayer.biz.vod.production.js +1 -1
  26. package/umd/veplayer.d.ts +3888 -648
  27. package/umd/veplayer.development.css +1 -1
  28. package/umd/veplayer.development.js +728 -193
  29. package/umd/veplayer.live.d.ts +3888 -648
  30. package/umd/veplayer.live.development.css +1 -1
  31. package/umd/veplayer.live.development.js +731 -196
  32. package/umd/veplayer.live.production.css +1 -1
  33. package/umd/veplayer.live.production.js +1 -1
  34. package/umd/veplayer.production.css +1 -1
  35. package/umd/veplayer.production.js +1 -1
  36. package/umd/veplayer.vod.d.ts +1752 -294
  37. package/umd/veplayer.vod.development.css +1 -1
  38. package/umd/veplayer.vod.development.js +625 -181
  39. package/umd/veplayer.vod.production.css +1 -1
  40. package/umd/veplayer.vod.production.js +1 -1
  41. package/veplayer.d.ts +3888 -648
  42. package/veplayer.live.d.ts +3888 -648
  43. package/veplayer.vod.d.ts +1752 -294
@@ -52,8 +52,8 @@ var __publicField = (obj, key, value) => {
52
52
  return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
53
53
  }, _typeof(obj);
54
54
  }
55
- function _classCallCheck(instance, Constructor) {
56
- if (!(instance instanceof Constructor)) {
55
+ function _classCallCheck(instance2, Constructor) {
56
+ if (!(instance2 instanceof Constructor)) {
57
57
  throw new TypeError("Cannot call a class as a function");
58
58
  }
59
59
  }
@@ -1458,7 +1458,7 @@ var __publicField = (obj, key, value) => {
1458
1458
  }
1459
1459
  }
1460
1460
  };
1461
- var version = "3.0.11-alpha.2";
1461
+ var version = "3.0.12";
1462
1462
  var ERROR_TYPE_MAP = {
1463
1463
  1: "media",
1464
1464
  2: "media",
@@ -2320,10 +2320,10 @@ var __publicField = (obj, key, value) => {
2320
2320
  }, {
2321
2321
  key: "addData",
2322
2322
  value: function addData(storename, data) {
2323
- var store = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2323
+ var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2324
2324
  var request;
2325
2325
  for (var i2 = 0; i2 < data.length; i2++) {
2326
- request = store.add(data[i2]);
2326
+ request = store2.add(data[i2]);
2327
2327
  request.onerror = function() {
2328
2328
  };
2329
2329
  request.onsuccess = function() {
@@ -2333,10 +2333,10 @@ var __publicField = (obj, key, value) => {
2333
2333
  }, {
2334
2334
  key: "putData",
2335
2335
  value: function putData(storename, data) {
2336
- var store = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2336
+ var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2337
2337
  var request;
2338
2338
  for (var i2 = 0; i2 < data.length; i2++) {
2339
- request = store.put(data[i2]);
2339
+ request = store2.put(data[i2]);
2340
2340
  request.onerror = function() {
2341
2341
  };
2342
2342
  request.onsuccess = function() {
@@ -2347,8 +2347,8 @@ var __publicField = (obj, key, value) => {
2347
2347
  key: "getDataByKey",
2348
2348
  value: function getDataByKey(storename, key, callback) {
2349
2349
  var self2 = this;
2350
- var store = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2351
- var request = store.get(key);
2350
+ var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2351
+ var request = store2.get(key);
2352
2352
  request.onerror = function() {
2353
2353
  callback.call(self2, null);
2354
2354
  };
@@ -2360,14 +2360,14 @@ var __publicField = (obj, key, value) => {
2360
2360
  }, {
2361
2361
  key: "deleteData",
2362
2362
  value: function deleteData(storename, key) {
2363
- var store = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2364
- store.delete(key);
2363
+ var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2364
+ store2.delete(key);
2365
2365
  }
2366
2366
  }, {
2367
2367
  key: "clearData",
2368
2368
  value: function clearData(storename) {
2369
- var store = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2370
- store.clear();
2369
+ var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2370
+ store2.clear();
2371
2371
  }
2372
2372
  }]);
2373
2373
  return INDEXDB2;
@@ -2484,24 +2484,24 @@ var __publicField = (obj, key, value) => {
2484
2484
  return plugin.removeHooks && plugin.removeHooks.apply(plugin, args);
2485
2485
  }
2486
2486
  }
2487
- function hooksDescriptor(instance) {
2487
+ function hooksDescriptor(instance2) {
2488
2488
  var presetHooks = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
2489
- instance.__hooks = {};
2489
+ instance2.__hooks = {};
2490
2490
  presetHooks && presetHooks.map(function(item) {
2491
- instance.__hooks[item] = null;
2491
+ instance2.__hooks[item] = null;
2492
2492
  });
2493
- Object.defineProperty(instance, "hooks", {
2493
+ Object.defineProperty(instance2, "hooks", {
2494
2494
  get: function get() {
2495
- return instance.__hooks && Object.keys(instance.__hooks).map(function(key) {
2496
- if (instance.__hooks[key]) {
2495
+ return instance2.__hooks && Object.keys(instance2.__hooks).map(function(key) {
2496
+ if (instance2.__hooks[key]) {
2497
2497
  return key;
2498
2498
  }
2499
2499
  });
2500
2500
  }
2501
2501
  });
2502
2502
  }
2503
- function delHooksDescriptor(instance) {
2504
- instance.__hooks = null;
2503
+ function delHooksDescriptor(instance2) {
2504
+ instance2.__hooks = null;
2505
2505
  }
2506
2506
  function runHooks(obj, hookName, handler) {
2507
2507
  for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
@@ -2719,7 +2719,7 @@ var __publicField = (obj, key, value) => {
2719
2719
  }
2720
2720
  }, {
2721
2721
  key: "registerPlugin",
2722
- value: function registerPlugin(plugin) {
2722
+ value: function registerPlugin2(plugin) {
2723
2723
  var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2724
2724
  var name = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
2725
2725
  if (!this.player) {
@@ -3078,7 +3078,7 @@ var __publicField = (obj, key, value) => {
3078
3078
  }
3079
3079
  }, {
3080
3080
  key: "registerPlugin",
3081
- value: function registerPlugin(plugin) {
3081
+ value: function registerPlugin2(plugin) {
3082
3082
  var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
3083
3083
  var name = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
3084
3084
  options.root = options.root || this.root;
@@ -3217,7 +3217,7 @@ var __publicField = (obj, key, value) => {
3217
3217
  var cs = window.getComputedStyle(this.root, null);
3218
3218
  var cssDisplayValue = cs.getPropertyValue("display");
3219
3219
  if (cssDisplayValue === "none") {
3220
- return this.root.style.display = "block";
3220
+ this.root.style.display = "block";
3221
3221
  }
3222
3222
  }
3223
3223
  }, {
@@ -3474,28 +3474,11 @@ var __publicField = (obj, key, value) => {
3474
3474
  !player.config.closeResizeObserver && addObserver(player.root, function() {
3475
3475
  player.resize();
3476
3476
  });
3477
- if (Object.keys(this.pluginGroup).length === 0) {
3478
- player.isUserActive = true;
3479
- }
3480
3477
  this.pluginGroup[cgid] = {
3481
- _player: player,
3482
3478
  _originalOptions: player.config || {},
3483
3479
  _plugins: {}
3484
3480
  };
3485
3481
  },
3486
- checkPlayerRoot: function checkPlayerRoot(root2) {
3487
- if (this.pluginGroup) {
3488
- var _keys = Object.keys(this.pluginGroup);
3489
- for (var i2 = 0; i2 < _keys.length; i2++) {
3490
- var _p = this.pluginGroup[_keys[i2]]._player;
3491
- if (_p.root === root2) {
3492
- return _p;
3493
- }
3494
- }
3495
- return null;
3496
- }
3497
- return null;
3498
- },
3499
3482
  formatPluginInfo: function formatPluginInfo(plugin, config) {
3500
3483
  var PLUFGIN = null;
3501
3484
  var options = null;
@@ -3570,7 +3553,7 @@ var __publicField = (obj, key, value) => {
3570
3553
  }
3571
3554
  var plugins = this.pluginGroup[cgid]._plugins;
3572
3555
  var originalOptions = this.pluginGroup[cgid]._originalOptions;
3573
- options.player = this.pluginGroup[cgid]._player;
3556
+ options.player = player;
3574
3557
  var pluginName = options.pluginName || plugin.pluginName;
3575
3558
  if (!pluginName) {
3576
3559
  throw new Error("The property pluginName is necessary");
@@ -3769,37 +3752,6 @@ var __publicField = (obj, key, value) => {
3769
3752
  }
3770
3753
  });
3771
3754
  },
3772
- setCurrentUserActive: function setCurrentUserActive(playerId, isActive) {
3773
- if (!this.pluginGroup[playerId]) {
3774
- return;
3775
- }
3776
- if (!isActive) {
3777
- this.pluginGroup[playerId]._player.isUserActive = isActive;
3778
- return playerId;
3779
- }
3780
- var keys = Object.keys(this.pluginGroup);
3781
- for (var i2 = 0; i2 < keys.length; i2++) {
3782
- var c2 = this.pluginGroup[keys[i2]];
3783
- if (c2 && c2._player) {
3784
- this.pluginGroup[keys[i2]]._player.isUserActive = false;
3785
- }
3786
- }
3787
- this.pluginGroup[playerId]._player.isUserActive = isActive;
3788
- return playerId;
3789
- },
3790
- getCurrentUseActiveId: function getCurrentUseActiveId() {
3791
- if (!this.pluginGroup) {
3792
- return;
3793
- }
3794
- var keys = Object.keys(this.pluginGroup);
3795
- for (var i2 = 0; i2 < keys.length; i2++) {
3796
- var c2 = this.pluginGroup[keys[i2]];
3797
- if (c2 && c2._player && c2._player.isUserActive) {
3798
- return keys[i2];
3799
- }
3800
- }
3801
- return null;
3802
- },
3803
3755
  destroy: function destroy(player) {
3804
3756
  var cgid = player._pluginInfoId;
3805
3757
  if (!this.pluginGroup[cgid]) {
@@ -4055,7 +4007,7 @@ var __publicField = (obj, key, value) => {
4055
4007
  }
4056
4008
  }, {
4057
4009
  key: "show",
4058
- value: function show() {
4010
+ value: function show(value) {
4059
4011
  this.root.style.display = "";
4060
4012
  this.player.focus();
4061
4013
  }
@@ -4071,7 +4023,7 @@ var __publicField = (obj, key, value) => {
4071
4023
  }
4072
4024
  }, {
4073
4025
  key: "registerPlugin",
4074
- value: function registerPlugin(plugin) {
4026
+ value: function registerPlugin2(plugin) {
4075
4027
  var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
4076
4028
  var name = arguments.length > 2 ? arguments[2] : void 0;
4077
4029
  if (!this.root) {
@@ -4348,9 +4300,158 @@ var __publicField = (obj, key, value) => {
4348
4300
  DESTROYED: 8
4349
4301
  };
4350
4302
  var STATE_ARRAY = ["ERROR", "INITIAL", "READY", "ATTACHING", "ATTACHED", "NOTALLOW", "RUNNING", "ENDED", "DESTROYED"];
4303
+ var store = {};
4304
+ var instance = null;
4305
+ var InstManager = /* @__PURE__ */ function(_EventEmitter) {
4306
+ _inherits(InstManager2, _EventEmitter);
4307
+ var _super = _createSuper(InstManager2);
4308
+ function InstManager2() {
4309
+ _classCallCheck(this, InstManager2);
4310
+ return _super.apply(this, arguments);
4311
+ }
4312
+ _createClass$1(InstManager2, [{
4313
+ key: "add",
4314
+ value: function add(player) {
4315
+ if (!player) {
4316
+ return;
4317
+ }
4318
+ store[player.playerId] = player;
4319
+ if (Object.keys(store).length === 1) {
4320
+ this.setActive(player.playerId, true);
4321
+ }
4322
+ }
4323
+ }, {
4324
+ key: "remove",
4325
+ value: function remove(player) {
4326
+ if (!player) {
4327
+ return;
4328
+ }
4329
+ player.isUserActive;
4330
+ delete store[player.playerId];
4331
+ }
4332
+ }, {
4333
+ key: "_iterate",
4334
+ value: function _iterate(fn) {
4335
+ var endEarly = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
4336
+ for (var key in store) {
4337
+ if (Object.prototype.hasOwnProperty.call(store, key)) {
4338
+ var player = store[key];
4339
+ if (endEarly) {
4340
+ if (fn(player)) {
4341
+ break;
4342
+ }
4343
+ } else {
4344
+ fn(player);
4345
+ }
4346
+ }
4347
+ }
4348
+ }
4349
+ }, {
4350
+ key: "forEach",
4351
+ value: function forEach(fn) {
4352
+ this._iterate(fn);
4353
+ }
4354
+ }, {
4355
+ key: "find",
4356
+ value: function find(fn) {
4357
+ var result = null;
4358
+ this._iterate(function(player) {
4359
+ var flag = fn(player);
4360
+ if (flag) {
4361
+ result = player;
4362
+ }
4363
+ return flag;
4364
+ }, true);
4365
+ return result;
4366
+ }
4367
+ }, {
4368
+ key: "findAll",
4369
+ value: function findAll(fn) {
4370
+ var results = [];
4371
+ this._iterate(function(player) {
4372
+ if (fn(player)) {
4373
+ results.push(player);
4374
+ }
4375
+ });
4376
+ return results;
4377
+ }
4378
+ }, {
4379
+ key: "setActive",
4380
+ value: function setActive(playerId) {
4381
+ var isActive = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
4382
+ if (!store[playerId]) {
4383
+ return;
4384
+ }
4385
+ if (isActive) {
4386
+ this.forEach(function(inst) {
4387
+ if (playerId === inst.playerId) {
4388
+ inst.isUserActive = true;
4389
+ inst.isInstNext = false;
4390
+ } else {
4391
+ inst.isUserActive = false;
4392
+ }
4393
+ });
4394
+ } else {
4395
+ store[playerId].isUserActive = isActive;
4396
+ }
4397
+ return playerId;
4398
+ }
4399
+ }, {
4400
+ key: "getActiveId",
4401
+ value: function getActiveId() {
4402
+ var keys = Object.keys(store);
4403
+ for (var i2 = 0; i2 < keys.length; i2++) {
4404
+ var c2 = store[keys[i2]];
4405
+ if (c2 && c2.isUserActive) {
4406
+ return keys[i2];
4407
+ }
4408
+ }
4409
+ return null;
4410
+ }
4411
+ }, {
4412
+ key: "setNext",
4413
+ value: function setNext(playerId) {
4414
+ var isNext = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
4415
+ if (!store[playerId]) {
4416
+ return;
4417
+ }
4418
+ if (isNext) {
4419
+ this.forEach(function(inst) {
4420
+ if (playerId === inst.playerId) {
4421
+ inst.isUserActive = false;
4422
+ inst.isInstNext = true;
4423
+ } else {
4424
+ inst.isInstNext = false;
4425
+ }
4426
+ });
4427
+ } else {
4428
+ store[playerId].isInstNext = isNext;
4429
+ }
4430
+ return playerId;
4431
+ }
4432
+ }], [{
4433
+ key: "getInstance",
4434
+ value: function getInstance() {
4435
+ instance || (instance = new InstManager2());
4436
+ return instance;
4437
+ }
4438
+ }]);
4439
+ return InstManager2;
4440
+ }(eventemitter3Exports.EventEmitter);
4441
+ function checkPlayerRoot(root2) {
4442
+ var keys = Object.keys(store);
4443
+ for (var i2 = 0; i2 < keys.length; i2++) {
4444
+ var p2 = store[keys[i2]];
4445
+ if (p2.root === root2) {
4446
+ return p2;
4447
+ }
4448
+ }
4449
+ return null;
4450
+ }
4351
4451
  var PlAYER_HOOKS = ["play", "pause", "replay", "retry"];
4352
4452
  var REAL_TIME_SPEED = 0;
4353
4453
  var AVG_SPEED = 0;
4454
+ var instManager = null;
4354
4455
  var Player = /* @__PURE__ */ function(_MediaProxy) {
4355
4456
  _inherits(Player2, _MediaProxy);
4356
4457
  var _super = _createSuper(Player2);
@@ -4363,11 +4464,11 @@ var __publicField = (obj, key, value) => {
4363
4464
  if (!_this.config) {
4364
4465
  return;
4365
4466
  }
4366
- var _this$config = _this.config, autoplay2 = _this$config.autoplay, startTime = _this$config.startTime, defaultPlaybackRate = _this$config.defaultPlaybackRate;
4367
- XG_DEBUG.logInfo("player", "canPlayFunc, startTime", startTime);
4368
- if (startTime) {
4369
- _this.currentTime = startTime > _this.duration ? _this.duration : startTime;
4370
- _this.config.startTime = 0;
4467
+ var _this$config = _this.config, autoplay2 = _this$config.autoplay, defaultPlaybackRate = _this$config.defaultPlaybackRate;
4468
+ XG_DEBUG.logInfo("player", "canPlayFunc, startTime", _this.__startTime);
4469
+ if (_this.__startTime > 0 && _this.duration > 0) {
4470
+ _this.currentTime = _this.__startTime > _this.duration ? _this.duration : _this.__startTime;
4471
+ _this.__startTime = -1;
4371
4472
  }
4372
4473
  _this.playbackRate = defaultPlaybackRate;
4373
4474
  (autoplay2 || _this._useAutoplay) && _this.mediaPlay();
@@ -4458,6 +4559,7 @@ var __publicField = (obj, key, value) => {
4458
4559
  _this.isSeeking = false;
4459
4560
  _this.isCanplay = false;
4460
4561
  _this._useAutoplay = false;
4562
+ _this.__startTime = -1;
4461
4563
  _this.rotateDeg = 0;
4462
4564
  _this.isActive = false;
4463
4565
  _this.fullscreen = false;
@@ -4512,6 +4614,7 @@ var __publicField = (obj, key, value) => {
4512
4614
  _this.innerStates = {
4513
4615
  isActiveLocked: false
4514
4616
  };
4617
+ _this.instManager = instManager;
4515
4618
  var rootInit = _this._initDOM();
4516
4619
  if (!rootInit) {
4517
4620
  console.error(new Error("can't find the dom which id is ".concat(_this.config.id, " or this.config.el does not exist")));
@@ -4549,7 +4652,7 @@ var __publicField = (obj, key, value) => {
4549
4652
  _createClass$1(Player2, [{
4550
4653
  key: "_initDOM",
4551
4654
  value: function _initDOM() {
4552
- var _this2 = this;
4655
+ var _instManager, _this2 = this;
4553
4656
  this.root = this.config.id ? document.getElementById(this.config.id) : null;
4554
4657
  if (!this.root) {
4555
4658
  var el = this.config.el;
@@ -4565,12 +4668,13 @@ var __publicField = (obj, key, value) => {
4565
4668
  return false;
4566
4669
  }
4567
4670
  }
4568
- var ret = pluginsManager.checkPlayerRoot(this.root);
4671
+ var ret = checkPlayerRoot(this.root);
4569
4672
  if (ret) {
4570
4673
  XG_DEBUG.logWarn("The is an Player instance already exists in this.root, destroy it and reinitialize");
4571
4674
  ret.destroy();
4572
4675
  }
4573
4676
  this.root.setAttribute(PLATER_ID, this.playerId);
4677
+ (_instManager = instManager) === null || _instManager === void 0 ? void 0 : _instManager.add(this);
4574
4678
  pluginsManager.init(this);
4575
4679
  this._initBaseDoms();
4576
4680
  var XgVideoProxy = this.constructor.XgVideoProxy;
@@ -4713,10 +4817,13 @@ var __publicField = (obj, key, value) => {
4713
4817
  !util$1.isMSE(this.media) && this.load();
4714
4818
  (sniffer$1.os.isIpad || sniffer$1.os.isPhone) && this.mediaPlay();
4715
4819
  }
4716
- if (readyState >= 2) {
4820
+ var startTime = this.config.startTime;
4821
+ this.__startTime = startTime > 0 ? startTime : -1;
4822
+ this.config.startTime = 0;
4823
+ if (readyState >= 2 && this.duration > 0) {
4717
4824
  this.canPlayFunc();
4718
4825
  } else {
4719
- this.once(CANPLAY, this.canPlayFunc);
4826
+ this.on(CANPLAY, this.canPlayFunc);
4720
4827
  }
4721
4828
  if (!this.hasStart || this.state < STATES.ATTACHED) {
4722
4829
  pluginsManager.afterInit(this);
@@ -4809,7 +4916,7 @@ var __publicField = (obj, key, value) => {
4809
4916
  }
4810
4917
  }, {
4811
4918
  key: "registerPlugin",
4812
- value: function registerPlugin(plugin, config) {
4919
+ value: function registerPlugin2(plugin, config) {
4813
4920
  var _retPlugin = pluginsManager.formatPluginInfo(plugin, config);
4814
4921
  var PLUFGIN = _retPlugin.PLUFGIN, options = _retPlugin.options;
4815
4922
  var plugins = this.config.plugins;
@@ -4958,6 +5065,7 @@ var __publicField = (obj, key, value) => {
4958
5065
  }
4959
5066
  _src = this.preProcessUrl(_src).url;
4960
5067
  var curTime = this.currentTime;
5068
+ this.__startTime = curTime;
4961
5069
  var isPaused = this.paused && !this.isError;
4962
5070
  this.src = _src;
4963
5071
  return new Promise(function(resolve, reject) {
@@ -4967,7 +5075,10 @@ var __publicField = (obj, key, value) => {
4967
5075
  reject(e2);
4968
5076
  };
4969
5077
  var _canplay = function _canplay2() {
4970
- _this9.currentTime = curTime;
5078
+ if (_this9.duration > 0 && _this9.__startTime > 0) {
5079
+ _this9.currentTime = _this9.__startTime;
5080
+ _this9.__startTime = -1;
5081
+ }
4971
5082
  if (isPaused) {
4972
5083
  _this9.pause();
4973
5084
  }
@@ -5194,7 +5305,7 @@ var __publicField = (obj, key, value) => {
5194
5305
  clsList.forEach(function(cls) {
5195
5306
  _this16.removeClass(cls);
5196
5307
  });
5197
- this.addClass(STATE_CLASS.ENTER);
5308
+ this.addClass(STATE_CLASS.NO_START);
5198
5309
  this.emit(RESET);
5199
5310
  }
5200
5311
  }, {
@@ -5223,7 +5334,7 @@ var __publicField = (obj, key, value) => {
5223
5334
  }, {
5224
5335
  key: "destroy",
5225
5336
  value: function destroy() {
5226
- var _this18 = this;
5337
+ var _instManager2, _this18 = this;
5227
5338
  var innerContainer = this.innerContainer, root2 = this.root, media = this.media;
5228
5339
  if (!root2 || !media) {
5229
5340
  return;
@@ -5236,6 +5347,7 @@ var __publicField = (obj, key, value) => {
5236
5347
  this._detachSourceEvents(this.media);
5237
5348
  util$1.clearAllTimers(this);
5238
5349
  this.emit(DESTROY);
5350
+ (_instManager2 = instManager) === null || _instManager2 === void 0 ? void 0 : _instManager2.remove(this);
5239
5351
  pluginsManager.destroy(this);
5240
5352
  delHooksDescriptor(this);
5241
5353
  _get(_getPrototypeOf(Player2.prototype), "destroy", this).call(this);
@@ -5587,6 +5699,14 @@ var __publicField = (obj, key, value) => {
5587
5699
  this.isCanplay = true;
5588
5700
  this.waitTimer && util$1.clearTimeout(this, this.waitTimer);
5589
5701
  }
5702
+ }, {
5703
+ key: "onDurationchange",
5704
+ value: function onDurationchange() {
5705
+ if (this.__startTime > 0 && this.duration > 0) {
5706
+ this.currentTime = this.__startTime;
5707
+ this.__startTime = -1;
5708
+ }
5709
+ }
5590
5710
  }, {
5591
5711
  key: "onLoadeddata",
5592
5712
  value: function onLoadeddata() {
@@ -5764,8 +5884,9 @@ var __publicField = (obj, key, value) => {
5764
5884
  }, {
5765
5885
  key: "resizePosition",
5766
5886
  value: function resizePosition() {
5767
- var _this$videoPos = this.videoPos, rotate = _this$videoPos.rotate, vy = _this$videoPos.vy, vx = _this$videoPos.vx, h2 = _this$videoPos.h, w2 = _this$videoPos.w;
5768
- if (rotate < 0 && !vy && !vx) {
5887
+ var _this$videoPos = this.videoPos, vy = _this$videoPos.vy, vx = _this$videoPos.vx, h2 = _this$videoPos.h, w2 = _this$videoPos.w;
5888
+ var rotate = this.videoPos.rotate;
5889
+ if (rotate < 0 && h2 < 0 && w2 < 0) {
5769
5890
  return;
5770
5891
  }
5771
5892
  var _pi = this.videoPos._pi;
@@ -5776,6 +5897,7 @@ var __publicField = (obj, key, value) => {
5776
5897
  return;
5777
5898
  }
5778
5899
  this.videoPos.pi = _pi;
5900
+ rotate = rotate < 0 ? 0 : rotate;
5779
5901
  var _pos = {
5780
5902
  rotate
5781
5903
  };
@@ -6208,7 +6330,8 @@ var __publicField = (obj, key, value) => {
6208
6330
  }
6209
6331
  }, {
6210
6332
  key: "setUserActive",
6211
- value: function setUserActive(isActive, isMuted) {
6333
+ value: function setUserActive(isActive) {
6334
+ var isMuted = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
6212
6335
  if (typeof isMuted === "boolean" && isMuted !== this.muted) {
6213
6336
  this.addInnerOP("volumechange");
6214
6337
  this.muted = isMuted;
@@ -6223,15 +6346,25 @@ var __publicField = (obj, key, value) => {
6223
6346
  set: function set(value) {
6224
6347
  XG_DEBUG.config.debug = value;
6225
6348
  }
6349
+ }, {
6350
+ key: "instManager",
6351
+ get: function get() {
6352
+ return instManager;
6353
+ },
6354
+ set: function set(value) {
6355
+ instManager = value;
6356
+ }
6226
6357
  }, {
6227
6358
  key: "getCurrentUserActivePlayerId",
6228
6359
  value: function getCurrentUserActivePlayerId() {
6229
- return pluginsManager.getCurrentUseActiveId();
6360
+ var _instManager3;
6361
+ return (_instManager3 = instManager) === null || _instManager3 === void 0 ? void 0 : _instManager3.getActiveId();
6230
6362
  }
6231
6363
  }, {
6232
6364
  key: "setCurrentUserActive",
6233
6365
  value: function setCurrentUserActive(playerId, isActive) {
6234
- pluginsManager.setCurrentUserActive(playerId, isActive);
6366
+ var _instManager4;
6367
+ (_instManager4 = instManager) === null || _instManager4 === void 0 ? void 0 : _instManager4.setActive(playerId, isActive);
6235
6368
  }
6236
6369
  }, {
6237
6370
  key: "isHevcSupported",
@@ -6266,6 +6399,7 @@ var __publicField = (obj, key, value) => {
6266
6399
  }(MediaProxy);
6267
6400
  _defineProperty$1(Player, "defaultPreset", null);
6268
6401
  _defineProperty$1(Player, "XgVideoProxy", null);
6402
+ Player.instManager = InstManager.getInstance();
6269
6403
  var index_min = "";
6270
6404
  var Level = /* @__PURE__ */ ((Level2) => {
6271
6405
  Level2["Fatal"] = "Fatal";
@@ -6408,6 +6542,14 @@ var __publicField = (obj, key, value) => {
6408
6542
  messageTextKey: "MODULE_LOAD_ERROR",
6409
6543
  level: "Fatal"
6410
6544
  /* Fatal */
6545
+ },
6546
+ [
6547
+ 7100
6548
+ /* DRM_LICENSE */
6549
+ ]: {
6550
+ messageTextKey: "DRM_LICENSE",
6551
+ level: "Fatal"
6552
+ /* Fatal */
6411
6553
  }
6412
6554
  };
6413
6555
  const ERROR_TYPE_INFO = {
@@ -6477,7 +6619,12 @@ var __publicField = (obj, key, value) => {
6477
6619
  }
6478
6620
  };
6479
6621
  let VeError$1 = class VeError extends Error {
6480
- /**
6622
+ /** {zh}
6623
+ * @hidden
6624
+ * @param error
6625
+ * @param i18n
6626
+ */
6627
+ /** {en}
6481
6628
  * @hidden
6482
6629
  * @param error
6483
6630
  * @param i18n
@@ -6490,16 +6637,25 @@ var __publicField = (obj, key, value) => {
6490
6637
  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"));
6491
6638
  super(message);
6492
6639
  /**
6493
- * @brief 错误码,对应[错误码字典](#错误码)。
6640
+ * @brief 错误码。
6641
+ */
6642
+ /** {en}
6643
+ * @brief The error code.
6494
6644
  */
6495
6645
  __publicField(this, "errorCode");
6496
- /**
6646
+ /** {zh}
6497
6647
  * @brief 错误等级。
6498
6648
  */
6649
+ /** {en}
6650
+ * @brief The error level.
6651
+ */
6499
6652
  __publicField(this, "level");
6500
- /**
6653
+ /** {zh}
6501
6654
  * @brief 其他错误信息。
6502
6655
  */
6656
+ /** {en}
6657
+ * @brief Other error messages.
6658
+ */
6503
6659
  __publicField(this, "ext");
6504
6660
  this.errorCode = (errorInfo == null ? void 0 : errorInfo.errorCode) ?? "UNKNOWN";
6505
6661
  this.level = (errorInfo == null ? void 0 : errorInfo.level) ?? "Error";
@@ -6563,7 +6719,7 @@ var __publicField = (obj, key, value) => {
6563
6719
  }
6564
6720
  }, {
6565
6721
  key: "show",
6566
- value: function show() {
6722
+ value: function show(value) {
6567
6723
  util$1.removeClass(this.root, "hide");
6568
6724
  }
6569
6725
  }, {
@@ -6642,10 +6798,11 @@ var __publicField = (obj, key, value) => {
6642
6798
  }, {
6643
6799
  key: "render",
6644
6800
  value: function render() {
6645
- var _this$config = this.config, poster = _this$config.poster, hideCanplay = _this$config.hideCanplay, fillMode = _this$config.fillMode;
6801
+ var _this$config = this.config, poster = _this$config.poster, hideCanplay = _this$config.hideCanplay, fillMode = _this$config.fillMode, notHidden = _this$config.notHidden;
6646
6802
  var _bg = this.getBgSize(fillMode);
6647
6803
  var style = poster ? "background-image:url(".concat(poster, ");").concat(_bg) : _bg;
6648
- return '<xg-poster class="xgplayer-poster '.concat(hideCanplay ? "xg-showplay" : "", '" style="').concat(style, '">\n </xg-poster>');
6804
+ var className = notHidden ? "xg-not-hidden" : hideCanplay ? "xg-showplay" : "";
6805
+ return '<xg-poster class="xgplayer-poster '.concat(className, '" style="').concat(style, '">\n </xg-poster>');
6649
6806
  }
6650
6807
  }], [{
6651
6808
  key: "pluginName",
@@ -6658,6 +6815,7 @@ var __publicField = (obj, key, value) => {
6658
6815
  return {
6659
6816
  isEndedShow: true,
6660
6817
  hideCanplay: false,
6818
+ notHidden: false,
6661
6819
  poster: "",
6662
6820
  fillMode: "fixWidth"
6663
6821
  };
@@ -6801,7 +6959,7 @@ var __publicField = (obj, key, value) => {
6801
6959
  }
6802
6960
  }, {
6803
6961
  key: "show",
6804
- value: function show() {
6962
+ value: function show(value) {
6805
6963
  util$1.removeClass(this.root, "hide");
6806
6964
  }
6807
6965
  }, {
@@ -7763,14 +7921,14 @@ var __publicField = (obj, key, value) => {
7763
7921
  key: "initEvents",
7764
7922
  value: function initEvents() {
7765
7923
  var _this3 = this;
7766
- var _this$player = this.player, video = _this$player.video, root2 = _this$player.root;
7924
+ var _this$player = this.player, media = _this$player.media, root2 = _this$player.root;
7767
7925
  var enableContextmenu = this.playerConfig.enableContextmenu;
7768
7926
  root2 && root2.addEventListener("click", this.onVideoClick, false);
7769
7927
  root2 && root2.addEventListener("dblclick", this.onVideoDblClick, false);
7770
7928
  Object.keys(MOUSE_EVENTS).map(function(item) {
7771
7929
  root2.addEventListener(item, _this3[MOUSE_EVENTS[item]], false);
7772
7930
  });
7773
- enableContextmenu && video && video.addEventListener("contextmenu", this.onContextmenu, false);
7931
+ !enableContextmenu && media && media.addEventListener("contextmenu", this.onContextmenu, false);
7774
7932
  }
7775
7933
  }, {
7776
7934
  key: "switchPlayPause",
@@ -9494,16 +9652,6 @@ var __publicField = (obj, key, value) => {
9494
9652
  }
9495
9653
  }
9496
9654
  }
9497
- }, {
9498
- key: "show",
9499
- value: function show() {
9500
- _get(_getPrototypeOf(Fullscreen2.prototype), "show", this).call(this);
9501
- }
9502
- }, {
9503
- key: "hide",
9504
- value: function hide() {
9505
- _get(_getPrototypeOf(Fullscreen2.prototype), "hide", this).call(this);
9506
- }
9507
9655
  }, {
9508
9656
  key: "render",
9509
9657
  value: function render() {
@@ -9959,11 +10107,14 @@ var __publicField = (obj, key, value) => {
9959
10107
  }, 0);
9960
10108
  !paused && player.mediaPlay();
9961
10109
  _this3.setAttr("data-state", "normal");
10110
+ _this3.pipWindow = null;
9962
10111
  player.emit(PIP_CHANGE, false);
9963
10112
  };
9964
10113
  this.enterPIPCallback = function(e2) {
9965
10114
  player.emit(PIP_CHANGE, true);
9966
- _this3.pipWindow = e2.pictureInPictureWindow;
10115
+ if (e2 !== null && e2 !== void 0 && e2.pictureInPictureWindow) {
10116
+ _this3.pipWindow = e2.pictureInPictureWindow;
10117
+ }
9967
10118
  _this3.setAttr("data-state", "pip");
9968
10119
  };
9969
10120
  this.onWebkitpresentationmodechanged = function(e2) {
@@ -9984,10 +10135,33 @@ var __publicField = (obj, key, value) => {
9984
10135
  PIP2.checkWebkitSetPresentationMode(player.media) && player.media.addEventListener("webkitpresentationmodechanged", this.onWebkitpresentationmodechanged);
9985
10136
  }
9986
10137
  }
10138
+ }, {
10139
+ key: "copyStyleIntoPiPWindow",
10140
+ value: function copyStyleIntoPiPWindow(pipWin) {
10141
+ var textContent = _toConsumableArray(document.styleSheets).map(function(style2) {
10142
+ try {
10143
+ return _toConsumableArray(style2.cssRules).map(function(rule) {
10144
+ return rule.cssText;
10145
+ }).join("");
10146
+ } catch (e2) {
10147
+ var link = document.createElement("link");
10148
+ link.rel = "stylesheet";
10149
+ link.type = style2.type;
10150
+ link.media = style2.media;
10151
+ link.href = style2.href;
10152
+ pipWin.document.head.appendChild(link);
10153
+ }
10154
+ return "";
10155
+ }).filter(Boolean).join("\n");
10156
+ var style = document.createElement("style");
10157
+ style.textContent = textContent;
10158
+ pipWin.document.head.appendChild(style);
10159
+ }
9987
10160
  }, {
9988
10161
  key: "requestPIP",
9989
10162
  value: function requestPIP() {
9990
- var player = this.player, playerConfig = this.playerConfig;
10163
+ var _this4 = this;
10164
+ var player = this.player, playerConfig = this.playerConfig, config = this.config;
9991
10165
  if (!this.isPIPAvailable() || this.isPip) {
9992
10166
  return;
9993
10167
  }
@@ -9996,7 +10170,62 @@ var __publicField = (obj, key, value) => {
9996
10170
  if (poster) {
9997
10171
  player.media.poster = util$1.typeOf(poster) === "String" ? poster : poster.poster;
9998
10172
  }
9999
- PIP2.checkWebkitSetPresentationMode(player.media) ? player.media.webkitSetPresentationMode("picture-in-picture") : player.media.requestPictureInPicture();
10173
+ if (config.preferDocument && this.isDocPIPAvailable()) {
10174
+ var pipOptions = {};
10175
+ if (config.width && config.height) {
10176
+ pipOptions.width = config.width;
10177
+ pipOptions.height = config.height;
10178
+ } else {
10179
+ var playerRect = player.root.getBoundingClientRect();
10180
+ pipOptions.width = playerRect.width;
10181
+ pipOptions.height = playerRect.height;
10182
+ }
10183
+ documentPictureInPicture.requestWindow(pipOptions).then(function(pipWin) {
10184
+ var docPiPNode = config.docPiPNode, docPiPStyle = config.docPiPStyle;
10185
+ _this4.enterPIPCallback();
10186
+ var pipRoot = docPiPNode || player.root;
10187
+ var parentNode = pipRoot.parentElement;
10188
+ var previousSibling = pipRoot.previousSibling;
10189
+ var nextSibling = pipRoot.nextSibling;
10190
+ _this4.copyStyleIntoPiPWindow(pipWin);
10191
+ var styles = document.createElement("style");
10192
+ styles.append("body{padding:0; margin:0;}");
10193
+ if (docPiPStyle) {
10194
+ var cssContent = "";
10195
+ if (typeof docPiPStyle === "string") {
10196
+ cssContent = docPiPStyle;
10197
+ } else if (typeof docPiPStyle === "function") {
10198
+ cssContent = docPiPStyle.call(config);
10199
+ }
10200
+ if (cssContent) {
10201
+ styles.append(cssContent);
10202
+ }
10203
+ } else if (pipRoot === player.root) {
10204
+ styles.append("\n .xgplayer{width: 100%!important; height: 100%!important;}\n ");
10205
+ }
10206
+ pipWin.document.head.append(styles);
10207
+ pipWin.document.body.append(pipRoot);
10208
+ pipWin.addEventListener("pagehide", function(event) {
10209
+ if (parentNode) {
10210
+ if (nextSibling) {
10211
+ parentNode.insertBefore(pipRoot, nextSibling);
10212
+ } else if (previousSibling) {
10213
+ parentNode.insertBefore(pipRoot, previousSibling.nextSibling);
10214
+ } else {
10215
+ parentNode.appendChild(pipRoot);
10216
+ }
10217
+ } else {
10218
+ }
10219
+ _this4.leavePIPCallback();
10220
+ }, {
10221
+ once: true
10222
+ });
10223
+ });
10224
+ } else if (PIP2.checkWebkitSetPresentationMode(player.media)) {
10225
+ player.media.webkitSetPresentationMode("picture-in-picture");
10226
+ } else {
10227
+ player.media.requestPictureInPicture();
10228
+ }
10000
10229
  return true;
10001
10230
  } catch (reason) {
10002
10231
  console.error("requestPiP", reason);
@@ -10009,7 +10238,14 @@ var __publicField = (obj, key, value) => {
10009
10238
  var player = this.player;
10010
10239
  try {
10011
10240
  if (this.isPIPAvailable() && this.isPip) {
10012
- PIP2.checkWebkitSetPresentationMode(player.media) ? player.media.webkitSetPresentationMode("inline") : document.exitPictureInPicture();
10241
+ var _documentPictureInPic;
10242
+ if (this.isDocPIPAvailable() && (_documentPictureInPic = documentPictureInPicture) !== null && _documentPictureInPic !== void 0 && _documentPictureInPic.window) {
10243
+ documentPictureInPicture.window.close();
10244
+ } else if (PIP2.checkWebkitSetPresentationMode(player.media)) {
10245
+ player.media.webkitSetPresentationMode("inline");
10246
+ } else {
10247
+ document.exitPictureInPicture();
10248
+ }
10013
10249
  }
10014
10250
  return true;
10015
10251
  } catch (reason) {
@@ -10020,15 +10256,21 @@ var __publicField = (obj, key, value) => {
10020
10256
  }, {
10021
10257
  key: "isPip",
10022
10258
  get: function get() {
10259
+ var _documentPictureInPic2;
10023
10260
  var player = this.player;
10024
- return document.pictureInPictureElement && document.pictureInPictureElement === player.media || player.media.webkitPresentationMode === PresentationMode.PIP;
10261
+ return !!(this.isDocPIPAvailable() && (_documentPictureInPic2 = documentPictureInPicture) !== null && _documentPictureInPic2 !== void 0 && _documentPictureInPic2.window) || document.pictureInPictureElement && document.pictureInPictureElement === player.media || player.media.webkitPresentationMode === PresentationMode.PIP;
10025
10262
  }
10026
10263
  }, {
10027
10264
  key: "isPIPAvailable",
10028
10265
  value: function isPIPAvailable() {
10029
10266
  var video = this.player.media;
10030
10267
  var _isEnabled = util$1.typeOf(document.pictureInPictureEnabled) === "Boolean" ? document.pictureInPictureEnabled : true;
10031
- return _isEnabled && (util$1.typeOf(video.disablePictureInPicture) === "Boolean" && !video.disablePictureInPicture || video.webkitSupportsPresentationMode && util$1.typeOf(video.webkitSetPresentationMode) === "Function");
10268
+ return _isEnabled && (util$1.typeOf(video.disablePictureInPicture) === "Boolean" && !video.disablePictureInPicture || video.webkitSupportsPresentationMode && util$1.typeOf(video.webkitSetPresentationMode) === "Function") || this.isDocPIPAvailable();
10269
+ }
10270
+ }, {
10271
+ key: "isDocPIPAvailable",
10272
+ value: function isDocPIPAvailable() {
10273
+ return "documentPictureInPicture" in window && /^(https|file)/.test(location.protocol);
10032
10274
  }
10033
10275
  }, {
10034
10276
  key: "destroy",
@@ -10060,7 +10302,12 @@ var __publicField = (obj, key, value) => {
10060
10302
  return {
10061
10303
  position: POSITIONS$2.CONTROLS_RIGHT,
10062
10304
  index: 6,
10063
- showIcon: false
10305
+ showIcon: false,
10306
+ preferDocument: false,
10307
+ width: void 0,
10308
+ height: void 0,
10309
+ docPiPNode: void 0,
10310
+ docPiPStyle: void 0
10064
10311
  };
10065
10312
  }
10066
10313
  }, {
@@ -12128,7 +12375,7 @@ var __publicField = (obj, key, value) => {
12128
12375
  }
12129
12376
  this._waitingStartTime = Date.now();
12130
12377
  const currentTime = this.player.currentTime;
12131
- this._timer = setTimeout(() => {
12378
+ this._timer = window.setTimeout(() => {
12132
12379
  if (this.player && this.player.currentTime <= currentTime + 0.1) {
12133
12380
  this.player.emit(Events$1.LONG_WAITING);
12134
12381
  if (this.config.needFallback) {
@@ -12233,7 +12480,8 @@ var __publicField = (obj, key, value) => {
12233
12480
  "plugin:hls": "veplayer.plugin.hls.[env].[ext]",
12234
12481
  "plugin:shaka": "veplayer.plugin.shaka.[env].[ext]",
12235
12482
  "plugin:rtm": "veplayer.plugin.rtm.[env].[ext]",
12236
- "plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]"
12483
+ "plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]",
12484
+ "plugin:drm": "veplayer.plugin.drm.[env].[ext]"
12237
12485
  };
12238
12486
  var DynamicModule = /* @__PURE__ */ ((DynamicModule2) => {
12239
12487
  DynamicModule2["BizVod"] = "biz:vod";
@@ -12244,6 +12492,7 @@ var __publicField = (obj, key, value) => {
12244
12492
  DynamicModule2["PluginShaka"] = "plugin:shaka";
12245
12493
  DynamicModule2["PluginRtm"] = "plugin:rtm";
12246
12494
  DynamicModule2["PluginXgvideo"] = "plugin:xgvideo";
12495
+ DynamicModule2["PluginDrm"] = "plugin:drm";
12247
12496
  return DynamicModule2;
12248
12497
  })(DynamicModule || {});
12249
12498
  class Loader {
@@ -12287,13 +12536,13 @@ var __publicField = (obj, key, value) => {
12287
12536
  src: src2 ?? moduleSrc,
12288
12537
  name,
12289
12538
  state: 0,
12290
- exports: {}
12539
+ exports: { __PLUGIN_NAME__: name }
12291
12540
  };
12292
12541
  this.modules[name] = module2;
12293
12542
  this.mountPromiseMap[name] = this._mount(module2);
12294
12543
  return this.mountPromiseMap[name];
12295
12544
  });
12296
- __publicField(this, "register", (name, exports3) => {
12545
+ __publicField(this, "registerPlugin", (name, exports3) => {
12297
12546
  if (!this._moduleSystem) {
12298
12547
  throw new Error(
12299
12548
  `You have to specify moduleSystem first, call setModuleSystem(moduleSystem) to set module system`
@@ -12320,6 +12569,11 @@ var __publicField = (obj, key, value) => {
12320
12569
  }
12321
12570
  return this.modules[name].exports;
12322
12571
  });
12572
+ __publicField(this, "register", (exports3) => {
12573
+ return exports3.map((exportModule) => {
12574
+ return this.registerPlugin(exportModule.__PLUGIN_NAME__, exportModule);
12575
+ });
12576
+ });
12323
12577
  this._baseUrl = options.baseUrl;
12324
12578
  }
12325
12579
  get baseUrl() {
@@ -12359,6 +12613,7 @@ var __publicField = (obj, key, value) => {
12359
12613
  const loader = new Loader({
12360
12614
  baseUrl
12361
12615
  });
12616
+ const registerPlugin = loader.registerPlugin;
12362
12617
  const register = loader.register;
12363
12618
  function setModuleSystem(moduleSystem) {
12364
12619
  loader.setModuleSystem(moduleSystem);
@@ -12548,7 +12803,7 @@ var __publicField = (obj, key, value) => {
12548
12803
  }
12549
12804
  wxCanPlayFn() {
12550
12805
  window.WeixinJSBridge && window.WeixinJSBridge.invoke("getNetworkType", {}, () => {
12551
- this._wxTimer = setTimeout(() => {
12806
+ this._wxTimer = window.setTimeout(() => {
12552
12807
  this._wxTimer && clearTimeout(this._wxTimer);
12553
12808
  const ret = this.player.play();
12554
12809
  if (ret && ret.then) {
@@ -12622,8 +12877,8 @@ var __publicField = (obj, key, value) => {
12622
12877
  this._state.showUnmuteBt = true;
12623
12878
  this._state.mode = 1;
12624
12879
  this.renderUnmuteBt();
12625
- this._timer = setTimeout(() => {
12626
- this._timer && clearTimeout(this._timer);
12880
+ this._timer = window.setTimeout(() => {
12881
+ this._timer && window.clearTimeout(this._timer);
12627
12882
  const ret = this.player.play();
12628
12883
  if (ret && ret.then) {
12629
12884
  ret.then(() => {
@@ -13026,6 +13281,7 @@ var __publicField = (obj, key, value) => {
13026
13281
  MEDIA_ERR_CODEC_NOT_SUPPORTED: "Audio/video codec is not supported",
13027
13282
  MEDIA_ERR_URL_EMPTY: "The stream address is not specified",
13028
13283
  DRM: "Permission verification failed",
13284
+ DRM_LICENSE: "Commercial DRM Permission verification failed",
13029
13285
  OTHER: "Unknown error",
13030
13286
  RUNTIME: "An error occurred, Please try again",
13031
13287
  MODULE_LOAD_ERROR: "CDN fetch error",
@@ -13052,6 +13308,7 @@ var __publicField = (obj, key, value) => {
13052
13308
  MEDIA_ERR_CODEC_NOT_SUPPORTED: "不支持的音频/视频格式",
13053
13309
  MEDIA_ERR_URL_EMPTY: "当前播放地址为空",
13054
13310
  DRM: "权限验证失败",
13311
+ DRM_LICENSE: "商业 DRM LICENSE 鉴权失败",
13055
13312
  OTHER: "其他报错",
13056
13313
  RUNTIME: "播放异常,请重试",
13057
13314
  MODULE_LOAD_ERROR: "插件模块加载异常",
@@ -13147,7 +13404,10 @@ var __publicField = (obj, key, value) => {
13147
13404
  return xgOptions;
13148
13405
  };
13149
13406
  class VePlayerBase {
13150
- /**
13407
+ /** {zh}
13408
+ * @hidden
13409
+ */
13410
+ /** {en}
13151
13411
  * @hidden
13152
13412
  */
13153
13413
  constructor(options = {}) {
@@ -13200,7 +13460,7 @@ var __publicField = (obj, key, value) => {
13200
13460
  this._errorCallback = (err) => this._handleFallback(err);
13201
13461
  this._player.on(ERROR, this._errorCallback);
13202
13462
  }
13203
- /**
13463
+ /** {zh}
13204
13464
  * @brief 获取视频的就绪状态,其状态枚举值、枚举名称和说明如下:
13205
13465
  * - `0`:HAVE_NOTHING,没有关于媒体资源的可用信息
13206
13466
  * - `1`:HAVE_METADATA,已检索到足够多的媒体资源来初始化元数据, 快进/快退不会引发异常
@@ -13208,68 +13468,107 @@ var __publicField = (obj, key, value) => {
13208
13468
  * - `3`:HAVE_FUTURE_DATA,当前播放位置以及未来至少一小段时间的数据是可用的(至少有两帧以上的数据)
13209
13469
  * - `4`:HAVE_ENOUGH_DATA,有足够的数据可用,并且下载速率足够,媒体可以不间断地播放到最后
13210
13470
  */
13471
+ /** {en}
13472
+ * @brief Gets the readiness of the video.
13473
+ * - `0`: HAVE_NOTHING, which means there is no information about the media resources.
13474
+ * - `1`: HAVE_METADATA, which means enough media resources have been retrieved to initialize the metadata and fast-forward/rewind will not raise an exception.
13475
+ * - `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.
13476
+ * - `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).
13477
+ * - `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.
13478
+ */
13211
13479
  get readyState() {
13212
13480
  return this._player.readyState;
13213
13481
  }
13214
- /**
13482
+ /** {zh}
13215
13483
  * @brief 获取当前已缓冲的时间范围。
13216
13484
  */
13485
+ /** {en}
13486
+ * @brief Gets the currently buffered time range.
13487
+ */
13217
13488
  get buffered() {
13218
13489
  return this._player.buffered;
13219
13490
  }
13220
- /**
13491
+ /** {zh}
13221
13492
  * @brief 获取已经播放的音频/视频的时间范围。
13222
13493
  */
13494
+ /** {en}
13495
+ * @brief Gets the time range of the audio/video that has been played.
13496
+ */
13223
13497
  get played() {
13224
13498
  return this._player.played;
13225
13499
  }
13226
- /**
13500
+ /** {zh}
13227
13501
  * @brief 设置/获取视频当前的播放时间, 单位为 s。
13228
13502
  */
13503
+ /** {en}
13504
+ * @brief Sets or gets the current playback position of the video, in seconds.
13505
+ */
13229
13506
  get cumulateTime() {
13230
13507
  return this._player.cumulateTime;
13231
13508
  }
13232
- /**
13509
+ /** {zh}
13233
13510
  * @brief 获取是否处于焦点状态,处于焦点状态会显示控制栏。
13234
13511
  */
13512
+ /** {en}
13513
+ * @brief Gets whether the player has focus. The control bar is displayed when the player has focus.
13514
+ */
13235
13515
  get isFocused() {
13236
13516
  return this._player.isActive;
13237
13517
  }
13238
- /**
13518
+ /** {zh}
13239
13519
  * @brief 获取播放器是否处于全屏状态。
13240
13520
  */
13521
+ /** {en}
13522
+ * @brief Gets whether the player is in full-screen mode, in which the player covers the entire desktop.
13523
+ */
13241
13524
  get isFullscreen() {
13242
13525
  return this._player.isFullscreen;
13243
13526
  }
13244
- /**
13527
+ /** {zh}
13245
13528
  * @brief 获取播放器是否处于网页全屏状态。
13246
13529
  */
13530
+ /** {en}
13531
+ * @brief Gets whether the player is in full-window mode, in which the player covers the entire browser window.
13532
+ */
13247
13533
  get isCssFullscreen() {
13248
13534
  return this._player.isCssfullScreen;
13249
13535
  }
13250
- /**
13536
+ /** {zh}
13251
13537
  * @brief 获取视频的网络状态,其状态枚举值、枚举名称和说明如下:
13252
13538
  * - `0`:NETWORK_EMPTY,目前还没有数据,readyState 的值是 HAVE_NOTHING
13253
13539
  * - `1`:NETWORK_IDLE,HTMLMediaElement 处于活动状态并已选择资源,但未使用网络
13254
13540
  * - `2`:NETWORK_LOADING,浏览器正在下载 HTMLMediaElement 数据
13255
13541
  * - `3`:NETWORK_NO_SOURCE,未找到 HTMLMediaElement src。
13256
13542
  */
13543
+ /** {en}
13544
+ * @brief Gets the network condition of the video.
13545
+ * - `0`: NETWORK_EMPTY, which means there is no data yet, and `readyState` is `HAVE_NOTHING`.
13546
+ * - `1`: NETWORK_IDLE, which means the `HTMLMediaElement` element is active and the resources have been selected, but the network is not in use.
13547
+ * - `2`: NETWORK_LOADING, which means the browser is downloading the data of the `HTMLMediaElement` element.
13548
+ * - `3`: NETWORK_NO_SOURCE, the media source is not found according to the `src` property of the `HTMLMediaElement` element.
13549
+ */
13257
13550
  get networkState() {
13258
13551
  return this._player.networkState;
13259
13552
  }
13260
- /**
13553
+ /** {zh}
13261
13554
  * @brief 获取当前视频是否处于暂停状态。
13262
13555
  */
13556
+ /** {en}
13557
+ * @brief Gets whether the current video is suspended.
13558
+ */
13263
13559
  get paused() {
13264
13560
  return this._player.paused;
13265
13561
  }
13266
- /**
13562
+ /** {zh}
13267
13563
  * @brief 获取当前视频是否播放结束。
13268
13564
  */
13565
+ /** {en}
13566
+ * @brief Gets whether the current video has finished playing.
13567
+ */
13269
13568
  get ended() {
13270
13569
  return this._player.ended;
13271
13570
  }
13272
- /**
13571
+ /** {zh}
13273
13572
  * @brief 获取播放器当前所处的状态,其状态枚举值、枚举名称和说明如下:
13274
13573
  * - `0`:ERROR,播放出现错误
13275
13574
  * - `1`:INITIAL,初始化
@@ -13281,81 +13580,130 @@ var __publicField = (obj, key, value) => {
13281
13580
  * - `7`:ENDED,播放结束
13282
13581
  * - `8`:DESTROYED,播放器实例处于已被销毁
13283
13582
  */
13583
+ /** {en}
13584
+ * @brief Gets the current state of the player.
13585
+ * - `0`: ERROR, which means a playback error occurred
13586
+ * - `1`: INITIAL, which means initialization
13587
+ * - `2`: READY, which means the configuration/event/plug-in has been initialized/bound/instantiated
13588
+ * - `3`: ATTACHING, which means the media object is being mounted.
13589
+ * - `4`: ATTACHED, which means the media object has been mounted in the DOM
13590
+ * - `5`: NOTALLOW, which means the playback is blocked
13591
+ * - `6`: RUNNING, which means the playback has started successfully
13592
+ * - `7`: ENDED, which means the playback has ended
13593
+ * - `8`: DESTROYED, which means the player instance is destroyed
13594
+ */
13284
13595
  get state() {
13285
13596
  return this._player.state;
13286
13597
  }
13287
- /**
13598
+ /** {zh}
13288
13599
  * 获取当前播放视频的拉流地址。
13289
13600
  */
13601
+ /** {en}
13602
+ * Gets the current pull stream address.
13603
+ */
13290
13604
  get url() {
13291
13605
  return this._player.config.url;
13292
13606
  }
13293
- /**
13294
- * @brief 获取当播放视频的线路名称唯一标识(name)。
13607
+ /** {zh}
13608
+ * @brief 获取当前播放视频的线路名称唯一标识(name)。
13609
+ */
13610
+ /** {en}
13611
+ * @brief Gets the current playback source ID.
13295
13612
  */
13296
13613
  get source() {
13297
13614
  var _a;
13298
13615
  return (_a = this._sourceManager.source) == null ? void 0 : _a.name;
13299
13616
  }
13300
- /**
13617
+ /** {zh}
13301
13618
  * @brief 获取当前播放视频的清晰度唯一标识(definition)。
13302
13619
  */
13620
+ /** {en}
13621
+ * @brief Gets the current resolution ID.
13622
+ */
13303
13623
  get definition() {
13304
13624
  var _a;
13305
13625
  return (_a = this._sourceManager.definition) == null ? void 0 : _a.definition;
13306
13626
  }
13307
- /**
13627
+ /** {zh}
13308
13628
  * @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
13309
13629
  */
13630
+ /** {en}
13631
+ * @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).
13632
+ */
13310
13633
  get crossOrigin() {
13311
13634
  return this._player.crossOrigin;
13312
13635
  }
13313
- /**
13636
+ /** {zh}
13314
13637
  * @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
13315
13638
  */
13639
+ /** {en}
13640
+ * @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).
13641
+ */
13316
13642
  set crossOrigin(crossOrigin) {
13317
13643
  this._player.crossOrigin = crossOrigin;
13318
13644
  }
13319
- /**
13645
+ /** {zh}
13320
13646
  * @brief 获取和设置视频的音量,取值范围为 [0,1]。
13321
13647
  */
13648
+ /** {en}
13649
+ * @brief Gets the volume of the video. The value range is [0,1].
13650
+ */
13322
13651
  // eslint-disable-next-line @typescript-eslint/member-ordering
13323
13652
  get volume() {
13324
13653
  return this._player.volume;
13325
13654
  }
13326
- /**
13655
+ /** {zh}
13327
13656
  * @brief 获取和设置视频的音量,取值范围为 [0,1]。
13328
13657
  */
13658
+ /** {en}
13659
+ * @brief Sets the volume of the video. Valid range: [0,1].
13660
+ */
13329
13661
  set volume(volume) {
13330
13662
  this._player.volume = volume;
13331
13663
  }
13332
- /**
13664
+ /** {zh}
13333
13665
  * @brief 获取和设置视频静音状态。
13334
13666
  * - `true`:静音
13335
13667
  * - `false`:非静音
13336
13668
  */
13669
+ /** {en}
13670
+ * @brief Gets whether the video is muted.
13671
+ * - `true`: Muted.
13672
+ * - `false`: Not muted.
13673
+ */
13337
13674
  // eslint-disable-next-line @typescript-eslint/member-ordering
13338
13675
  get muted() {
13339
13676
  return this._player.muted;
13340
13677
  }
13341
- /**
13678
+ /** {zh}
13342
13679
  * @brief 获取和设置视频静音状态。
13343
13680
  * - `true`:静音
13344
13681
  * - `false`:非静音
13345
13682
  */
13683
+ /** {en}
13684
+ * @brief Mute or unmute the video.
13685
+ * - `true`: Mute the video.
13686
+ * - `false`: Unmute the video.
13687
+ */
13346
13688
  set muted(isMuted) {
13347
13689
  this._player.muted = isMuted;
13348
13690
  }
13349
- /**
13691
+ /** {zh}
13350
13692
  * @brief 获取和设置当前语言。
13351
13693
  */
13694
+ /** {en}
13695
+ * @brief Gets the current language.
13696
+ */
13352
13697
  // eslint-disable-next-line @typescript-eslint/member-ordering
13353
13698
  get lang() {
13354
13699
  return this._i18nManager.getLang();
13355
13700
  }
13356
- /**
13701
+ /** {zh}
13357
13702
  * @brief 获取和设置当前语言。
13358
13703
  */
13704
+ /** {en}
13705
+ * @brief Sets the current language.
13706
+ */
13359
13707
  set lang(lang) {
13360
13708
  var _a, _b;
13361
13709
  if (this._player.lang === lang) {
@@ -13377,7 +13725,10 @@ var __publicField = (obj, key, value) => {
13377
13725
  get _src() {
13378
13726
  return this._player.currentSrc;
13379
13727
  }
13380
- /**
13728
+ /** {zh}
13729
+ * @hidden
13730
+ */
13731
+ /** {en}
13381
13732
  * @hidden
13382
13733
  */
13383
13734
  static async create(options = {}, Constructor) {
@@ -13407,11 +13758,16 @@ var __publicField = (obj, key, value) => {
13407
13758
  sourceManager
13408
13759
  });
13409
13760
  }
13410
- /**
13761
+ /** {zh}
13411
13762
  * @brief 调用此方法切换拉流地址、线路、清晰度。
13412
13763
  * @param target 目标地址,可以是播放地址,也可以是线路和清晰度
13413
13764
  * @param options 更多配置信息
13414
13765
  */
13766
+ /** {en}
13767
+ * @brief Switches the pull stream address, playback source, or resolution.
13768
+ * @param target The target pull stream address, playback source, or resolution.
13769
+ * @param options More configurations.
13770
+ */
13415
13771
  async switch(target, options) {
13416
13772
  var _a, _b;
13417
13773
  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) {
@@ -13428,20 +13784,31 @@ var __publicField = (obj, key, value) => {
13428
13784
  await this._switch(targetDefinition);
13429
13785
  return targetDefinition;
13430
13786
  }
13431
- /**
13787
+ /** {zh}
13432
13788
  * @brief 调用此方法更新拉流地址列表。
13433
13789
  * @param playlist 要更新的播放列表。
13434
13790
  * @param target 更新后默认播放的资源。
13435
13791
  */
13792
+ /** {en}
13793
+ * @brief Updates the list of pull stream addresses.
13794
+ * @param Playlist The updated list.
13795
+ * @param Target The default playback resource after the update.
13796
+ */
13436
13797
  updatePlaylist(playlist, target) {
13437
13798
  const sourceManager = this._sourceManager.updateSources(playlist, target);
13438
13799
  return this._switch(sourceManager.definition);
13439
13800
  }
13440
13801
  // TODO: 等西瓜播放器完善错误码后增加函数重载以提供更好的类型
13441
13802
  /**
13803
+ /** {zh}
13442
13804
  * @brief 调用此方法监听指定事件,事件处理函数只执行一次。
13443
13805
  * @param event 表示事件的名称。
13444
- * @param callback 表示事件的名称。
13806
+ * @param callback 表示事件的回调函数。
13807
+ */
13808
+ /** {en}
13809
+ * @brief Listens for a specified event. The event handler is executed only once.
13810
+ * @param event The event name.
13811
+ * @param callback The callback function for the event.
13445
13812
  */
13446
13813
  once(event, callback) {
13447
13814
  var _a;
@@ -13454,10 +13821,15 @@ var __publicField = (obj, key, value) => {
13454
13821
  this._player.once(xgEventName, xgCallback);
13455
13822
  }
13456
13823
  }
13457
- /**
13824
+ /** {zh}
13458
13825
  * @brief 调用此方法解绑或移除指定事件的事件监听。
13459
13826
  * @param event 表示事件的名称。
13460
- * @param callback 表示事件的名称。
13827
+ * @param callback 表示事件的回调函数。
13828
+ */
13829
+ /** {en}
13830
+ * @brief Stops listening for a specified event.
13831
+ * @param event The event name.
13832
+ * @param callback The callback function for the event.
13461
13833
  */
13462
13834
  off(event, callback) {
13463
13835
  var _a;
@@ -13468,26 +13840,39 @@ var __publicField = (obj, key, value) => {
13468
13840
  this._events[event].delete(callback);
13469
13841
  }
13470
13842
  }
13471
- /**
13843
+ /** {zh}
13472
13844
  * @brief 调用此方法触发指定事件。
13473
13845
  * @param event 表示事件的名称。
13474
13846
  * @param data 事件信息。
13475
13847
  */
13848
+ /** {en}
13849
+ * @brief Triggers a specified event.
13850
+ * @param event The event name.
13851
+ * @param data The event information.
13852
+ */
13476
13853
  emit(event, data) {
13477
13854
  const { xgEventName } = this._transformEvent(event);
13478
13855
  this._player.emit(xgEventName, data);
13479
13856
  }
13480
- /**
13857
+ /** {zh}
13481
13858
  * @brief 调用此方法解绑或移除指定事件的所有事件监听。
13482
13859
  */
13860
+ /** {en}
13861
+ * @brief Stops listening to any player event.
13862
+ */
13483
13863
  offAll() {
13484
13864
  this._events = {};
13485
13865
  this._player.offAll();
13486
13866
  }
13487
- /**
13867
+ /** {zh}
13488
13868
  * @brief 调用此方法监听指定事件。
13489
- * @param event 事件。
13490
- * @param callback 事件回调。
13869
+ * @param event 表示事件名称。
13870
+ * @param callback 表示事件的回调函数。
13871
+ */
13872
+ /** {en}
13873
+ * @brief Listens for a specified event.
13874
+ * @param event The event name.
13875
+ * @param callback The callback function for the event.
13491
13876
  */
13492
13877
  on(event, callback) {
13493
13878
  var _a;
@@ -13500,102 +13885,153 @@ var __publicField = (obj, key, value) => {
13500
13885
  this._player.on(xgEventName, xgCallback);
13501
13886
  }
13502
13887
  }
13503
- /**
13888
+ /** {zh}
13504
13889
  * @brief 调用此方法开始播放 。
13505
13890
  */
13891
+ /** {en}
13892
+ * @brief Starts playback.
13893
+ */
13506
13894
  play() {
13507
13895
  /* istanbul ignore next -- @preserve */
13508
13896
  return this._player.play();
13509
13897
  }
13510
- /**
13898
+ /** {zh}
13511
13899
  * @brief 调用此方法暂停播放。
13512
13900
  */
13901
+ /** {en}
13902
+ * @brief Pauses playback.
13903
+ */
13513
13904
  pause() {
13514
13905
  /* istanbul ignore next -- @preserve */
13515
13906
  return this._player.pause();
13516
13907
  }
13517
- /**
13908
+ /** {zh}
13518
13909
  * @brief 调用此方法打开画中画。
13519
13910
  */
13911
+ /** {en}
13912
+ * @brief Turns on Picture-in-Picture (PIP).
13913
+ */
13520
13914
  requestPIP() {
13521
13915
  var _a;
13522
13916
  /* istanbul ignore next -- @preserve */
13523
13917
  (_a = this._player.plugins.pip) == null ? void 0 : _a.requestPIP();
13524
13918
  }
13525
- /**
13919
+ /** {zh}
13526
13920
  * @brief 调用此方法关闭画中画。
13527
13921
  */
13922
+ /** {en}
13923
+ * @brief Turns off Picture-in-Picture (PIP).
13924
+ */
13528
13925
  exitPIP() {
13529
13926
  var _a;
13530
13927
  /* istanbul ignore next -- @preserve */
13531
13928
  (_a = this._player.plugins.pip) == null ? void 0 : _a.exitPIP();
13532
13929
  }
13533
- /**
13930
+ /** {zh}
13534
13931
  * @brief 调用此方法重新拉流。
13535
13932
  */
13933
+ /** {en}
13934
+ * @brief Retries stream-pulling.
13935
+ */
13536
13936
  retry() {
13537
13937
  return this._player.retry();
13538
13938
  }
13539
- /**
13939
+ /** {zh}
13540
13940
  * @brief 播放器获取焦点,调用该方法 `veplayer.isFocused` 将会变为 `true`,并触发 `PLAYER_FOCUS` 事件。
13541
13941
  * @param data 播放器获取焦点配置信息。
13542
13942
  */
13943
+ /** {en}
13944
+ * @brief The player gets focus. When the method is called, `veplayer.isFocused` will become `true` and the `PLAYER_FOCUS` event will be triggered.
13945
+ * @param data Related configurations.
13946
+ */
13543
13947
  focus(data) {
13544
13948
  return this._player.focus(data);
13545
13949
  }
13546
- /**
13950
+ /** {zh}
13547
13951
  * @brief 播放器失去焦点,调用该方法 `veplayer.isFocused` 将会变为 `false`,并触发 `PLAYER_BLUR` 事件。
13548
13952
  * @param data 播放器失去焦点配置信息。
13549
13953
  */
13954
+ /** {en}
13955
+ * @brief The player loses focus. When the method is called, `veplayer.isFocused` will become `false` and the `PLAYER_BLUR` event will be triggered.
13956
+ * @param data The related configurations.
13957
+ */
13550
13958
  blur(data) {
13551
13959
  return this._player.blur(data);
13552
13960
  }
13553
- /**
13961
+ /** {zh}
13554
13962
  * @brief 调用此方法进入系统全屏状态。如果该方法调用的时候处于网页全屏状态会自动退出网页全屏,下发事件 `Events.FULLSCREEN_CHANGE`。
13555
13963
  * @param el 全屏作用的 DOM 节点。
13556
13964
  */
13965
+ /** {en}
13966
+ * @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.
13967
+ * @param el The DOM node in which the player is displayed in full-screen mode.
13968
+ */
13557
13969
  requestFullscreen(el) {
13558
13970
  return this._player.getFullscreen(el);
13559
13971
  }
13560
- /**
13972
+ /** {zh}
13561
13973
  * @brief 调用此方法退出系统全屏状态,调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.FULLSCREEN_CHANGE` 事件。
13562
13974
  * @param el 全屏作用的 DOM 节点。
13563
13975
  */
13976
+ /** {en}
13977
+ * @brief Exits full-screen mode. After the method is called, `veplayer.isFullscreen` will become `false` and the `Events.FULLSCREEN_CHANGE` event will be triggered.
13978
+ * @param el The DOM node of the full screen effect.
13979
+ */
13564
13980
  exitFullscreen(el) {
13565
13981
  return this._player.exitFullscreen(el);
13566
13982
  }
13567
- /**
13983
+ /** {zh}
13568
13984
  * @brief 调用此方法进入网页样式全屏状态,播放器进入网页全屏,利用 CSS 模拟实现全屏效果。如果该接口调用的时候处于全屏状态,会自动退出全屏,下发事件 `Events.CSS_FULLSCREEN_CHANGE`。
13569
13985
  * @param el 全屏作用的 DOM 节点。
13570
13986
  */
13987
+ /** {en}
13988
+ * @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.
13989
+ * @param el The DOM node in which the player is displayed in full-window mode.
13990
+ */
13571
13991
  requestCssFullscreen(el) {
13572
13992
  return this._player.getCssFullscreen(el);
13573
13993
  }
13574
- /**
13994
+ /** {zh}
13575
13995
  * @brief 调用此方法退出网页样式全屏状态。 调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.CSS_FULLSCREEN_CHANGE` 事件。
13576
13996
  */
13997
+ /** {en}
13998
+ * @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.
13999
+ */
13577
14000
  exitCssFullscreen() {
13578
14001
  return this._player.exitCssFullscreen();
13579
14002
  }
13580
- /**
14003
+ /** {zh}
13581
14004
  * @brief 调用此方法在当前播放器上注册指定插件。
13582
14005
  * @param plugin 插件构造函数。
13583
14006
  * @param config 插件的配置列表。
13584
14007
  */
14008
+ /** {en}
14009
+ * @brief Registers a specified plug-in to the current player.
14010
+ * @param Plugin The plugin constructor.
14011
+ * @param config The plugin configurations.
14012
+ */
13585
14013
  registerPlugin(plugin, config) {
13586
14014
  return this._player.registerPlugin(plugin, config);
13587
14015
  }
13588
- /**
14016
+ /** {zh}
13589
14017
  * @brief 调用此方法在当前播放器上销毁/注销指定插件。
13590
14018
  * @param plugin 插件实例或者插件名称。
13591
14019
  */
14020
+ /** {en}
14021
+ * @brief Destroys or unregisters a specified plugin from the player.
14022
+ * @param Plugin The plugin instance or name.
14023
+ */
13592
14024
  unRegisterPlugin(plugin) {
13593
14025
  return this._player.unRegisterPlugin(plugin);
13594
14026
  }
13595
- /**
14027
+ /** {zh}
13596
14028
  * @brief 调用此接口显示指定插件图标。
13597
14029
  * @param pluginNames 插件名称
13598
14030
  */
14031
+ /** {en}
14032
+ * @brief Displays the icon of a specified plugin.
14033
+ * @param PluginNames The plugin name.
14034
+ */
13599
14035
  showIcon(pluginNames) {
13600
14036
  const morePlugin = this._player.getPlugin("more");
13601
14037
  pluginNames.forEach((pluginName) => {
@@ -13609,10 +14045,14 @@ var __publicField = (obj, key, value) => {
13609
14045
  }
13610
14046
  });
13611
14047
  }
13612
- /**
14048
+ /** {zh}
13613
14049
  * @brief 调用此接口隐藏指定插件图标。
13614
14050
  * @param pluginNames 插件名称
13615
14051
  */
14052
+ /** {en}
14053
+ * @brief Hides the icon of a specified plugin.
14054
+ * @param PluginNames The plugin name.
14055
+ */
13616
14056
  hideIcon(pluginNames) {
13617
14057
  const morePlugin = this._player.getPlugin("more");
13618
14058
  pluginNames.forEach((pluginName) => {
@@ -13626,14 +14066,20 @@ var __publicField = (obj, key, value) => {
13626
14066
  }
13627
14067
  });
13628
14068
  }
13629
- /**
14069
+ /** {zh}
13630
14070
  * @brief 调用此方法销毁播放器实例。
13631
14071
  */
14072
+ /** {en}
14073
+ * @brief Destroys the player instance.
14074
+ */
13632
14075
  destroy() {
13633
14076
  this._player.off(ERROR, this._errorCallback);
13634
14077
  this._player.destroy();
13635
14078
  }
13636
- /**
14079
+ /** {zh}
14080
+ * @hidden
14081
+ */
14082
+ /** {en}
13637
14083
  * @hidden
13638
14084
  */
13639
14085
  async prepare(url) {
@@ -18559,6 +19005,29 @@ var __publicField = (obj, key, value) => {
18559
19005
  plugins: rtmCdn ? [rtmCdn] : []
18560
19006
  };
18561
19007
  };
19008
+ var DrmType = /* @__PURE__ */ ((DrmType2) => {
19009
+ DrmType2["Fairplay"] = "fairplay";
19010
+ return DrmType2;
19011
+ })(DrmType || {});
19012
+ function getDrmType(drm) {
19013
+ if ((drm == null ? void 0 : drm.fairplay) && (sniffer$1.browser === "safari" || sniffer$1.os.isIos)) {
19014
+ return "fairplay";
19015
+ }
19016
+ return;
19017
+ }
19018
+ function isMseSupportedWithDrm({
19019
+ drm,
19020
+ streamType
19021
+ }) {
19022
+ const drmType = getDrmType(drm);
19023
+ if (!drmType) {
19024
+ return true;
19025
+ }
19026
+ if (drmType === "fairplay" && streamType === "hls") {
19027
+ return false;
19028
+ }
19029
+ return true;
19030
+ }
18562
19031
  const getTypeStrategy = async (options, player) => {
18563
19032
  const type = options.url ? util.getStreamType(options.url) : "";
18564
19033
  if (!type || type === "unknown") {
@@ -18571,6 +19040,9 @@ var __publicField = (obj, key, value) => {
18571
19040
  return await getFlvStrategy(options);
18572
19041
  }
18573
19042
  if (type === "hls") {
19043
+ if (!isMseSupportedWithDrm({ drm: options.drm, streamType: type })) {
19044
+ return { options: {}, plugins: [] };
19045
+ }
18574
19046
  return await getHlsStrategy(options);
18575
19047
  }
18576
19048
  return { options: {}, plugins: [] };
@@ -18705,9 +19177,9 @@ var __publicField = (obj, key, value) => {
18705
19177
  const Events = {
18706
19178
  ...Events$1,
18707
19179
  // 直播的Events
18708
- TIME_SHIFT_CHANGE: "time_shift_change",
19180
+ TIME_SHIFT_CHANGE: "timeShiftChange",
18709
19181
  // 切换时移状态
18710
- REFRESH_CLICK: "refresh_click"
19182
+ REFRESH_CLICK: "refreshClick"
18711
19183
  // 触发刷新
18712
19184
  };
18713
19185
  function RefreshIcon() {
@@ -21247,9 +21719,6 @@ var __publicField = (obj, key, value) => {
21247
21719
  const generateSessionId = () => {
21248
21720
  return v4().replace(/-/g, "") + "." + Date.now() + "." + hashCode(v4().replace(/-/g, ""));
21249
21721
  };
21250
- const CN_APPID = 468759;
21251
- const CHANNEL = "cn";
21252
- const CHANNEL_DOMAIN = "//mcs.volceapplog.com";
21253
21722
  class Logger extends Plugin {
21254
21723
  constructor() {
21255
21724
  super(...arguments);
@@ -21304,9 +21773,8 @@ var __publicField = (obj, key, value) => {
21304
21773
  }
21305
21774
  _createTea() {
21306
21775
  q.init({
21307
- app_id: CN_APPID,
21308
- channel: CHANNEL,
21309
- channel_domain: CHANNEL_DOMAIN
21776
+ app_id: 468759,
21777
+ channel: "cn"
21310
21778
  });
21311
21779
  q.start();
21312
21780
  q.config({
@@ -21325,9 +21793,9 @@ var __publicField = (obj, key, value) => {
21325
21793
  user_id: this._userId,
21326
21794
  device_id: this._deviceId,
21327
21795
  ext: {
21328
- veplayer_version: "2.2.1-rc.0",
21329
- flv_version: "3.0.11-alpha.2",
21330
- hls_version: "3.0.11-alpha.2",
21796
+ veplayer_version: "2.3.0-rc.1",
21797
+ flv_version: "3.0.12",
21798
+ hls_version: "3.0.12",
21331
21799
  rts_version: "0.2.0-alpha.5"
21332
21800
  }
21333
21801
  });
@@ -21475,7 +21943,7 @@ var __publicField = (obj, key, value) => {
21475
21943
  _tick() {
21476
21944
  clearTimeout(this._pollTimer);
21477
21945
  this._renderPanel();
21478
- this._pollTimer = setTimeout(() => {
21946
+ this._pollTimer = window.setTimeout(() => {
21479
21947
  this._tick();
21480
21948
  }, this.config.interval);
21481
21949
  }
@@ -21591,6 +22059,37 @@ var __publicField = (obj, key, value) => {
21591
22059
  DECODE_INFO: "软解信息",
21592
22060
  REFRESH: "刷新"
21593
22061
  };
22062
+ const getDrmStrategy = async (options, player) => {
22063
+ var _a;
22064
+ const drmType = getDrmType(options.drm);
22065
+ if (options.url && drmType === DrmType.Fairplay) {
22066
+ try {
22067
+ const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
22068
+ const [drmPlugin, drmConfig] = await Promise.all([
22069
+ load(DynamicModule.PluginDrm).then((module2) => module2.DrmPlugin).catch(() => void 0),
22070
+ getDrmConfig == null ? void 0 : getDrmConfig({
22071
+ url: options.url
22072
+ })
22073
+ ]);
22074
+ const fairplayDrmConfig = Object.assign(
22075
+ {},
22076
+ originFairplayConfig,
22077
+ options == null ? void 0 : options.drm,
22078
+ drmConfig
22079
+ );
22080
+ drmConfig && (player == null ? void 0 : player.updateDrmConfig(drmConfig));
22081
+ return {
22082
+ options: {
22083
+ drm: fairplayDrmConfig
22084
+ },
22085
+ plugins: drmPlugin ? [drmPlugin] : []
22086
+ };
22087
+ } catch (error2) {
22088
+ console.log(error2);
22089
+ }
22090
+ }
22091
+ return {};
22092
+ };
21594
22093
  VeI18n.extend([
21595
22094
  {
21596
22095
  LANG: "zh-cn",
@@ -21610,7 +22109,11 @@ var __publicField = (obj, key, value) => {
21610
22109
  return RTMCodec2;
21611
22110
  })(RTMCodec || {});
21612
22111
  class VePlayerLive extends VePlayerBase {
21613
- /**
22112
+ /** {zh}
22113
+ * @hidden
22114
+ * @param options
22115
+ */
22116
+ /** {en}
21614
22117
  * @hidden
21615
22118
  * @param options
21616
22119
  */
@@ -21620,6 +22123,9 @@ var __publicField = (obj, key, value) => {
21620
22123
  /** {zh}
21621
22124
  * @brief 调用此方法开启直播日志上报。
21622
22125
  */
22126
+ /** {en}
22127
+ * @brief Enables log upload.
22128
+ */
21623
22129
  openLog() {
21624
22130
  var _a;
21625
22131
  (_a = this._player.plugins) == null ? void 0 : _a.logger.open();
@@ -21627,6 +22133,9 @@ var __publicField = (obj, key, value) => {
21627
22133
  /** {zh}
21628
22134
  * @brief 调用此方法关闭直播日志上报。
21629
22135
  */
22136
+ /** {en}
22137
+ * @brief Disables log upload.
22138
+ */
21630
22139
  closeLog() {
21631
22140
  var _a;
21632
22141
  (_a = this._player.plugins) == null ? void 0 : _a.logger.close();
@@ -21634,6 +22143,9 @@ var __publicField = (obj, key, value) => {
21634
22143
  /** {zh}
21635
22144
  * @brief 调用此方法将打开直播信息面板,面板将展示拉流格式、帧率、码率、GOP、视频分辨率、编码方式、Buffer 水位、播放进度等基础信息。如果当前是软解,还会显示软解解码效率和解码消耗。
21636
22145
  */
22146
+ /** {en}
22147
+ * @brief Turns on the information panel, which displays basic information including stream format, frame rate, bitrate, GOP, video resolution, codec, buffer time, and playback progress. If software decoding is used, the software decoding efficiency and CPU consumption will also be displayed.
22148
+ */
21637
22149
  openInfoPanel() {
21638
22150
  var _a;
21639
22151
  (_a = this._player.plugins) == null ? void 0 : _a.infopanel.open();
@@ -21642,10 +22154,22 @@ var __publicField = (obj, key, value) => {
21642
22154
  * @brief 调用此方法关闭直播信息面板。
21643
22155
  *
21644
22156
  */
22157
+ /** {en}
22158
+ * @brief Turns off the information panel.
22159
+ *
22160
+ */
21645
22161
  closeInfoPanel() {
21646
22162
  var _a;
21647
22163
  (_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
21648
22164
  }
22165
+ /** {zh}
22166
+ * @brief 调用此方法更新 DRM 鉴权配置。
22167
+ * @hidden
22168
+ */
22169
+ updateDrmConfig(config) {
22170
+ var _a, _b, _c;
22171
+ (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
22172
+ }
21649
22173
  }
21650
22174
  async function createLivePlayer(options) {
21651
22175
  var _a, _b;
@@ -21670,7 +22194,16 @@ var __publicField = (obj, key, value) => {
21670
22194
  };
21671
22195
  },
21672
22196
  async preparePlugins(url) {
21673
- return getTypeStrategy({ ...finalOptions, url }, player);
22197
+ const [typeStrategy, drmStrategy] = await Promise.all([
22198
+ getTypeStrategy({ ...finalOptions, url }, player),
22199
+ getDrmStrategy({ ...finalOptions, url }, player)
22200
+ ]);
22201
+ const { options: options2, plugins } = typeStrategy ?? {};
22202
+ const { options: drmOptions, plugins: drmPlugins } = drmStrategy ?? {};
22203
+ return {
22204
+ options: Object.assign({}, options2, drmOptions),
22205
+ plugins: [...plugins ?? [], ...drmPlugins ?? []]
22206
+ };
21674
22207
  }
21675
22208
  },
21676
22209
  VePlayerLive
@@ -21697,12 +22230,12 @@ var __publicField = (obj, key, value) => {
21697
22230
  setModuleSystem("umd");
21698
22231
  const isMseSupported = util.isMseSupported;
21699
22232
  const isSoftDecodeSupported = util.isSoftDecodeSupported;
21700
- if (typeof VePlayer.register !== "undefined") {
21701
- VePlayer.register(DynamicModule.BizLive, {
22233
+ if (typeof VePlayer.registerPlugin !== "undefined") {
22234
+ VePlayer.registerPlugin(DynamicModule.BizLive, {
21702
22235
  createLivePlayer
21703
22236
  });
21704
22237
  } else {
21705
- register(DynamicModule.BizLive, {
22238
+ registerPlugin(DynamicModule.BizLive, {
21706
22239
  createLivePlayer
21707
22240
  });
21708
22241
  }
@@ -21711,6 +22244,7 @@ var __publicField = (obj, key, value) => {
21711
22244
  exports2.Degradation = Degradation;
21712
22245
  exports2.DynamicModule = DynamicModule;
21713
22246
  exports2.EN = EN$1;
22247
+ exports2.ListType = ListType;
21714
22248
  exports2.POSITIONS = POSITIONS$1;
21715
22249
  exports2.Plugin = Plugin;
21716
22250
  exports2.RTMCodec = RTMCodec;
@@ -21724,5 +22258,6 @@ var __publicField = (obj, key, value) => {
21724
22258
  exports2.live = live;
21725
22259
  exports2.load = load;
21726
22260
  exports2.register = register;
22261
+ exports2.registerPlugin = registerPlugin;
21727
22262
  exports2.util = util;
21728
22263
  });