@byteplus/veplayer-plugin 2.9.1 → 2.9.3-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.
@@ -6755,6 +6755,16 @@ var NetworkQuality = /* @__PURE__ */ function() {
6755
6755
  }]);
6756
6756
  return NetworkQuality2;
6757
6757
  }();
6758
+ function changeNumberInRange(source, min, max, delta) {
6759
+ var target = source + delta;
6760
+ if (target > max) {
6761
+ target = source - delta;
6762
+ }
6763
+ return [source, target];
6764
+ }
6765
+ function isHarmonyOS() {
6766
+ return /(HarmonyOS|OpenHarmony|ArkWeb)/i.test(navigator.userAgent);
6767
+ }
6758
6768
  var logger = new Logger("rts");
6759
6769
  var Rts = /* @__PURE__ */ function(_EventEmitter) {
6760
6770
  _inherits$1(Rts2, _EventEmitter);
@@ -7048,6 +7058,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7048
7058
  }));
7049
7059
  _this._retry = _this._opts.retryCount;
7050
7060
  _this._bindMediaEvent();
7061
+ _this._changeVolumeInHarmonyWorkaround();
7051
7062
  if (_this._opts.mediaStream && _this._opts.seamlesslyReload) {
7052
7063
  _this._lastMediaStream = _this._opts.mediaStream;
7053
7064
  }
@@ -7672,11 +7683,42 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7672
7683
  }
7673
7684
  return _createEmptyPeer;
7674
7685
  }()
7686
+ }, {
7687
+ key: "_changeVolumeInHarmonyWorkaround",
7688
+ value: function _changeVolumeInHarmonyWorkaround() {
7689
+ var _this8 = this;
7690
+ if (isHarmonyOS()) {
7691
+ var originalDescriptor = Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, "muted");
7692
+ if (this._media && originalDescriptor) {
7693
+ logger.log("apply HarmonyOS muted workaround");
7694
+ Object.defineProperty(this._media, "muted", {
7695
+ configurable: true,
7696
+ enumerable: true,
7697
+ get: originalDescriptor.get,
7698
+ set: function set(val) {
7699
+ originalDescriptor.set.call(this, val);
7700
+ var _changeNumberInRange = changeNumberInRange(this.volume, 0, 1, 0.01), _changeNumberInRange2 = _slicedToArray(_changeNumberInRange, 2), sourceVolume = _changeNumberInRange2[0], targetVolume = _changeNumberInRange2[1];
7701
+ this.volume = targetVolume;
7702
+ this.volume = sourceVolume;
7703
+ logger.log("HarmonyOS muted workaround. set muted =", val, "volume:", targetVolume, "->", sourceVolume);
7704
+ }
7705
+ });
7706
+ this._revertVolumeWorkaround = function() {
7707
+ logger.log("revert HarmonyOS muted workaround. video dom:", _this8._media);
7708
+ if (_this8._media) {
7709
+ Object.defineProperty(_this8._media, "muted", originalDescriptor);
7710
+ }
7711
+ };
7712
+ }
7713
+ }
7714
+ }
7675
7715
  }, {
7676
7716
  key: "destroy",
7677
7717
  value: function destroy(keepClearMediaStream) {
7678
- var _this$_media2;
7718
+ var _this$_revertVolumeWo, _this$_media2;
7679
7719
  this._disconnect();
7720
+ (_this$_revertVolumeWo = this._revertVolumeWorkaround) === null || _this$_revertVolumeWo === void 0 ? void 0 : _this$_revertVolumeWo.call(this);
7721
+ delete this._revertVolumeWorkaround;
7680
7722
  (_this$_media2 = this._media) === null || _this$_media2 === void 0 ? void 0 : _this$_media2.removeEventListener("timeupdate", this._mockWaitingByTimeupdate);
7681
7723
  if (this._media && !keepClearMediaStream) {
7682
7724
  this._media.srcObject = null;
@@ -7812,7 +7854,7 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
7812
7854
  }, {
7813
7855
  key: "version",
7814
7856
  get: function get() {
7815
- return "0.2.1-alpha.43";
7857
+ return "0.2.1-alpha.45";
7816
7858
  }
7817
7859
  }, {
7818
7860
  key: "beforePlayerInit",