@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
@@ -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 = {
@@ -6490,7 +6632,7 @@ var __publicField = (obj, key, value) => {
6490
6632
  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
6633
  super(message);
6492
6634
  /**
6493
- * @brief 错误码,对应[错误码字典](#错误码)。
6635
+ * @brief 错误码,对应[错误码字典](#ErrorCode)。
6494
6636
  */
6495
6637
  __publicField(this, "errorCode");
6496
6638
  /**
@@ -6563,7 +6705,7 @@ var __publicField = (obj, key, value) => {
6563
6705
  }
6564
6706
  }, {
6565
6707
  key: "show",
6566
- value: function show() {
6708
+ value: function show(value) {
6567
6709
  util$1.removeClass(this.root, "hide");
6568
6710
  }
6569
6711
  }, {
@@ -6642,10 +6784,11 @@ var __publicField = (obj, key, value) => {
6642
6784
  }, {
6643
6785
  key: "render",
6644
6786
  value: function render() {
6645
- var _this$config = this.config, poster = _this$config.poster, hideCanplay = _this$config.hideCanplay, fillMode = _this$config.fillMode;
6787
+ var _this$config = this.config, poster = _this$config.poster, hideCanplay = _this$config.hideCanplay, fillMode = _this$config.fillMode, notHidden = _this$config.notHidden;
6646
6788
  var _bg = this.getBgSize(fillMode);
6647
6789
  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>');
6790
+ var className = notHidden ? "xg-not-hidden" : hideCanplay ? "xg-showplay" : "";
6791
+ return '<xg-poster class="xgplayer-poster '.concat(className, '" style="').concat(style, '">\n </xg-poster>');
6649
6792
  }
6650
6793
  }], [{
6651
6794
  key: "pluginName",
@@ -6658,6 +6801,7 @@ var __publicField = (obj, key, value) => {
6658
6801
  return {
6659
6802
  isEndedShow: true,
6660
6803
  hideCanplay: false,
6804
+ notHidden: false,
6661
6805
  poster: "",
6662
6806
  fillMode: "fixWidth"
6663
6807
  };
@@ -6801,7 +6945,7 @@ var __publicField = (obj, key, value) => {
6801
6945
  }
6802
6946
  }, {
6803
6947
  key: "show",
6804
- value: function show() {
6948
+ value: function show(value) {
6805
6949
  util$1.removeClass(this.root, "hide");
6806
6950
  }
6807
6951
  }, {
@@ -7763,14 +7907,14 @@ var __publicField = (obj, key, value) => {
7763
7907
  key: "initEvents",
7764
7908
  value: function initEvents() {
7765
7909
  var _this3 = this;
7766
- var _this$player = this.player, video = _this$player.video, root2 = _this$player.root;
7910
+ var _this$player = this.player, media = _this$player.media, root2 = _this$player.root;
7767
7911
  var enableContextmenu = this.playerConfig.enableContextmenu;
7768
7912
  root2 && root2.addEventListener("click", this.onVideoClick, false);
7769
7913
  root2 && root2.addEventListener("dblclick", this.onVideoDblClick, false);
7770
7914
  Object.keys(MOUSE_EVENTS).map(function(item) {
7771
7915
  root2.addEventListener(item, _this3[MOUSE_EVENTS[item]], false);
7772
7916
  });
7773
- enableContextmenu && video && video.addEventListener("contextmenu", this.onContextmenu, false);
7917
+ !enableContextmenu && media && media.addEventListener("contextmenu", this.onContextmenu, false);
7774
7918
  }
7775
7919
  }, {
7776
7920
  key: "switchPlayPause",
@@ -9494,16 +9638,6 @@ var __publicField = (obj, key, value) => {
9494
9638
  }
9495
9639
  }
9496
9640
  }
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
9641
  }, {
9508
9642
  key: "render",
9509
9643
  value: function render() {
@@ -9959,11 +10093,14 @@ var __publicField = (obj, key, value) => {
9959
10093
  }, 0);
9960
10094
  !paused && player.mediaPlay();
9961
10095
  _this3.setAttr("data-state", "normal");
10096
+ _this3.pipWindow = null;
9962
10097
  player.emit(PIP_CHANGE, false);
9963
10098
  };
9964
10099
  this.enterPIPCallback = function(e2) {
9965
10100
  player.emit(PIP_CHANGE, true);
9966
- _this3.pipWindow = e2.pictureInPictureWindow;
10101
+ if (e2 !== null && e2 !== void 0 && e2.pictureInPictureWindow) {
10102
+ _this3.pipWindow = e2.pictureInPictureWindow;
10103
+ }
9967
10104
  _this3.setAttr("data-state", "pip");
9968
10105
  };
9969
10106
  this.onWebkitpresentationmodechanged = function(e2) {
@@ -9984,10 +10121,33 @@ var __publicField = (obj, key, value) => {
9984
10121
  PIP2.checkWebkitSetPresentationMode(player.media) && player.media.addEventListener("webkitpresentationmodechanged", this.onWebkitpresentationmodechanged);
9985
10122
  }
9986
10123
  }
10124
+ }, {
10125
+ key: "copyStyleIntoPiPWindow",
10126
+ value: function copyStyleIntoPiPWindow(pipWin) {
10127
+ var textContent = _toConsumableArray(document.styleSheets).map(function(style2) {
10128
+ try {
10129
+ return _toConsumableArray(style2.cssRules).map(function(rule) {
10130
+ return rule.cssText;
10131
+ }).join("");
10132
+ } catch (e2) {
10133
+ var link = document.createElement("link");
10134
+ link.rel = "stylesheet";
10135
+ link.type = style2.type;
10136
+ link.media = style2.media;
10137
+ link.href = style2.href;
10138
+ pipWin.document.head.appendChild(link);
10139
+ }
10140
+ return "";
10141
+ }).filter(Boolean).join("\n");
10142
+ var style = document.createElement("style");
10143
+ style.textContent = textContent;
10144
+ pipWin.document.head.appendChild(style);
10145
+ }
9987
10146
  }, {
9988
10147
  key: "requestPIP",
9989
10148
  value: function requestPIP() {
9990
- var player = this.player, playerConfig = this.playerConfig;
10149
+ var _this4 = this;
10150
+ var player = this.player, playerConfig = this.playerConfig, config = this.config;
9991
10151
  if (!this.isPIPAvailable() || this.isPip) {
9992
10152
  return;
9993
10153
  }
@@ -9996,7 +10156,62 @@ var __publicField = (obj, key, value) => {
9996
10156
  if (poster) {
9997
10157
  player.media.poster = util$1.typeOf(poster) === "String" ? poster : poster.poster;
9998
10158
  }
9999
- PIP2.checkWebkitSetPresentationMode(player.media) ? player.media.webkitSetPresentationMode("picture-in-picture") : player.media.requestPictureInPicture();
10159
+ if (config.preferDocument && this.isDocPIPAvailable()) {
10160
+ var pipOptions = {};
10161
+ if (config.width && config.height) {
10162
+ pipOptions.width = config.width;
10163
+ pipOptions.height = config.height;
10164
+ } else {
10165
+ var playerRect = player.root.getBoundingClientRect();
10166
+ pipOptions.width = playerRect.width;
10167
+ pipOptions.height = playerRect.height;
10168
+ }
10169
+ documentPictureInPicture.requestWindow(pipOptions).then(function(pipWin) {
10170
+ var docPiPNode = config.docPiPNode, docPiPStyle = config.docPiPStyle;
10171
+ _this4.enterPIPCallback();
10172
+ var pipRoot = docPiPNode || player.root;
10173
+ var parentNode = pipRoot.parentElement;
10174
+ var previousSibling = pipRoot.previousSibling;
10175
+ var nextSibling = pipRoot.nextSibling;
10176
+ _this4.copyStyleIntoPiPWindow(pipWin);
10177
+ var styles = document.createElement("style");
10178
+ styles.append("body{padding:0; margin:0;}");
10179
+ if (docPiPStyle) {
10180
+ var cssContent = "";
10181
+ if (typeof docPiPStyle === "string") {
10182
+ cssContent = docPiPStyle;
10183
+ } else if (typeof docPiPStyle === "function") {
10184
+ cssContent = docPiPStyle.call(config);
10185
+ }
10186
+ if (cssContent) {
10187
+ styles.append(cssContent);
10188
+ }
10189
+ } else if (pipRoot === player.root) {
10190
+ styles.append("\n .xgplayer{width: 100%!important; height: 100%!important;}\n ");
10191
+ }
10192
+ pipWin.document.head.append(styles);
10193
+ pipWin.document.body.append(pipRoot);
10194
+ pipWin.addEventListener("pagehide", function(event) {
10195
+ if (parentNode) {
10196
+ if (nextSibling) {
10197
+ parentNode.insertBefore(pipRoot, nextSibling);
10198
+ } else if (previousSibling) {
10199
+ parentNode.insertBefore(pipRoot, previousSibling.nextSibling);
10200
+ } else {
10201
+ parentNode.appendChild(pipRoot);
10202
+ }
10203
+ } else {
10204
+ }
10205
+ _this4.leavePIPCallback();
10206
+ }, {
10207
+ once: true
10208
+ });
10209
+ });
10210
+ } else if (PIP2.checkWebkitSetPresentationMode(player.media)) {
10211
+ player.media.webkitSetPresentationMode("picture-in-picture");
10212
+ } else {
10213
+ player.media.requestPictureInPicture();
10214
+ }
10000
10215
  return true;
10001
10216
  } catch (reason) {
10002
10217
  console.error("requestPiP", reason);
@@ -10009,7 +10224,14 @@ var __publicField = (obj, key, value) => {
10009
10224
  var player = this.player;
10010
10225
  try {
10011
10226
  if (this.isPIPAvailable() && this.isPip) {
10012
- PIP2.checkWebkitSetPresentationMode(player.media) ? player.media.webkitSetPresentationMode("inline") : document.exitPictureInPicture();
10227
+ var _documentPictureInPic;
10228
+ if (this.isDocPIPAvailable() && (_documentPictureInPic = documentPictureInPicture) !== null && _documentPictureInPic !== void 0 && _documentPictureInPic.window) {
10229
+ documentPictureInPicture.window.close();
10230
+ } else if (PIP2.checkWebkitSetPresentationMode(player.media)) {
10231
+ player.media.webkitSetPresentationMode("inline");
10232
+ } else {
10233
+ document.exitPictureInPicture();
10234
+ }
10013
10235
  }
10014
10236
  return true;
10015
10237
  } catch (reason) {
@@ -10020,15 +10242,21 @@ var __publicField = (obj, key, value) => {
10020
10242
  }, {
10021
10243
  key: "isPip",
10022
10244
  get: function get() {
10245
+ var _documentPictureInPic2;
10023
10246
  var player = this.player;
10024
- return document.pictureInPictureElement && document.pictureInPictureElement === player.media || player.media.webkitPresentationMode === PresentationMode.PIP;
10247
+ return !!(this.isDocPIPAvailable() && (_documentPictureInPic2 = documentPictureInPicture) !== null && _documentPictureInPic2 !== void 0 && _documentPictureInPic2.window) || document.pictureInPictureElement && document.pictureInPictureElement === player.media || player.media.webkitPresentationMode === PresentationMode.PIP;
10025
10248
  }
10026
10249
  }, {
10027
10250
  key: "isPIPAvailable",
10028
10251
  value: function isPIPAvailable() {
10029
10252
  var video = this.player.media;
10030
10253
  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");
10254
+ return _isEnabled && (util$1.typeOf(video.disablePictureInPicture) === "Boolean" && !video.disablePictureInPicture || video.webkitSupportsPresentationMode && util$1.typeOf(video.webkitSetPresentationMode) === "Function") || this.isDocPIPAvailable();
10255
+ }
10256
+ }, {
10257
+ key: "isDocPIPAvailable",
10258
+ value: function isDocPIPAvailable() {
10259
+ return "documentPictureInPicture" in window && /^(https|file)/.test(location.protocol);
10032
10260
  }
10033
10261
  }, {
10034
10262
  key: "destroy",
@@ -10060,7 +10288,12 @@ var __publicField = (obj, key, value) => {
10060
10288
  return {
10061
10289
  position: POSITIONS$2.CONTROLS_RIGHT,
10062
10290
  index: 6,
10063
- showIcon: false
10291
+ showIcon: false,
10292
+ preferDocument: false,
10293
+ width: void 0,
10294
+ height: void 0,
10295
+ docPiPNode: void 0,
10296
+ docPiPStyle: void 0
10064
10297
  };
10065
10298
  }
10066
10299
  }, {
@@ -12128,7 +12361,7 @@ var __publicField = (obj, key, value) => {
12128
12361
  }
12129
12362
  this._waitingStartTime = Date.now();
12130
12363
  const currentTime = this.player.currentTime;
12131
- this._timer = setTimeout(() => {
12364
+ this._timer = window.setTimeout(() => {
12132
12365
  if (this.player && this.player.currentTime <= currentTime + 0.1) {
12133
12366
  this.player.emit(Events$1.LONG_WAITING);
12134
12367
  if (this.config.needFallback) {
@@ -12233,7 +12466,8 @@ var __publicField = (obj, key, value) => {
12233
12466
  "plugin:hls": "veplayer.plugin.hls.[env].[ext]",
12234
12467
  "plugin:shaka": "veplayer.plugin.shaka.[env].[ext]",
12235
12468
  "plugin:rtm": "veplayer.plugin.rtm.[env].[ext]",
12236
- "plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]"
12469
+ "plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]",
12470
+ "plugin:drm": "veplayer.plugin.drm.[env].[ext]"
12237
12471
  };
12238
12472
  var DynamicModule = /* @__PURE__ */ ((DynamicModule2) => {
12239
12473
  DynamicModule2["BizVod"] = "biz:vod";
@@ -12244,6 +12478,7 @@ var __publicField = (obj, key, value) => {
12244
12478
  DynamicModule2["PluginShaka"] = "plugin:shaka";
12245
12479
  DynamicModule2["PluginRtm"] = "plugin:rtm";
12246
12480
  DynamicModule2["PluginXgvideo"] = "plugin:xgvideo";
12481
+ DynamicModule2["PluginDrm"] = "plugin:drm";
12247
12482
  return DynamicModule2;
12248
12483
  })(DynamicModule || {});
12249
12484
  class Loader {
@@ -12287,13 +12522,13 @@ var __publicField = (obj, key, value) => {
12287
12522
  src: src2 ?? moduleSrc,
12288
12523
  name,
12289
12524
  state: 0,
12290
- exports: {}
12525
+ exports: { __PLUGIN_NAME__: name }
12291
12526
  };
12292
12527
  this.modules[name] = module2;
12293
12528
  this.mountPromiseMap[name] = this._mount(module2);
12294
12529
  return this.mountPromiseMap[name];
12295
12530
  });
12296
- __publicField(this, "register", (name, exports3) => {
12531
+ __publicField(this, "registerPlugin", (name, exports3) => {
12297
12532
  if (!this._moduleSystem) {
12298
12533
  throw new Error(
12299
12534
  `You have to specify moduleSystem first, call setModuleSystem(moduleSystem) to set module system`
@@ -12320,6 +12555,11 @@ var __publicField = (obj, key, value) => {
12320
12555
  }
12321
12556
  return this.modules[name].exports;
12322
12557
  });
12558
+ __publicField(this, "register", (exports3) => {
12559
+ return exports3.map((exportModule) => {
12560
+ return this.registerPlugin(exportModule.__PLUGIN_NAME__, exportModule);
12561
+ });
12562
+ });
12323
12563
  this._baseUrl = options.baseUrl;
12324
12564
  }
12325
12565
  get baseUrl() {
@@ -12359,6 +12599,7 @@ var __publicField = (obj, key, value) => {
12359
12599
  const loader = new Loader({
12360
12600
  baseUrl
12361
12601
  });
12602
+ const registerPlugin = loader.registerPlugin;
12362
12603
  const register = loader.register;
12363
12604
  function setModuleSystem(moduleSystem) {
12364
12605
  loader.setModuleSystem(moduleSystem);
@@ -12548,7 +12789,7 @@ var __publicField = (obj, key, value) => {
12548
12789
  }
12549
12790
  wxCanPlayFn() {
12550
12791
  window.WeixinJSBridge && window.WeixinJSBridge.invoke("getNetworkType", {}, () => {
12551
- this._wxTimer = setTimeout(() => {
12792
+ this._wxTimer = window.setTimeout(() => {
12552
12793
  this._wxTimer && clearTimeout(this._wxTimer);
12553
12794
  const ret = this.player.play();
12554
12795
  if (ret && ret.then) {
@@ -12622,8 +12863,8 @@ var __publicField = (obj, key, value) => {
12622
12863
  this._state.showUnmuteBt = true;
12623
12864
  this._state.mode = 1;
12624
12865
  this.renderUnmuteBt();
12625
- this._timer = setTimeout(() => {
12626
- this._timer && clearTimeout(this._timer);
12866
+ this._timer = window.setTimeout(() => {
12867
+ this._timer && window.clearTimeout(this._timer);
12627
12868
  const ret = this.player.play();
12628
12869
  if (ret && ret.then) {
12629
12870
  ret.then(() => {
@@ -13026,6 +13267,7 @@ var __publicField = (obj, key, value) => {
13026
13267
  MEDIA_ERR_CODEC_NOT_SUPPORTED: "Audio/video codec is not supported",
13027
13268
  MEDIA_ERR_URL_EMPTY: "The stream address is not specified",
13028
13269
  DRM: "Permission verification failed",
13270
+ DRM_LICENSE: "Commercial DRM Permission verification failed",
13029
13271
  OTHER: "Unknown error",
13030
13272
  RUNTIME: "An error occurred, Please try again",
13031
13273
  MODULE_LOAD_ERROR: "CDN fetch error",
@@ -13052,6 +13294,7 @@ var __publicField = (obj, key, value) => {
13052
13294
  MEDIA_ERR_CODEC_NOT_SUPPORTED: "不支持的音频/视频格式",
13053
13295
  MEDIA_ERR_URL_EMPTY: "当前播放地址为空",
13054
13296
  DRM: "权限验证失败",
13297
+ DRM_LICENSE: "商业 DRM LICENSE 鉴权失败",
13055
13298
  OTHER: "其他报错",
13056
13299
  RUNTIME: "播放异常,请重试",
13057
13300
  MODULE_LOAD_ERROR: "插件模块加载异常",
@@ -13441,7 +13684,7 @@ var __publicField = (obj, key, value) => {
13441
13684
  /**
13442
13685
  * @brief 调用此方法监听指定事件,事件处理函数只执行一次。
13443
13686
  * @param event 表示事件的名称。
13444
- * @param callback 表示事件的名称。
13687
+ * @param callback 表示事件的回调函数。
13445
13688
  */
13446
13689
  once(event, callback) {
13447
13690
  var _a;
@@ -13457,7 +13700,7 @@ var __publicField = (obj, key, value) => {
13457
13700
  /**
13458
13701
  * @brief 调用此方法解绑或移除指定事件的事件监听。
13459
13702
  * @param event 表示事件的名称。
13460
- * @param callback 表示事件的名称。
13703
+ * @param callback 表示事件的回调函数。
13461
13704
  */
13462
13705
  off(event, callback) {
13463
13706
  var _a;
@@ -13486,8 +13729,8 @@ var __publicField = (obj, key, value) => {
13486
13729
  }
13487
13730
  /**
13488
13731
  * @brief 调用此方法监听指定事件。
13489
- * @param event 事件。
13490
- * @param callback 事件回调。
13732
+ * @param event 表示事件名称。
13733
+ * @param callback 表示事件的回调函数。
13491
13734
  */
13492
13735
  on(event, callback) {
13493
13736
  var _a;
@@ -18291,7 +18534,7 @@ var __publicField = (obj, key, value) => {
18291
18534
  const combineOptions$1 = combineOptions([mseStrategy, softStrategy]);
18292
18535
  const plugins = [];
18293
18536
  if (enableLowLatency) {
18294
- combineOptions$1.url = appendSearchParams(options.url, { abr_pt: abrPts });
18537
+ combineOptions$1.url = appendSearchParams(options.url, { abr_pts: abrPts });
18295
18538
  }
18296
18539
  if (mseModule) {
18297
18540
  plugins.push(mseModule.FlvPlugin);
@@ -18559,6 +18802,29 @@ var __publicField = (obj, key, value) => {
18559
18802
  plugins: rtmCdn ? [rtmCdn] : []
18560
18803
  };
18561
18804
  };
18805
+ var DrmType = /* @__PURE__ */ ((DrmType2) => {
18806
+ DrmType2["Fairplay"] = "fairplay";
18807
+ return DrmType2;
18808
+ })(DrmType || {});
18809
+ function getDrmType(drm) {
18810
+ if ((drm == null ? void 0 : drm.fairplay) && (sniffer$1.browser === "safari" || sniffer$1.os.isIos)) {
18811
+ return "fairplay";
18812
+ }
18813
+ return;
18814
+ }
18815
+ function isMseSupportedWithDrm({
18816
+ drm,
18817
+ streamType
18818
+ }) {
18819
+ const drmType = getDrmType(drm);
18820
+ if (!drmType) {
18821
+ return true;
18822
+ }
18823
+ if (drmType === "fairplay" && streamType === "hls") {
18824
+ return false;
18825
+ }
18826
+ return true;
18827
+ }
18562
18828
  const getTypeStrategy = async (options, player) => {
18563
18829
  const type = options.url ? util.getStreamType(options.url) : "";
18564
18830
  if (!type || type === "unknown") {
@@ -18571,6 +18837,9 @@ var __publicField = (obj, key, value) => {
18571
18837
  return await getFlvStrategy(options);
18572
18838
  }
18573
18839
  if (type === "hls") {
18840
+ if (!isMseSupportedWithDrm({ drm: options.drm, streamType: type })) {
18841
+ return { options: {}, plugins: [] };
18842
+ }
18574
18843
  return await getHlsStrategy(options);
18575
18844
  }
18576
18845
  return { options: {}, plugins: [] };
@@ -18705,9 +18974,9 @@ var __publicField = (obj, key, value) => {
18705
18974
  const Events = {
18706
18975
  ...Events$1,
18707
18976
  // 直播的Events
18708
- TIME_SHIFT_CHANGE: "time_shift_change",
18977
+ TIME_SHIFT_CHANGE: "timeShiftChange",
18709
18978
  // 切换时移状态
18710
- REFRESH_CLICK: "refresh_click"
18979
+ REFRESH_CLICK: "refreshClick"
18711
18980
  // 触发刷新
18712
18981
  };
18713
18982
  function RefreshIcon() {
@@ -21247,9 +21516,6 @@ var __publicField = (obj, key, value) => {
21247
21516
  const generateSessionId = () => {
21248
21517
  return v4().replace(/-/g, "") + "." + Date.now() + "." + hashCode(v4().replace(/-/g, ""));
21249
21518
  };
21250
- const CN_APPID = 468759;
21251
- const CHANNEL = "cn";
21252
- const CHANNEL_DOMAIN = "//mcs.volceapplog.com";
21253
21519
  class Logger extends Plugin {
21254
21520
  constructor() {
21255
21521
  super(...arguments);
@@ -21304,9 +21570,8 @@ var __publicField = (obj, key, value) => {
21304
21570
  }
21305
21571
  _createTea() {
21306
21572
  q.init({
21307
- app_id: CN_APPID,
21308
- channel: CHANNEL,
21309
- channel_domain: CHANNEL_DOMAIN
21573
+ app_id: 468759,
21574
+ channel: "cn"
21310
21575
  });
21311
21576
  q.start();
21312
21577
  q.config({
@@ -21325,9 +21590,9 @@ var __publicField = (obj, key, value) => {
21325
21590
  user_id: this._userId,
21326
21591
  device_id: this._deviceId,
21327
21592
  ext: {
21328
- veplayer_version: "2.2.0-rc.2",
21329
- flv_version: "3.0.11-alpha.2",
21330
- hls_version: "3.0.11-alpha.2",
21593
+ veplayer_version: "2.3.0-rc.0",
21594
+ flv_version: "3.0.12",
21595
+ hls_version: "3.0.12",
21331
21596
  rts_version: "0.2.0-alpha.5"
21332
21597
  }
21333
21598
  });
@@ -21475,7 +21740,7 @@ var __publicField = (obj, key, value) => {
21475
21740
  _tick() {
21476
21741
  clearTimeout(this._pollTimer);
21477
21742
  this._renderPanel();
21478
- this._pollTimer = setTimeout(() => {
21743
+ this._pollTimer = window.setTimeout(() => {
21479
21744
  this._tick();
21480
21745
  }, this.config.interval);
21481
21746
  }
@@ -21591,6 +21856,37 @@ var __publicField = (obj, key, value) => {
21591
21856
  DECODE_INFO: "软解信息",
21592
21857
  REFRESH: "刷新"
21593
21858
  };
21859
+ const getDrmStrategy = async (options, player) => {
21860
+ var _a;
21861
+ const drmType = getDrmType(options.drm);
21862
+ if (options.url && drmType === DrmType.Fairplay) {
21863
+ try {
21864
+ const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
21865
+ const [drmPlugin, drmConfig] = await Promise.all([
21866
+ load(DynamicModule.PluginDrm).then((module2) => module2.DrmPlugin).catch(() => void 0),
21867
+ getDrmConfig == null ? void 0 : getDrmConfig({
21868
+ url: options.url
21869
+ })
21870
+ ]);
21871
+ const fairplayDrmConfig = Object.assign(
21872
+ {},
21873
+ originFairplayConfig,
21874
+ options == null ? void 0 : options.drm,
21875
+ drmConfig
21876
+ );
21877
+ drmConfig && (player == null ? void 0 : player.updateDrmConfig(drmConfig));
21878
+ return {
21879
+ options: {
21880
+ drm: fairplayDrmConfig
21881
+ },
21882
+ plugins: drmPlugin ? [drmPlugin] : []
21883
+ };
21884
+ } catch (error2) {
21885
+ console.log(error2);
21886
+ }
21887
+ }
21888
+ return {};
21889
+ };
21594
21890
  VeI18n.extend([
21595
21891
  {
21596
21892
  LANG: "zh-cn",
@@ -21646,6 +21942,14 @@ var __publicField = (obj, key, value) => {
21646
21942
  var _a;
21647
21943
  (_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
21648
21944
  }
21945
+ /** {zh}
21946
+ * @brief 调用此方法更新 DRM 鉴权配置。
21947
+ * @hidden
21948
+ */
21949
+ updateDrmConfig(config) {
21950
+ var _a, _b, _c;
21951
+ (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
21952
+ }
21649
21953
  }
21650
21954
  async function createLivePlayer(options) {
21651
21955
  var _a, _b;
@@ -21670,7 +21974,16 @@ var __publicField = (obj, key, value) => {
21670
21974
  };
21671
21975
  },
21672
21976
  async preparePlugins(url) {
21673
- return getTypeStrategy({ ...finalOptions, url }, player);
21977
+ const [typeStrategy, drmStrategy] = await Promise.all([
21978
+ getTypeStrategy({ ...finalOptions, url }, player),
21979
+ getDrmStrategy({ ...finalOptions, url }, player)
21980
+ ]);
21981
+ const { options: options2, plugins } = typeStrategy ?? {};
21982
+ const { options: drmOptions, plugins: drmPlugins } = drmStrategy ?? {};
21983
+ return {
21984
+ options: Object.assign({}, options2, drmOptions),
21985
+ plugins: [...plugins ?? [], ...drmPlugins ?? []]
21986
+ };
21674
21987
  }
21675
21988
  },
21676
21989
  VePlayerLive
@@ -21703,6 +22016,7 @@ var __publicField = (obj, key, value) => {
21703
22016
  exports2.Degradation = Degradation;
21704
22017
  exports2.DynamicModule = DynamicModule;
21705
22018
  exports2.EN = EN$1;
22019
+ exports2.ListType = ListType;
21706
22020
  exports2.POSITIONS = POSITIONS$1;
21707
22021
  exports2.Plugin = Plugin;
21708
22022
  exports2.RTMCodec = RTMCodec;
@@ -21716,5 +22030,6 @@ var __publicField = (obj, key, value) => {
21716
22030
  exports2.live = live;
21717
22031
  exports2.load = load;
21718
22032
  exports2.register = register;
22033
+ exports2.registerPlugin = registerPlugin;
21719
22034
  exports2.util = util;
21720
22035
  });