@byteplus/veplayer-plugin 2.9.0 → 2.9.2

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.
@@ -32711,6 +32711,16 @@ var NetworkQuality = /* @__PURE__ */ function() {
32711
32711
  }]);
32712
32712
  return NetworkQuality2;
32713
32713
  }();
32714
+ function changeNumberInRange(source, min2, max2, delta) {
32715
+ var target = source + delta;
32716
+ if (target > max2) {
32717
+ target = source - delta;
32718
+ }
32719
+ return [source, target];
32720
+ }
32721
+ function isHarmonyOS() {
32722
+ return /(HarmonyOS|OpenHarmony|ArkWeb)/i.test(navigator.userAgent);
32723
+ }
32714
32724
  var logger$b = new Logger$a("rts");
32715
32725
  var Rts = /* @__PURE__ */ function(_EventEmitter) {
32716
32726
  _inherits$f(Rts2, _EventEmitter);
@@ -33004,6 +33014,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
33004
33014
  }));
33005
33015
  _this._retry = _this._opts.retryCount;
33006
33016
  _this._bindMediaEvent();
33017
+ _this._changeVolumeInHarmonyWorkaround();
33007
33018
  if (_this._opts.mediaStream && _this._opts.seamlesslyReload) {
33008
33019
  _this._lastMediaStream = _this._opts.mediaStream;
33009
33020
  }
@@ -33598,6 +33609,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
33598
33609
  this._pc.close();
33599
33610
  if (this._media) {
33600
33611
  this._media.srcObject = null;
33612
+ this._media.removeAttribute("src");
33601
33613
  }
33602
33614
  }
33603
33615
  }
@@ -33627,11 +33639,42 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
33627
33639
  }
33628
33640
  return _createEmptyPeer;
33629
33641
  }()
33642
+ }, {
33643
+ key: "_changeVolumeInHarmonyWorkaround",
33644
+ value: function _changeVolumeInHarmonyWorkaround() {
33645
+ var _this8 = this;
33646
+ if (isHarmonyOS()) {
33647
+ var originalDescriptor = Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, "muted");
33648
+ if (this._media && originalDescriptor) {
33649
+ logger$b.log("apply HarmonyOS muted workaround");
33650
+ Object.defineProperty(this._media, "muted", {
33651
+ configurable: true,
33652
+ enumerable: true,
33653
+ get: originalDescriptor.get,
33654
+ set: function set5(val) {
33655
+ originalDescriptor.set.call(this, val);
33656
+ var _changeNumberInRange = changeNumberInRange(this.volume, 0, 1, 0.01), _changeNumberInRange2 = _slicedToArray$7(_changeNumberInRange, 2), sourceVolume = _changeNumberInRange2[0], targetVolume = _changeNumberInRange2[1];
33657
+ this.volume = targetVolume;
33658
+ this.volume = sourceVolume;
33659
+ logger$b.log("HarmonyOS muted workaround. set muted =", val, "volume:", targetVolume, "->", sourceVolume);
33660
+ }
33661
+ });
33662
+ this._revertVolumeWorkaround = function() {
33663
+ logger$b.log("revert HarmonyOS muted workaround. video dom:", _this8._media);
33664
+ if (_this8._media) {
33665
+ Object.defineProperty(_this8._media, "muted", originalDescriptor);
33666
+ }
33667
+ };
33668
+ }
33669
+ }
33670
+ }
33630
33671
  }, {
33631
33672
  key: "destroy",
33632
33673
  value: function destroy(keepClearMediaStream) {
33633
- var _this$_media2;
33674
+ var _this$_revertVolumeWo, _this$_media2;
33634
33675
  this._disconnect();
33676
+ (_this$_revertVolumeWo = this._revertVolumeWorkaround) === null || _this$_revertVolumeWo === void 0 ? void 0 : _this$_revertVolumeWo.call(this);
33677
+ delete this._revertVolumeWorkaround;
33635
33678
  (_this$_media2 = this._media) === null || _this$_media2 === void 0 ? void 0 : _this$_media2.removeEventListener("timeupdate", this._mockWaitingByTimeupdate);
33636
33679
  if (this._media && !keepClearMediaStream) {
33637
33680
  this._media.srcObject = null;
@@ -33767,7 +33810,7 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
33767
33810
  }, {
33768
33811
  key: "version",
33769
33812
  get: function get4() {
33770
- return "0.2.1-alpha.42";
33813
+ return "0.2.1-alpha.45";
33771
33814
  }
33772
33815
  }, {
33773
33816
  key: "beforePlayerInit",