@volcengine/veplayer 2.2.0-rc.2 → 2.3.0-rc.0

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 +84 -88
  3. package/esm/veplayer.biz.live.development.js +104 -27
  4. package/esm/veplayer.biz.live.production.js +1 -1
  5. package/esm/veplayer.d.ts +327 -178
  6. package/esm/veplayer.development.css +1 -1
  7. package/esm/veplayer.development.js +458 -143
  8. package/esm/veplayer.live.d.ts +327 -178
  9. package/esm/veplayer.live.development.css +1 -1
  10. package/esm/veplayer.live.development.js +458 -143
  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 +84 -88
  16. package/esm/veplayer.vod.development.css +1 -1
  17. package/esm/veplayer.vod.development.js +366 -125
  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 +84 -88
  22. package/umd/veplayer.biz.live.development.js +107 -30
  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 +327 -178
  27. package/umd/veplayer.development.css +1 -1
  28. package/umd/veplayer.development.js +457 -142
  29. package/umd/veplayer.live.d.ts +327 -178
  30. package/umd/veplayer.live.development.css +1 -1
  31. package/umd/veplayer.live.development.js +460 -145
  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 +84 -88
  37. package/umd/veplayer.vod.development.css +1 -1
  38. package/umd/veplayer.vod.development.js +371 -130
  39. package/umd/veplayer.vod.production.css +1 -1
  40. package/umd/veplayer.vod.production.js +1 -1
  41. package/veplayer.d.ts +327 -178
  42. package/veplayer.live.d.ts +327 -178
  43. package/veplayer.vod.d.ts +84 -88
@@ -48,8 +48,8 @@ function _typeof(obj) {
48
48
  return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
49
49
  }, _typeof(obj);
50
50
  }
51
- function _classCallCheck(instance, Constructor) {
52
- if (!(instance instanceof Constructor)) {
51
+ function _classCallCheck(instance2, Constructor) {
52
+ if (!(instance2 instanceof Constructor)) {
53
53
  throw new TypeError("Cannot call a class as a function");
54
54
  }
55
55
  }
@@ -1454,7 +1454,7 @@ var sniffer$1 = {
1454
1454
  }
1455
1455
  }
1456
1456
  };
1457
- var version = "3.0.11-alpha.2";
1457
+ var version = "3.0.12";
1458
1458
  var ERROR_TYPE_MAP = {
1459
1459
  1: "media",
1460
1460
  2: "media",
@@ -2316,10 +2316,10 @@ var INDEXDB = /* @__PURE__ */ function() {
2316
2316
  }, {
2317
2317
  key: "addData",
2318
2318
  value: function addData(storename, data) {
2319
- var store = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2319
+ var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2320
2320
  var request;
2321
2321
  for (var i2 = 0; i2 < data.length; i2++) {
2322
- request = store.add(data[i2]);
2322
+ request = store2.add(data[i2]);
2323
2323
  request.onerror = function() {
2324
2324
  };
2325
2325
  request.onsuccess = function() {
@@ -2329,10 +2329,10 @@ var INDEXDB = /* @__PURE__ */ function() {
2329
2329
  }, {
2330
2330
  key: "putData",
2331
2331
  value: function putData(storename, data) {
2332
- var store = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2332
+ var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2333
2333
  var request;
2334
2334
  for (var i2 = 0; i2 < data.length; i2++) {
2335
- request = store.put(data[i2]);
2335
+ request = store2.put(data[i2]);
2336
2336
  request.onerror = function() {
2337
2337
  };
2338
2338
  request.onsuccess = function() {
@@ -2343,8 +2343,8 @@ var INDEXDB = /* @__PURE__ */ function() {
2343
2343
  key: "getDataByKey",
2344
2344
  value: function getDataByKey(storename, key, callback) {
2345
2345
  var self2 = this;
2346
- var store = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2347
- var request = store.get(key);
2346
+ var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2347
+ var request = store2.get(key);
2348
2348
  request.onerror = function() {
2349
2349
  callback.call(self2, null);
2350
2350
  };
@@ -2356,14 +2356,14 @@ var INDEXDB = /* @__PURE__ */ function() {
2356
2356
  }, {
2357
2357
  key: "deleteData",
2358
2358
  value: function deleteData(storename, key) {
2359
- var store = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2360
- store.delete(key);
2359
+ var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2360
+ store2.delete(key);
2361
2361
  }
2362
2362
  }, {
2363
2363
  key: "clearData",
2364
2364
  value: function clearData(storename) {
2365
- var store = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2366
- store.clear();
2365
+ var store2 = this.myDB.db.transaction(storename, "readwrite").objectStore(storename);
2366
+ store2.clear();
2367
2367
  }
2368
2368
  }]);
2369
2369
  return INDEXDB2;
@@ -2480,24 +2480,24 @@ function removePluginHooks(pluginName) {
2480
2480
  return plugin.removeHooks && plugin.removeHooks.apply(plugin, args);
2481
2481
  }
2482
2482
  }
2483
- function hooksDescriptor(instance) {
2483
+ function hooksDescriptor(instance2) {
2484
2484
  var presetHooks = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
2485
- instance.__hooks = {};
2485
+ instance2.__hooks = {};
2486
2486
  presetHooks && presetHooks.map(function(item) {
2487
- instance.__hooks[item] = null;
2487
+ instance2.__hooks[item] = null;
2488
2488
  });
2489
- Object.defineProperty(instance, "hooks", {
2489
+ Object.defineProperty(instance2, "hooks", {
2490
2490
  get: function get() {
2491
- return instance.__hooks && Object.keys(instance.__hooks).map(function(key) {
2492
- if (instance.__hooks[key]) {
2491
+ return instance2.__hooks && Object.keys(instance2.__hooks).map(function(key) {
2492
+ if (instance2.__hooks[key]) {
2493
2493
  return key;
2494
2494
  }
2495
2495
  });
2496
2496
  }
2497
2497
  });
2498
2498
  }
2499
- function delHooksDescriptor(instance) {
2500
- instance.__hooks = null;
2499
+ function delHooksDescriptor(instance2) {
2500
+ instance2.__hooks = null;
2501
2501
  }
2502
2502
  function runHooks(obj, hookName, handler) {
2503
2503
  for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
@@ -2715,7 +2715,7 @@ var BasePlugin = /* @__PURE__ */ function() {
2715
2715
  }
2716
2716
  }, {
2717
2717
  key: "registerPlugin",
2718
- value: function registerPlugin(plugin) {
2718
+ value: function registerPlugin2(plugin) {
2719
2719
  var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2720
2720
  var name = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
2721
2721
  if (!this.player) {
@@ -3074,7 +3074,7 @@ var Plugin = /* @__PURE__ */ function(_BasePlugin) {
3074
3074
  }
3075
3075
  }, {
3076
3076
  key: "registerPlugin",
3077
- value: function registerPlugin(plugin) {
3077
+ value: function registerPlugin2(plugin) {
3078
3078
  var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
3079
3079
  var name = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
3080
3080
  options.root = options.root || this.root;
@@ -3213,7 +3213,7 @@ var Plugin = /* @__PURE__ */ function(_BasePlugin) {
3213
3213
  var cs = window.getComputedStyle(this.root, null);
3214
3214
  var cssDisplayValue = cs.getPropertyValue("display");
3215
3215
  if (cssDisplayValue === "none") {
3216
- return this.root.style.display = "block";
3216
+ this.root.style.display = "block";
3217
3217
  }
3218
3218
  }
3219
3219
  }, {
@@ -3470,28 +3470,11 @@ var pluginsManager = {
3470
3470
  !player.config.closeResizeObserver && addObserver(player.root, function() {
3471
3471
  player.resize();
3472
3472
  });
3473
- if (Object.keys(this.pluginGroup).length === 0) {
3474
- player.isUserActive = true;
3475
- }
3476
3473
  this.pluginGroup[cgid] = {
3477
- _player: player,
3478
3474
  _originalOptions: player.config || {},
3479
3475
  _plugins: {}
3480
3476
  };
3481
3477
  },
3482
- checkPlayerRoot: function checkPlayerRoot(root2) {
3483
- if (this.pluginGroup) {
3484
- var _keys = Object.keys(this.pluginGroup);
3485
- for (var i2 = 0; i2 < _keys.length; i2++) {
3486
- var _p = this.pluginGroup[_keys[i2]]._player;
3487
- if (_p.root === root2) {
3488
- return _p;
3489
- }
3490
- }
3491
- return null;
3492
- }
3493
- return null;
3494
- },
3495
3478
  formatPluginInfo: function formatPluginInfo(plugin, config) {
3496
3479
  var PLUFGIN = null;
3497
3480
  var options = null;
@@ -3566,7 +3549,7 @@ var pluginsManager = {
3566
3549
  }
3567
3550
  var plugins = this.pluginGroup[cgid]._plugins;
3568
3551
  var originalOptions = this.pluginGroup[cgid]._originalOptions;
3569
- options.player = this.pluginGroup[cgid]._player;
3552
+ options.player = player;
3570
3553
  var pluginName = options.pluginName || plugin.pluginName;
3571
3554
  if (!pluginName) {
3572
3555
  throw new Error("The property pluginName is necessary");
@@ -3765,37 +3748,6 @@ var pluginsManager = {
3765
3748
  }
3766
3749
  });
3767
3750
  },
3768
- setCurrentUserActive: function setCurrentUserActive(playerId, isActive) {
3769
- if (!this.pluginGroup[playerId]) {
3770
- return;
3771
- }
3772
- if (!isActive) {
3773
- this.pluginGroup[playerId]._player.isUserActive = isActive;
3774
- return playerId;
3775
- }
3776
- var keys = Object.keys(this.pluginGroup);
3777
- for (var i2 = 0; i2 < keys.length; i2++) {
3778
- var c2 = this.pluginGroup[keys[i2]];
3779
- if (c2 && c2._player) {
3780
- this.pluginGroup[keys[i2]]._player.isUserActive = false;
3781
- }
3782
- }
3783
- this.pluginGroup[playerId]._player.isUserActive = isActive;
3784
- return playerId;
3785
- },
3786
- getCurrentUseActiveId: function getCurrentUseActiveId() {
3787
- if (!this.pluginGroup) {
3788
- return;
3789
- }
3790
- var keys = Object.keys(this.pluginGroup);
3791
- for (var i2 = 0; i2 < keys.length; i2++) {
3792
- var c2 = this.pluginGroup[keys[i2]];
3793
- if (c2 && c2._player && c2._player.isUserActive) {
3794
- return keys[i2];
3795
- }
3796
- }
3797
- return null;
3798
- },
3799
3751
  destroy: function destroy(player) {
3800
3752
  var cgid = player._pluginInfoId;
3801
3753
  if (!this.pluginGroup[cgid]) {
@@ -4051,7 +4003,7 @@ var Controls = /* @__PURE__ */ function(_Plugin) {
4051
4003
  }
4052
4004
  }, {
4053
4005
  key: "show",
4054
- value: function show() {
4006
+ value: function show(value) {
4055
4007
  this.root.style.display = "";
4056
4008
  this.player.focus();
4057
4009
  }
@@ -4067,7 +4019,7 @@ var Controls = /* @__PURE__ */ function(_Plugin) {
4067
4019
  }
4068
4020
  }, {
4069
4021
  key: "registerPlugin",
4070
- value: function registerPlugin(plugin) {
4022
+ value: function registerPlugin2(plugin) {
4071
4023
  var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
4072
4024
  var name = arguments.length > 2 ? arguments[2] : void 0;
4073
4025
  if (!this.root) {
@@ -4344,9 +4296,158 @@ var STATES = {
4344
4296
  DESTROYED: 8
4345
4297
  };
4346
4298
  var STATE_ARRAY = ["ERROR", "INITIAL", "READY", "ATTACHING", "ATTACHED", "NOTALLOW", "RUNNING", "ENDED", "DESTROYED"];
4299
+ var store = {};
4300
+ var instance = null;
4301
+ var InstManager = /* @__PURE__ */ function(_EventEmitter) {
4302
+ _inherits(InstManager2, _EventEmitter);
4303
+ var _super = _createSuper(InstManager2);
4304
+ function InstManager2() {
4305
+ _classCallCheck(this, InstManager2);
4306
+ return _super.apply(this, arguments);
4307
+ }
4308
+ _createClass$1(InstManager2, [{
4309
+ key: "add",
4310
+ value: function add(player) {
4311
+ if (!player) {
4312
+ return;
4313
+ }
4314
+ store[player.playerId] = player;
4315
+ if (Object.keys(store).length === 1) {
4316
+ this.setActive(player.playerId, true);
4317
+ }
4318
+ }
4319
+ }, {
4320
+ key: "remove",
4321
+ value: function remove(player) {
4322
+ if (!player) {
4323
+ return;
4324
+ }
4325
+ player.isUserActive;
4326
+ delete store[player.playerId];
4327
+ }
4328
+ }, {
4329
+ key: "_iterate",
4330
+ value: function _iterate(fn) {
4331
+ var endEarly = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
4332
+ for (var key in store) {
4333
+ if (Object.prototype.hasOwnProperty.call(store, key)) {
4334
+ var player = store[key];
4335
+ if (endEarly) {
4336
+ if (fn(player)) {
4337
+ break;
4338
+ }
4339
+ } else {
4340
+ fn(player);
4341
+ }
4342
+ }
4343
+ }
4344
+ }
4345
+ }, {
4346
+ key: "forEach",
4347
+ value: function forEach(fn) {
4348
+ this._iterate(fn);
4349
+ }
4350
+ }, {
4351
+ key: "find",
4352
+ value: function find(fn) {
4353
+ var result = null;
4354
+ this._iterate(function(player) {
4355
+ var flag = fn(player);
4356
+ if (flag) {
4357
+ result = player;
4358
+ }
4359
+ return flag;
4360
+ }, true);
4361
+ return result;
4362
+ }
4363
+ }, {
4364
+ key: "findAll",
4365
+ value: function findAll(fn) {
4366
+ var results = [];
4367
+ this._iterate(function(player) {
4368
+ if (fn(player)) {
4369
+ results.push(player);
4370
+ }
4371
+ });
4372
+ return results;
4373
+ }
4374
+ }, {
4375
+ key: "setActive",
4376
+ value: function setActive(playerId) {
4377
+ var isActive = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
4378
+ if (!store[playerId]) {
4379
+ return;
4380
+ }
4381
+ if (isActive) {
4382
+ this.forEach(function(inst) {
4383
+ if (playerId === inst.playerId) {
4384
+ inst.isUserActive = true;
4385
+ inst.isInstNext = false;
4386
+ } else {
4387
+ inst.isUserActive = false;
4388
+ }
4389
+ });
4390
+ } else {
4391
+ store[playerId].isUserActive = isActive;
4392
+ }
4393
+ return playerId;
4394
+ }
4395
+ }, {
4396
+ key: "getActiveId",
4397
+ value: function getActiveId() {
4398
+ var keys = Object.keys(store);
4399
+ for (var i2 = 0; i2 < keys.length; i2++) {
4400
+ var c2 = store[keys[i2]];
4401
+ if (c2 && c2.isUserActive) {
4402
+ return keys[i2];
4403
+ }
4404
+ }
4405
+ return null;
4406
+ }
4407
+ }, {
4408
+ key: "setNext",
4409
+ value: function setNext(playerId) {
4410
+ var isNext = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
4411
+ if (!store[playerId]) {
4412
+ return;
4413
+ }
4414
+ if (isNext) {
4415
+ this.forEach(function(inst) {
4416
+ if (playerId === inst.playerId) {
4417
+ inst.isUserActive = false;
4418
+ inst.isInstNext = true;
4419
+ } else {
4420
+ inst.isInstNext = false;
4421
+ }
4422
+ });
4423
+ } else {
4424
+ store[playerId].isInstNext = isNext;
4425
+ }
4426
+ return playerId;
4427
+ }
4428
+ }], [{
4429
+ key: "getInstance",
4430
+ value: function getInstance() {
4431
+ instance || (instance = new InstManager2());
4432
+ return instance;
4433
+ }
4434
+ }]);
4435
+ return InstManager2;
4436
+ }(eventemitter3Exports.EventEmitter);
4437
+ function checkPlayerRoot(root2) {
4438
+ var keys = Object.keys(store);
4439
+ for (var i2 = 0; i2 < keys.length; i2++) {
4440
+ var p2 = store[keys[i2]];
4441
+ if (p2.root === root2) {
4442
+ return p2;
4443
+ }
4444
+ }
4445
+ return null;
4446
+ }
4347
4447
  var PlAYER_HOOKS = ["play", "pause", "replay", "retry"];
4348
4448
  var REAL_TIME_SPEED = 0;
4349
4449
  var AVG_SPEED = 0;
4450
+ var instManager = null;
4350
4451
  var Player = /* @__PURE__ */ function(_MediaProxy) {
4351
4452
  _inherits(Player2, _MediaProxy);
4352
4453
  var _super = _createSuper(Player2);
@@ -4359,11 +4460,11 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4359
4460
  if (!_this.config) {
4360
4461
  return;
4361
4462
  }
4362
- var _this$config = _this.config, autoplay2 = _this$config.autoplay, startTime = _this$config.startTime, defaultPlaybackRate = _this$config.defaultPlaybackRate;
4363
- XG_DEBUG.logInfo("player", "canPlayFunc, startTime", startTime);
4364
- if (startTime) {
4365
- _this.currentTime = startTime > _this.duration ? _this.duration : startTime;
4366
- _this.config.startTime = 0;
4463
+ var _this$config = _this.config, autoplay2 = _this$config.autoplay, defaultPlaybackRate = _this$config.defaultPlaybackRate;
4464
+ XG_DEBUG.logInfo("player", "canPlayFunc, startTime", _this.__startTime);
4465
+ if (_this.__startTime > 0 && _this.duration > 0) {
4466
+ _this.currentTime = _this.__startTime > _this.duration ? _this.duration : _this.__startTime;
4467
+ _this.__startTime = -1;
4367
4468
  }
4368
4469
  _this.playbackRate = defaultPlaybackRate;
4369
4470
  (autoplay2 || _this._useAutoplay) && _this.mediaPlay();
@@ -4454,6 +4555,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4454
4555
  _this.isSeeking = false;
4455
4556
  _this.isCanplay = false;
4456
4557
  _this._useAutoplay = false;
4558
+ _this.__startTime = -1;
4457
4559
  _this.rotateDeg = 0;
4458
4560
  _this.isActive = false;
4459
4561
  _this.fullscreen = false;
@@ -4508,6 +4610,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4508
4610
  _this.innerStates = {
4509
4611
  isActiveLocked: false
4510
4612
  };
4613
+ _this.instManager = instManager;
4511
4614
  var rootInit = _this._initDOM();
4512
4615
  if (!rootInit) {
4513
4616
  console.error(new Error("can't find the dom which id is ".concat(_this.config.id, " or this.config.el does not exist")));
@@ -4545,7 +4648,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4545
4648
  _createClass$1(Player2, [{
4546
4649
  key: "_initDOM",
4547
4650
  value: function _initDOM() {
4548
- var _this2 = this;
4651
+ var _instManager, _this2 = this;
4549
4652
  this.root = this.config.id ? document.getElementById(this.config.id) : null;
4550
4653
  if (!this.root) {
4551
4654
  var el = this.config.el;
@@ -4561,12 +4664,13 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4561
4664
  return false;
4562
4665
  }
4563
4666
  }
4564
- var ret = pluginsManager.checkPlayerRoot(this.root);
4667
+ var ret = checkPlayerRoot(this.root);
4565
4668
  if (ret) {
4566
4669
  XG_DEBUG.logWarn("The is an Player instance already exists in this.root, destroy it and reinitialize");
4567
4670
  ret.destroy();
4568
4671
  }
4569
4672
  this.root.setAttribute(PLATER_ID, this.playerId);
4673
+ (_instManager = instManager) === null || _instManager === void 0 ? void 0 : _instManager.add(this);
4570
4674
  pluginsManager.init(this);
4571
4675
  this._initBaseDoms();
4572
4676
  var XgVideoProxy = this.constructor.XgVideoProxy;
@@ -4709,10 +4813,13 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4709
4813
  !util$1.isMSE(this.media) && this.load();
4710
4814
  (sniffer$1.os.isIpad || sniffer$1.os.isPhone) && this.mediaPlay();
4711
4815
  }
4712
- if (readyState >= 2) {
4816
+ var startTime = this.config.startTime;
4817
+ this.__startTime = startTime > 0 ? startTime : -1;
4818
+ this.config.startTime = 0;
4819
+ if (readyState >= 2 && this.duration > 0) {
4713
4820
  this.canPlayFunc();
4714
4821
  } else {
4715
- this.once(CANPLAY, this.canPlayFunc);
4822
+ this.on(CANPLAY, this.canPlayFunc);
4716
4823
  }
4717
4824
  if (!this.hasStart || this.state < STATES.ATTACHED) {
4718
4825
  pluginsManager.afterInit(this);
@@ -4805,7 +4912,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4805
4912
  }
4806
4913
  }, {
4807
4914
  key: "registerPlugin",
4808
- value: function registerPlugin(plugin, config) {
4915
+ value: function registerPlugin2(plugin, config) {
4809
4916
  var _retPlugin = pluginsManager.formatPluginInfo(plugin, config);
4810
4917
  var PLUFGIN = _retPlugin.PLUFGIN, options = _retPlugin.options;
4811
4918
  var plugins = this.config.plugins;
@@ -4954,6 +5061,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4954
5061
  }
4955
5062
  _src = this.preProcessUrl(_src).url;
4956
5063
  var curTime = this.currentTime;
5064
+ this.__startTime = curTime;
4957
5065
  var isPaused = this.paused && !this.isError;
4958
5066
  this.src = _src;
4959
5067
  return new Promise(function(resolve, reject) {
@@ -4963,7 +5071,10 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
4963
5071
  reject(e3);
4964
5072
  };
4965
5073
  var _canplay = function _canplay2() {
4966
- _this9.currentTime = curTime;
5074
+ if (_this9.duration > 0 && _this9.__startTime > 0) {
5075
+ _this9.currentTime = _this9.__startTime;
5076
+ _this9.__startTime = -1;
5077
+ }
4967
5078
  if (isPaused) {
4968
5079
  _this9.pause();
4969
5080
  }
@@ -5190,7 +5301,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5190
5301
  clsList.forEach(function(cls) {
5191
5302
  _this16.removeClass(cls);
5192
5303
  });
5193
- this.addClass(STATE_CLASS.ENTER);
5304
+ this.addClass(STATE_CLASS.NO_START);
5194
5305
  this.emit(RESET);
5195
5306
  }
5196
5307
  }, {
@@ -5219,7 +5330,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5219
5330
  }, {
5220
5331
  key: "destroy",
5221
5332
  value: function destroy2() {
5222
- var _this18 = this;
5333
+ var _instManager2, _this18 = this;
5223
5334
  var innerContainer = this.innerContainer, root2 = this.root, media = this.media;
5224
5335
  if (!root2 || !media) {
5225
5336
  return;
@@ -5232,6 +5343,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5232
5343
  this._detachSourceEvents(this.media);
5233
5344
  util$1.clearAllTimers(this);
5234
5345
  this.emit(DESTROY);
5346
+ (_instManager2 = instManager) === null || _instManager2 === void 0 ? void 0 : _instManager2.remove(this);
5235
5347
  pluginsManager.destroy(this);
5236
5348
  delHooksDescriptor(this);
5237
5349
  _get(_getPrototypeOf(Player2.prototype), "destroy", this).call(this);
@@ -5583,6 +5695,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5583
5695
  this.isCanplay = true;
5584
5696
  this.waitTimer && util$1.clearTimeout(this, this.waitTimer);
5585
5697
  }
5698
+ }, {
5699
+ key: "onDurationchange",
5700
+ value: function onDurationchange() {
5701
+ if (this.__startTime > 0 && this.duration > 0) {
5702
+ this.currentTime = this.__startTime;
5703
+ this.__startTime = -1;
5704
+ }
5705
+ }
5586
5706
  }, {
5587
5707
  key: "onLoadeddata",
5588
5708
  value: function onLoadeddata() {
@@ -5760,8 +5880,9 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5760
5880
  }, {
5761
5881
  key: "resizePosition",
5762
5882
  value: function resizePosition() {
5763
- var _this$videoPos = this.videoPos, rotate = _this$videoPos.rotate, vy = _this$videoPos.vy, vx = _this$videoPos.vx, h2 = _this$videoPos.h, w2 = _this$videoPos.w;
5764
- if (rotate < 0 && !vy && !vx) {
5883
+ var _this$videoPos = this.videoPos, vy = _this$videoPos.vy, vx = _this$videoPos.vx, h2 = _this$videoPos.h, w2 = _this$videoPos.w;
5884
+ var rotate = this.videoPos.rotate;
5885
+ if (rotate < 0 && h2 < 0 && w2 < 0) {
5765
5886
  return;
5766
5887
  }
5767
5888
  var _pi = this.videoPos._pi;
@@ -5772,6 +5893,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
5772
5893
  return;
5773
5894
  }
5774
5895
  this.videoPos.pi = _pi;
5896
+ rotate = rotate < 0 ? 0 : rotate;
5775
5897
  var _pos = {
5776
5898
  rotate
5777
5899
  };
@@ -6204,7 +6326,8 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6204
6326
  }
6205
6327
  }, {
6206
6328
  key: "setUserActive",
6207
- value: function setUserActive(isActive, isMuted) {
6329
+ value: function setUserActive(isActive) {
6330
+ var isMuted = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
6208
6331
  if (typeof isMuted === "boolean" && isMuted !== this.muted) {
6209
6332
  this.addInnerOP("volumechange");
6210
6333
  this.muted = isMuted;
@@ -6219,15 +6342,25 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6219
6342
  set: function set(value) {
6220
6343
  XG_DEBUG.config.debug = value;
6221
6344
  }
6345
+ }, {
6346
+ key: "instManager",
6347
+ get: function get() {
6348
+ return instManager;
6349
+ },
6350
+ set: function set(value) {
6351
+ instManager = value;
6352
+ }
6222
6353
  }, {
6223
6354
  key: "getCurrentUserActivePlayerId",
6224
6355
  value: function getCurrentUserActivePlayerId() {
6225
- return pluginsManager.getCurrentUseActiveId();
6356
+ var _instManager3;
6357
+ return (_instManager3 = instManager) === null || _instManager3 === void 0 ? void 0 : _instManager3.getActiveId();
6226
6358
  }
6227
6359
  }, {
6228
6360
  key: "setCurrentUserActive",
6229
- value: function setCurrentUserActive2(playerId, isActive) {
6230
- pluginsManager.setCurrentUserActive(playerId, isActive);
6361
+ value: function setCurrentUserActive(playerId, isActive) {
6362
+ var _instManager4;
6363
+ (_instManager4 = instManager) === null || _instManager4 === void 0 ? void 0 : _instManager4.setActive(playerId, isActive);
6231
6364
  }
6232
6365
  }, {
6233
6366
  key: "isHevcSupported",
@@ -6262,6 +6395,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
6262
6395
  }(MediaProxy);
6263
6396
  _defineProperty$1(Player, "defaultPreset", null);
6264
6397
  _defineProperty$1(Player, "XgVideoProxy", null);
6398
+ Player.instManager = InstManager.getInstance();
6265
6399
  var index_min = "";
6266
6400
  var Level = /* @__PURE__ */ ((Level2) => {
6267
6401
  Level2["Fatal"] = "Fatal";
@@ -6404,6 +6538,14 @@ const ERROR_INFO = {
6404
6538
  messageTextKey: "MODULE_LOAD_ERROR",
6405
6539
  level: "Fatal"
6406
6540
  /* Fatal */
6541
+ },
6542
+ [
6543
+ 7100
6544
+ /* DRM_LICENSE */
6545
+ ]: {
6546
+ messageTextKey: "DRM_LICENSE",
6547
+ level: "Fatal"
6548
+ /* Fatal */
6407
6549
  }
6408
6550
  };
6409
6551
  const ERROR_TYPE_INFO = {
@@ -6486,7 +6628,7 @@ let VeError$1 = class VeError extends Error {
6486
6628
  const message = (i18n == null ? void 0 : i18n.getText(errorInfo == null ? void 0 : errorInfo.messageTextKey)) ?? (errorInfo == null ? void 0 : errorInfo.message) ?? ((_a = errorInfo == null ? void 0 : errorInfo.error) == null ? void 0 : _a.message) ?? (i18n == null ? void 0 : i18n.getText("UNKNOWN"));
6487
6629
  super(message);
6488
6630
  /**
6489
- * @brief 错误码,对应[错误码字典](#错误码)。
6631
+ * @brief 错误码,对应[错误码字典](#ErrorCode)。
6490
6632
  */
6491
6633
  __publicField(this, "errorCode");
6492
6634
  /**
@@ -6559,7 +6701,7 @@ var Poster = /* @__PURE__ */ function(_Plugin) {
6559
6701
  }
6560
6702
  }, {
6561
6703
  key: "show",
6562
- value: function show() {
6704
+ value: function show(value) {
6563
6705
  util$1.removeClass(this.root, "hide");
6564
6706
  }
6565
6707
  }, {
@@ -6638,10 +6780,11 @@ var Poster = /* @__PURE__ */ function(_Plugin) {
6638
6780
  }, {
6639
6781
  key: "render",
6640
6782
  value: function render() {
6641
- var _this$config = this.config, poster = _this$config.poster, hideCanplay = _this$config.hideCanplay, fillMode = _this$config.fillMode;
6783
+ var _this$config = this.config, poster = _this$config.poster, hideCanplay = _this$config.hideCanplay, fillMode = _this$config.fillMode, notHidden = _this$config.notHidden;
6642
6784
  var _bg = this.getBgSize(fillMode);
6643
6785
  var style = poster ? "background-image:url(".concat(poster, ");").concat(_bg) : _bg;
6644
- return '<xg-poster class="xgplayer-poster '.concat(hideCanplay ? "xg-showplay" : "", '" style="').concat(style, '">\n </xg-poster>');
6786
+ var className = notHidden ? "xg-not-hidden" : hideCanplay ? "xg-showplay" : "";
6787
+ return '<xg-poster class="xgplayer-poster '.concat(className, '" style="').concat(style, '">\n </xg-poster>');
6645
6788
  }
6646
6789
  }], [{
6647
6790
  key: "pluginName",
@@ -6654,6 +6797,7 @@ var Poster = /* @__PURE__ */ function(_Plugin) {
6654
6797
  return {
6655
6798
  isEndedShow: true,
6656
6799
  hideCanplay: false,
6800
+ notHidden: false,
6657
6801
  poster: "",
6658
6802
  fillMode: "fixWidth"
6659
6803
  };
@@ -6797,7 +6941,7 @@ var Start = /* @__PURE__ */ function(_Plugin) {
6797
6941
  }
6798
6942
  }, {
6799
6943
  key: "show",
6800
- value: function show() {
6944
+ value: function show(value) {
6801
6945
  util$1.removeClass(this.root, "hide");
6802
6946
  }
6803
6947
  }, {
@@ -7759,14 +7903,14 @@ var PCPlugin = /* @__PURE__ */ function(_BasePlugin) {
7759
7903
  key: "initEvents",
7760
7904
  value: function initEvents() {
7761
7905
  var _this3 = this;
7762
- var _this$player = this.player, video = _this$player.video, root2 = _this$player.root;
7906
+ var _this$player = this.player, media = _this$player.media, root2 = _this$player.root;
7763
7907
  var enableContextmenu = this.playerConfig.enableContextmenu;
7764
7908
  root2 && root2.addEventListener("click", this.onVideoClick, false);
7765
7909
  root2 && root2.addEventListener("dblclick", this.onVideoDblClick, false);
7766
7910
  Object.keys(MOUSE_EVENTS).map(function(item) {
7767
7911
  root2.addEventListener(item, _this3[MOUSE_EVENTS[item]], false);
7768
7912
  });
7769
- enableContextmenu && video && video.addEventListener("contextmenu", this.onContextmenu, false);
7913
+ !enableContextmenu && media && media.addEventListener("contextmenu", this.onContextmenu, false);
7770
7914
  }
7771
7915
  }, {
7772
7916
  key: "switchPlayPause",
@@ -9490,16 +9634,6 @@ var Fullscreen = /* @__PURE__ */ function(_IconPlugin) {
9490
9634
  }
9491
9635
  }
9492
9636
  }
9493
- }, {
9494
- key: "show",
9495
- value: function show() {
9496
- _get(_getPrototypeOf(Fullscreen2.prototype), "show", this).call(this);
9497
- }
9498
- }, {
9499
- key: "hide",
9500
- value: function hide() {
9501
- _get(_getPrototypeOf(Fullscreen2.prototype), "hide", this).call(this);
9502
- }
9503
9637
  }, {
9504
9638
  key: "render",
9505
9639
  value: function render() {
@@ -9955,11 +10089,14 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
9955
10089
  }, 0);
9956
10090
  !paused && player.mediaPlay();
9957
10091
  _this3.setAttr("data-state", "normal");
10092
+ _this3.pipWindow = null;
9958
10093
  player.emit(PIP_CHANGE, false);
9959
10094
  };
9960
10095
  this.enterPIPCallback = function(e3) {
9961
10096
  player.emit(PIP_CHANGE, true);
9962
- _this3.pipWindow = e3.pictureInPictureWindow;
10097
+ if (e3 !== null && e3 !== void 0 && e3.pictureInPictureWindow) {
10098
+ _this3.pipWindow = e3.pictureInPictureWindow;
10099
+ }
9963
10100
  _this3.setAttr("data-state", "pip");
9964
10101
  };
9965
10102
  this.onWebkitpresentationmodechanged = function(e3) {
@@ -9980,10 +10117,33 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
9980
10117
  PIP2.checkWebkitSetPresentationMode(player.media) && player.media.addEventListener("webkitpresentationmodechanged", this.onWebkitpresentationmodechanged);
9981
10118
  }
9982
10119
  }
10120
+ }, {
10121
+ key: "copyStyleIntoPiPWindow",
10122
+ value: function copyStyleIntoPiPWindow(pipWin) {
10123
+ var textContent = _toConsumableArray(document.styleSheets).map(function(style2) {
10124
+ try {
10125
+ return _toConsumableArray(style2.cssRules).map(function(rule) {
10126
+ return rule.cssText;
10127
+ }).join("");
10128
+ } catch (e3) {
10129
+ var link = document.createElement("link");
10130
+ link.rel = "stylesheet";
10131
+ link.type = style2.type;
10132
+ link.media = style2.media;
10133
+ link.href = style2.href;
10134
+ pipWin.document.head.appendChild(link);
10135
+ }
10136
+ return "";
10137
+ }).filter(Boolean).join("\n");
10138
+ var style = document.createElement("style");
10139
+ style.textContent = textContent;
10140
+ pipWin.document.head.appendChild(style);
10141
+ }
9983
10142
  }, {
9984
10143
  key: "requestPIP",
9985
10144
  value: function requestPIP() {
9986
- var player = this.player, playerConfig = this.playerConfig;
10145
+ var _this4 = this;
10146
+ var player = this.player, playerConfig = this.playerConfig, config = this.config;
9987
10147
  if (!this.isPIPAvailable() || this.isPip) {
9988
10148
  return;
9989
10149
  }
@@ -9992,7 +10152,62 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
9992
10152
  if (poster) {
9993
10153
  player.media.poster = util$1.typeOf(poster) === "String" ? poster : poster.poster;
9994
10154
  }
9995
- PIP2.checkWebkitSetPresentationMode(player.media) ? player.media.webkitSetPresentationMode("picture-in-picture") : player.media.requestPictureInPicture();
10155
+ if (config.preferDocument && this.isDocPIPAvailable()) {
10156
+ var pipOptions = {};
10157
+ if (config.width && config.height) {
10158
+ pipOptions.width = config.width;
10159
+ pipOptions.height = config.height;
10160
+ } else {
10161
+ var playerRect = player.root.getBoundingClientRect();
10162
+ pipOptions.width = playerRect.width;
10163
+ pipOptions.height = playerRect.height;
10164
+ }
10165
+ documentPictureInPicture.requestWindow(pipOptions).then(function(pipWin) {
10166
+ var docPiPNode = config.docPiPNode, docPiPStyle = config.docPiPStyle;
10167
+ _this4.enterPIPCallback();
10168
+ var pipRoot = docPiPNode || player.root;
10169
+ var parentNode = pipRoot.parentElement;
10170
+ var previousSibling = pipRoot.previousSibling;
10171
+ var nextSibling = pipRoot.nextSibling;
10172
+ _this4.copyStyleIntoPiPWindow(pipWin);
10173
+ var styles = document.createElement("style");
10174
+ styles.append("body{padding:0; margin:0;}");
10175
+ if (docPiPStyle) {
10176
+ var cssContent = "";
10177
+ if (typeof docPiPStyle === "string") {
10178
+ cssContent = docPiPStyle;
10179
+ } else if (typeof docPiPStyle === "function") {
10180
+ cssContent = docPiPStyle.call(config);
10181
+ }
10182
+ if (cssContent) {
10183
+ styles.append(cssContent);
10184
+ }
10185
+ } else if (pipRoot === player.root) {
10186
+ styles.append("\n .xgplayer{width: 100%!important; height: 100%!important;}\n ");
10187
+ }
10188
+ pipWin.document.head.append(styles);
10189
+ pipWin.document.body.append(pipRoot);
10190
+ pipWin.addEventListener("pagehide", function(event) {
10191
+ if (parentNode) {
10192
+ if (nextSibling) {
10193
+ parentNode.insertBefore(pipRoot, nextSibling);
10194
+ } else if (previousSibling) {
10195
+ parentNode.insertBefore(pipRoot, previousSibling.nextSibling);
10196
+ } else {
10197
+ parentNode.appendChild(pipRoot);
10198
+ }
10199
+ } else {
10200
+ }
10201
+ _this4.leavePIPCallback();
10202
+ }, {
10203
+ once: true
10204
+ });
10205
+ });
10206
+ } else if (PIP2.checkWebkitSetPresentationMode(player.media)) {
10207
+ player.media.webkitSetPresentationMode("picture-in-picture");
10208
+ } else {
10209
+ player.media.requestPictureInPicture();
10210
+ }
9996
10211
  return true;
9997
10212
  } catch (reason) {
9998
10213
  console.error("requestPiP", reason);
@@ -10005,7 +10220,14 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
10005
10220
  var player = this.player;
10006
10221
  try {
10007
10222
  if (this.isPIPAvailable() && this.isPip) {
10008
- PIP2.checkWebkitSetPresentationMode(player.media) ? player.media.webkitSetPresentationMode("inline") : document.exitPictureInPicture();
10223
+ var _documentPictureInPic;
10224
+ if (this.isDocPIPAvailable() && (_documentPictureInPic = documentPictureInPicture) !== null && _documentPictureInPic !== void 0 && _documentPictureInPic.window) {
10225
+ documentPictureInPicture.window.close();
10226
+ } else if (PIP2.checkWebkitSetPresentationMode(player.media)) {
10227
+ player.media.webkitSetPresentationMode("inline");
10228
+ } else {
10229
+ document.exitPictureInPicture();
10230
+ }
10009
10231
  }
10010
10232
  return true;
10011
10233
  } catch (reason) {
@@ -10016,15 +10238,21 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
10016
10238
  }, {
10017
10239
  key: "isPip",
10018
10240
  get: function get() {
10241
+ var _documentPictureInPic2;
10019
10242
  var player = this.player;
10020
- return document.pictureInPictureElement && document.pictureInPictureElement === player.media || player.media.webkitPresentationMode === PresentationMode.PIP;
10243
+ return !!(this.isDocPIPAvailable() && (_documentPictureInPic2 = documentPictureInPicture) !== null && _documentPictureInPic2 !== void 0 && _documentPictureInPic2.window) || document.pictureInPictureElement && document.pictureInPictureElement === player.media || player.media.webkitPresentationMode === PresentationMode.PIP;
10021
10244
  }
10022
10245
  }, {
10023
10246
  key: "isPIPAvailable",
10024
10247
  value: function isPIPAvailable() {
10025
10248
  var video = this.player.media;
10026
10249
  var _isEnabled = util$1.typeOf(document.pictureInPictureEnabled) === "Boolean" ? document.pictureInPictureEnabled : true;
10027
- return _isEnabled && (util$1.typeOf(video.disablePictureInPicture) === "Boolean" && !video.disablePictureInPicture || video.webkitSupportsPresentationMode && util$1.typeOf(video.webkitSetPresentationMode) === "Function");
10250
+ return _isEnabled && (util$1.typeOf(video.disablePictureInPicture) === "Boolean" && !video.disablePictureInPicture || video.webkitSupportsPresentationMode && util$1.typeOf(video.webkitSetPresentationMode) === "Function") || this.isDocPIPAvailable();
10251
+ }
10252
+ }, {
10253
+ key: "isDocPIPAvailable",
10254
+ value: function isDocPIPAvailable() {
10255
+ return "documentPictureInPicture" in window && /^(https|file)/.test(location.protocol);
10028
10256
  }
10029
10257
  }, {
10030
10258
  key: "destroy",
@@ -10056,7 +10284,12 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
10056
10284
  return {
10057
10285
  position: POSITIONS$2.CONTROLS_RIGHT,
10058
10286
  index: 6,
10059
- showIcon: false
10287
+ showIcon: false,
10288
+ preferDocument: false,
10289
+ width: void 0,
10290
+ height: void 0,
10291
+ docPiPNode: void 0,
10292
+ docPiPStyle: void 0
10060
10293
  };
10061
10294
  }
10062
10295
  }, {
@@ -12124,7 +12357,7 @@ class DefinitionPlugin extends OptionsIcon {
12124
12357
  }
12125
12358
  this._waitingStartTime = Date.now();
12126
12359
  const currentTime = this.player.currentTime;
12127
- this._timer = setTimeout(() => {
12360
+ this._timer = window.setTimeout(() => {
12128
12361
  if (this.player && this.player.currentTime <= currentTime + 0.1) {
12129
12362
  this.player.emit(Events$1.LONG_WAITING);
12130
12363
  if (this.config.needFallback) {
@@ -12229,7 +12462,8 @@ const NAME_MAP = {
12229
12462
  "plugin:hls": "veplayer.plugin.hls.[env].[ext]",
12230
12463
  "plugin:shaka": "veplayer.plugin.shaka.[env].[ext]",
12231
12464
  "plugin:rtm": "veplayer.plugin.rtm.[env].[ext]",
12232
- "plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]"
12465
+ "plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]",
12466
+ "plugin:drm": "veplayer.plugin.drm.[env].[ext]"
12233
12467
  };
12234
12468
  var DynamicModule = /* @__PURE__ */ ((DynamicModule2) => {
12235
12469
  DynamicModule2["BizVod"] = "biz:vod";
@@ -12240,6 +12474,7 @@ var DynamicModule = /* @__PURE__ */ ((DynamicModule2) => {
12240
12474
  DynamicModule2["PluginShaka"] = "plugin:shaka";
12241
12475
  DynamicModule2["PluginRtm"] = "plugin:rtm";
12242
12476
  DynamicModule2["PluginXgvideo"] = "plugin:xgvideo";
12477
+ DynamicModule2["PluginDrm"] = "plugin:drm";
12243
12478
  return DynamicModule2;
12244
12479
  })(DynamicModule || {});
12245
12480
  class Loader {
@@ -12283,13 +12518,13 @@ class Loader {
12283
12518
  src: src2 ?? moduleSrc,
12284
12519
  name,
12285
12520
  state: 0,
12286
- exports: {}
12521
+ exports: { __PLUGIN_NAME__: name }
12287
12522
  };
12288
12523
  this.modules[name] = module;
12289
12524
  this.mountPromiseMap[name] = this._mount(module);
12290
12525
  return this.mountPromiseMap[name];
12291
12526
  });
12292
- __publicField(this, "register", (name, exports) => {
12527
+ __publicField(this, "registerPlugin", (name, exports) => {
12293
12528
  if (!this._moduleSystem) {
12294
12529
  throw new Error(
12295
12530
  `You have to specify moduleSystem first, call setModuleSystem(moduleSystem) to set module system`
@@ -12316,6 +12551,11 @@ class Loader {
12316
12551
  }
12317
12552
  return this.modules[name].exports;
12318
12553
  });
12554
+ __publicField(this, "register", (exports) => {
12555
+ return exports.map((exportModule) => {
12556
+ return this.registerPlugin(exportModule.__PLUGIN_NAME__, exportModule);
12557
+ });
12558
+ });
12319
12559
  this._baseUrl = options.baseUrl;
12320
12560
  }
12321
12561
  get baseUrl() {
@@ -12355,6 +12595,7 @@ const baseUrl = src.slice(0, src.lastIndexOf("/"));
12355
12595
  const loader = new Loader({
12356
12596
  baseUrl
12357
12597
  });
12598
+ const registerPlugin = loader.registerPlugin;
12358
12599
  const register2 = loader.register;
12359
12600
  function setModuleSystem(moduleSystem) {
12360
12601
  loader.setModuleSystem(moduleSystem);
@@ -12544,7 +12785,7 @@ class Autoplay extends Plugin {
12544
12785
  }
12545
12786
  wxCanPlayFn() {
12546
12787
  window.WeixinJSBridge && window.WeixinJSBridge.invoke("getNetworkType", {}, () => {
12547
- this._wxTimer = setTimeout(() => {
12788
+ this._wxTimer = window.setTimeout(() => {
12548
12789
  this._wxTimer && clearTimeout(this._wxTimer);
12549
12790
  const ret = this.player.play();
12550
12791
  if (ret && ret.then) {
@@ -12618,8 +12859,8 @@ class Autoplay extends Plugin {
12618
12859
  this._state.showUnmuteBt = true;
12619
12860
  this._state.mode = 1;
12620
12861
  this.renderUnmuteBt();
12621
- this._timer = setTimeout(() => {
12622
- this._timer && clearTimeout(this._timer);
12862
+ this._timer = window.setTimeout(() => {
12863
+ this._timer && window.clearTimeout(this._timer);
12623
12864
  const ret = this.player.play();
12624
12865
  if (ret && ret.then) {
12625
12866
  ret.then(() => {
@@ -13022,6 +13263,7 @@ const EN$1 = {
13022
13263
  MEDIA_ERR_CODEC_NOT_SUPPORTED: "Audio/video codec is not supported",
13023
13264
  MEDIA_ERR_URL_EMPTY: "The stream address is not specified",
13024
13265
  DRM: "Permission verification failed",
13266
+ DRM_LICENSE: "Commercial DRM Permission verification failed",
13025
13267
  OTHER: "Unknown error",
13026
13268
  RUNTIME: "An error occurred, Please try again",
13027
13269
  MODULE_LOAD_ERROR: "CDN fetch error",
@@ -13048,6 +13290,7 @@ const ZH_CN$1 = {
13048
13290
  MEDIA_ERR_CODEC_NOT_SUPPORTED: "不支持的音频/视频格式",
13049
13291
  MEDIA_ERR_URL_EMPTY: "当前播放地址为空",
13050
13292
  DRM: "权限验证失败",
13293
+ DRM_LICENSE: "商业 DRM LICENSE 鉴权失败",
13051
13294
  OTHER: "其他报错",
13052
13295
  RUNTIME: "播放异常,请重试",
13053
13296
  MODULE_LOAD_ERROR: "插件模块加载异常",
@@ -13437,7 +13680,7 @@ class VePlayerBase {
13437
13680
  /**
13438
13681
  * @brief 调用此方法监听指定事件,事件处理函数只执行一次。
13439
13682
  * @param event 表示事件的名称。
13440
- * @param callback 表示事件的名称。
13683
+ * @param callback 表示事件的回调函数。
13441
13684
  */
13442
13685
  once(event, callback) {
13443
13686
  var _a;
@@ -13453,7 +13696,7 @@ class VePlayerBase {
13453
13696
  /**
13454
13697
  * @brief 调用此方法解绑或移除指定事件的事件监听。
13455
13698
  * @param event 表示事件的名称。
13456
- * @param callback 表示事件的名称。
13699
+ * @param callback 表示事件的回调函数。
13457
13700
  */
13458
13701
  off(event, callback) {
13459
13702
  var _a;
@@ -13482,8 +13725,8 @@ class VePlayerBase {
13482
13725
  }
13483
13726
  /**
13484
13727
  * @brief 调用此方法监听指定事件。
13485
- * @param event 事件。
13486
- * @param callback 事件回调。
13728
+ * @param event 表示事件名称。
13729
+ * @param callback 表示事件的回调函数。
13487
13730
  */
13488
13731
  on(event, callback) {
13489
13732
  var _a;
@@ -18287,7 +18530,7 @@ const getFlvStrategy = async (options) => {
18287
18530
  const combineOptions$1 = combineOptions([mseStrategy, softStrategy]);
18288
18531
  const plugins = [];
18289
18532
  if (enableLowLatency) {
18290
- combineOptions$1.url = appendSearchParams(options.url, { abr_pt: abrPts });
18533
+ combineOptions$1.url = appendSearchParams(options.url, { abr_pts: abrPts });
18291
18534
  }
18292
18535
  if (mseModule) {
18293
18536
  plugins.push(mseModule.FlvPlugin);
@@ -18555,6 +18798,29 @@ const getRtmStrategy = async (options, player) => {
18555
18798
  plugins: rtmCdn ? [rtmCdn] : []
18556
18799
  };
18557
18800
  };
18801
+ var DrmType = /* @__PURE__ */ ((DrmType2) => {
18802
+ DrmType2["Fairplay"] = "fairplay";
18803
+ return DrmType2;
18804
+ })(DrmType || {});
18805
+ function getDrmType(drm) {
18806
+ if ((drm == null ? void 0 : drm.fairplay) && (sniffer$1.browser === "safari" || sniffer$1.os.isIos)) {
18807
+ return "fairplay";
18808
+ }
18809
+ return;
18810
+ }
18811
+ function isMseSupportedWithDrm({
18812
+ drm,
18813
+ streamType
18814
+ }) {
18815
+ const drmType = getDrmType(drm);
18816
+ if (!drmType) {
18817
+ return true;
18818
+ }
18819
+ if (drmType === "fairplay" && streamType === "hls") {
18820
+ return false;
18821
+ }
18822
+ return true;
18823
+ }
18558
18824
  const getTypeStrategy = async (options, player) => {
18559
18825
  const type = options.url ? util.getStreamType(options.url) : "";
18560
18826
  if (!type || type === "unknown") {
@@ -18567,6 +18833,9 @@ const getTypeStrategy = async (options, player) => {
18567
18833
  return await getFlvStrategy(options);
18568
18834
  }
18569
18835
  if (type === "hls") {
18836
+ if (!isMseSupportedWithDrm({ drm: options.drm, streamType: type })) {
18837
+ return { options: {}, plugins: [] };
18838
+ }
18570
18839
  return await getHlsStrategy(options);
18571
18840
  }
18572
18841
  return { options: {}, plugins: [] };
@@ -18701,9 +18970,9 @@ var debounce$1 = /* @__PURE__ */ getDefaultExportFromCjs(lodash_debounce);
18701
18970
  const Events = {
18702
18971
  ...Events$1,
18703
18972
  // 直播的Events
18704
- TIME_SHIFT_CHANGE: "time_shift_change",
18973
+ TIME_SHIFT_CHANGE: "timeShiftChange",
18705
18974
  // 切换时移状态
18706
- REFRESH_CLICK: "refresh_click"
18975
+ REFRESH_CLICK: "refreshClick"
18707
18976
  // 触发刷新
18708
18977
  };
18709
18978
  function RefreshIcon() {
@@ -21243,9 +21512,6 @@ const hashCode = (str) => {
21243
21512
  const generateSessionId = () => {
21244
21513
  return v4().replace(/-/g, "") + "." + Date.now() + "." + hashCode(v4().replace(/-/g, ""));
21245
21514
  };
21246
- const CN_APPID = 468759;
21247
- const CHANNEL = "cn";
21248
- const CHANNEL_DOMAIN = "//mcs.volceapplog.com";
21249
21515
  class Logger extends Plugin {
21250
21516
  constructor() {
21251
21517
  super(...arguments);
@@ -21300,9 +21566,8 @@ class Logger extends Plugin {
21300
21566
  }
21301
21567
  _createTea() {
21302
21568
  q.init({
21303
- app_id: CN_APPID,
21304
- channel: CHANNEL,
21305
- channel_domain: CHANNEL_DOMAIN
21569
+ app_id: 468759,
21570
+ channel: "cn"
21306
21571
  });
21307
21572
  q.start();
21308
21573
  q.config({
@@ -21321,9 +21586,9 @@ class Logger extends Plugin {
21321
21586
  user_id: this._userId,
21322
21587
  device_id: this._deviceId,
21323
21588
  ext: {
21324
- veplayer_version: "2.2.0-rc.2",
21325
- flv_version: "3.0.11-alpha.2",
21326
- hls_version: "3.0.11-alpha.2",
21589
+ veplayer_version: "2.3.0-rc.0",
21590
+ flv_version: "3.0.12",
21591
+ hls_version: "3.0.12",
21327
21592
  rts_version: "0.2.0-alpha.5"
21328
21593
  }
21329
21594
  });
@@ -21471,7 +21736,7 @@ class InfoPanel extends Plugin {
21471
21736
  _tick() {
21472
21737
  clearTimeout(this._pollTimer);
21473
21738
  this._renderPanel();
21474
- this._pollTimer = setTimeout(() => {
21739
+ this._pollTimer = window.setTimeout(() => {
21475
21740
  this._tick();
21476
21741
  }, this.config.interval);
21477
21742
  }
@@ -21587,6 +21852,37 @@ const ZH_CN = {
21587
21852
  DECODE_INFO: "软解信息",
21588
21853
  REFRESH: "刷新"
21589
21854
  };
21855
+ const getDrmStrategy = async (options, player) => {
21856
+ var _a;
21857
+ const drmType = getDrmType(options.drm);
21858
+ if (options.url && drmType === DrmType.Fairplay) {
21859
+ try {
21860
+ const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
21861
+ const [drmPlugin, drmConfig] = await Promise.all([
21862
+ load(DynamicModule.PluginDrm).then((module) => module.DrmPlugin).catch(() => void 0),
21863
+ getDrmConfig == null ? void 0 : getDrmConfig({
21864
+ url: options.url
21865
+ })
21866
+ ]);
21867
+ const fairplayDrmConfig = Object.assign(
21868
+ {},
21869
+ originFairplayConfig,
21870
+ options == null ? void 0 : options.drm,
21871
+ drmConfig
21872
+ );
21873
+ drmConfig && (player == null ? void 0 : player.updateDrmConfig(drmConfig));
21874
+ return {
21875
+ options: {
21876
+ drm: fairplayDrmConfig
21877
+ },
21878
+ plugins: drmPlugin ? [drmPlugin] : []
21879
+ };
21880
+ } catch (error2) {
21881
+ console.log(error2);
21882
+ }
21883
+ }
21884
+ return {};
21885
+ };
21590
21886
  VeI18n.extend([
21591
21887
  {
21592
21888
  LANG: "zh-cn",
@@ -21642,6 +21938,14 @@ class VePlayerLive extends VePlayerBase {
21642
21938
  var _a;
21643
21939
  (_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
21644
21940
  }
21941
+ /** {zh}
21942
+ * @brief 调用此方法更新 DRM 鉴权配置。
21943
+ * @hidden
21944
+ */
21945
+ updateDrmConfig(config) {
21946
+ var _a, _b, _c;
21947
+ (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
21948
+ }
21645
21949
  }
21646
21950
  async function createLivePlayer(options) {
21647
21951
  var _a, _b;
@@ -21666,7 +21970,16 @@ async function createLivePlayer(options) {
21666
21970
  };
21667
21971
  },
21668
21972
  async preparePlugins(url) {
21669
- return getTypeStrategy({ ...finalOptions, url }, player);
21973
+ const [typeStrategy, drmStrategy] = await Promise.all([
21974
+ getTypeStrategy({ ...finalOptions, url }, player),
21975
+ getDrmStrategy({ ...finalOptions, url }, player)
21976
+ ]);
21977
+ const { options: options2, plugins } = typeStrategy ?? {};
21978
+ const { options: drmOptions, plugins: drmPlugins } = drmStrategy ?? {};
21979
+ return {
21980
+ options: Object.assign({}, options2, drmOptions),
21981
+ plugins: [...plugins ?? [], ...drmPlugins ?? []]
21982
+ };
21670
21983
  }
21671
21984
  },
21672
21985
  VePlayerLive
@@ -21699,6 +22012,7 @@ export {
21699
22012
  Degradation,
21700
22013
  DynamicModule,
21701
22014
  EN$1 as EN,
22015
+ ListType,
21702
22016
  POSITIONS$1 as POSITIONS,
21703
22017
  Plugin,
21704
22018
  RTMCodec,
@@ -21712,5 +22026,6 @@ export {
21712
22026
  live,
21713
22027
  load,
21714
22028
  register2 as register,
22029
+ registerPlugin,
21715
22030
  util
21716
22031
  };