@besovideo/webrtc-player 0.10.21 → 0.10.22

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.
@@ -124,7 +124,7 @@ var bvPlayerCore = (() => {
124
124
  var define_processenv_default;
125
125
  var init_define_processenv = __esm({
126
126
  "<define:processenv>"() {
127
- define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.10.21", PROJECT_NAMESPACE: "bvplayer" };
127
+ define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.10.22", PROJECT_NAMESPACE: "bvplayer" };
128
128
  }
129
129
  });
130
130
 
@@ -29614,10 +29614,10 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
29614
29614
  label: t("sample-rate"),
29615
29615
  value: audio.codec.clockRate + "Hz@" + audio.rtp.sampleRates
29616
29616
  },
29617
- {
29618
- label: t("data-received"),
29617
+ ...Number.isNaN(audio.rtp.bitRate) ? [] : [{
29618
+ label: t("data-received") + audio.rtp.bitRate,
29619
29619
  value: audio.rtp.bitRate.toFixed(0) + " kbps, loss" + audio.rtp.packageLostTotal
29620
- },
29620
+ }],
29621
29621
  {
29622
29622
  label: t("lostpackrate"),
29623
29623
  value: String(audio.rtp.avaragePackageLostRate.toFixed(2)) + "% " + String(audio.rtp.packageLostRate.toFixed(2)) + "%"
@@ -29636,10 +29636,10 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
29636
29636
  label: t("resolution"),
29637
29637
  value: `${video.codec.width}x${video.codec.height}@${video.rtp.sampleRates.toFixed(0)}fps`
29638
29638
  },
29639
- {
29640
- label: t("data-received"),
29639
+ ...Number.isNaN(video.rtp.bitRate) ? [] : [{
29640
+ label: t("data-received") + video.rtp.bitRate,
29641
29641
  value: String(video.rtp.bitRate.toFixed(0)) + " kbps, loss" + video.rtp.packageLostTotal
29642
- },
29642
+ }],
29643
29643
  {
29644
29644
  label: t("lostpackrate"),
29645
29645
  value: String(video.rtp.avaragePackageLostRate.toFixed(2)) + "% " + String(video.rtp.packageLostRate.toFixed(2)) + "%"
@@ -34450,6 +34450,8 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
34450
34450
  constructor() {
34451
34451
  this.currentConstraints = {};
34452
34452
  this.szStreamInfo = [];
34453
+ this.szPeerConnections = [];
34454
+ this.rTCDegradationPreference = "balanced";
34453
34455
  this.camera = new CallEndPointInputMediaSelectManager(this);
34454
34456
  }
34455
34457
  setConfig(config) {
@@ -34518,6 +34520,30 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
34518
34520
  }
34519
34521
  };
34520
34522
  }
34523
+ pushPeerConnection(pc) {
34524
+ this.szPeerConnections.push(pc);
34525
+ return {
34526
+ remove: () => {
34527
+ const index = this.szPeerConnections.findIndex((item) => item == pc);
34528
+ this.szPeerConnections.splice(index, 1);
34529
+ }
34530
+ };
34531
+ }
34532
+ handlePeerConnectionParamsChagne() {
34533
+ this.szPeerConnections.forEach((pc) => {
34534
+ pc.getSenders().forEach((sender) => {
34535
+ const params = sender.getParameters();
34536
+ params.degradationPreference = this.rTCDegradationPreference;
34537
+ });
34538
+ });
34539
+ }
34540
+ SetRTCDegradationPreference(tempPreference) {
34541
+ const preference = tempPreference || "balanced";
34542
+ if (this.rTCDegradationPreference != preference) {
34543
+ this.rTCDegradationPreference = preference;
34544
+ this.handlePeerConnectionParamsChagne();
34545
+ }
34546
+ }
34521
34547
  setResolution(option) {
34522
34548
  if (option) {
34523
34549
  if (gresolutionOptions.find((opt) => opt == option)) {
@@ -34842,7 +34868,11 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
34842
34868
  if (params2.encodings) {
34843
34869
  params2.encodings.forEach((item) => {
34844
34870
  item.scaleResolutionDownBy = 1;
34871
+ item.networkPriority = "high";
34872
+ item.priority = "high";
34873
+ item.maxBitrate = 4e8;
34845
34874
  });
34875
+ params2.degradationPreference = GetInnerConfig(callEndPointConfig).rTCDegradationPreference;
34846
34876
  }
34847
34877
  sender.setParameters(params2);
34848
34878
  }
@@ -34851,7 +34881,9 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
34851
34881
  offerToReceiveAudio: false,
34852
34882
  offerToReceiveVideo: false
34853
34883
  });
34884
+ const handlePC = GetInnerConfig(callEndPointConfig).pushPeerConnection(pc);
34854
34885
  releaseHandlePush.regRelease(() => __async(this, null, function* () {
34886
+ handlePC.remove();
34855
34887
  while (rtpRtcSenders.length) {
34856
34888
  const item = rtpRtcSenders.pop();
34857
34889
  item && pc.removeTrack(item);
package/dist/main.es.js CHANGED
@@ -118,7 +118,7 @@ var __async = (__this, __arguments, generator) => {
118
118
  var define_processenv_default;
119
119
  var init_define_processenv = __esm({
120
120
  "<define:processenv>"() {
121
- define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.10.21", PROJECT_NAMESPACE: "bvplayer" };
121
+ define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.10.22", PROJECT_NAMESPACE: "bvplayer" };
122
122
  }
123
123
  });
124
124
 
@@ -29596,10 +29596,10 @@ var PlayerPlugin = class extends Plugin {
29596
29596
  label: t("sample-rate"),
29597
29597
  value: audio.codec.clockRate + "Hz@" + audio.rtp.sampleRates
29598
29598
  },
29599
- {
29600
- label: t("data-received"),
29599
+ ...Number.isNaN(audio.rtp.bitRate) ? [] : [{
29600
+ label: t("data-received") + audio.rtp.bitRate,
29601
29601
  value: audio.rtp.bitRate.toFixed(0) + " kbps, loss" + audio.rtp.packageLostTotal
29602
- },
29602
+ }],
29603
29603
  {
29604
29604
  label: t("lostpackrate"),
29605
29605
  value: String(audio.rtp.avaragePackageLostRate.toFixed(2)) + "% " + String(audio.rtp.packageLostRate.toFixed(2)) + "%"
@@ -29618,10 +29618,10 @@ var PlayerPlugin = class extends Plugin {
29618
29618
  label: t("resolution"),
29619
29619
  value: `${video.codec.width}x${video.codec.height}@${video.rtp.sampleRates.toFixed(0)}fps`
29620
29620
  },
29621
- {
29622
- label: t("data-received"),
29621
+ ...Number.isNaN(video.rtp.bitRate) ? [] : [{
29622
+ label: t("data-received") + video.rtp.bitRate,
29623
29623
  value: String(video.rtp.bitRate.toFixed(0)) + " kbps, loss" + video.rtp.packageLostTotal
29624
- },
29624
+ }],
29625
29625
  {
29626
29626
  label: t("lostpackrate"),
29627
29627
  value: String(video.rtp.avaragePackageLostRate.toFixed(2)) + "% " + String(video.rtp.packageLostRate.toFixed(2)) + "%"
@@ -34432,6 +34432,8 @@ var CallEndPointConfigManager = class {
34432
34432
  constructor() {
34433
34433
  this.currentConstraints = {};
34434
34434
  this.szStreamInfo = [];
34435
+ this.szPeerConnections = [];
34436
+ this.rTCDegradationPreference = "balanced";
34435
34437
  this.camera = new CallEndPointInputMediaSelectManager(this);
34436
34438
  }
34437
34439
  setConfig(config) {
@@ -34500,6 +34502,30 @@ var CallEndPointConfigManager = class {
34500
34502
  }
34501
34503
  };
34502
34504
  }
34505
+ pushPeerConnection(pc) {
34506
+ this.szPeerConnections.push(pc);
34507
+ return {
34508
+ remove: () => {
34509
+ const index = this.szPeerConnections.findIndex((item) => item == pc);
34510
+ this.szPeerConnections.splice(index, 1);
34511
+ }
34512
+ };
34513
+ }
34514
+ handlePeerConnectionParamsChagne() {
34515
+ this.szPeerConnections.forEach((pc) => {
34516
+ pc.getSenders().forEach((sender) => {
34517
+ const params = sender.getParameters();
34518
+ params.degradationPreference = this.rTCDegradationPreference;
34519
+ });
34520
+ });
34521
+ }
34522
+ SetRTCDegradationPreference(tempPreference) {
34523
+ const preference = tempPreference || "balanced";
34524
+ if (this.rTCDegradationPreference != preference) {
34525
+ this.rTCDegradationPreference = preference;
34526
+ this.handlePeerConnectionParamsChagne();
34527
+ }
34528
+ }
34503
34529
  setResolution(option) {
34504
34530
  if (option) {
34505
34531
  if (gresolutionOptions.find((opt) => opt == option)) {
@@ -34824,7 +34850,11 @@ function MediaEndPoint(params) {
34824
34850
  if (params2.encodings) {
34825
34851
  params2.encodings.forEach((item) => {
34826
34852
  item.scaleResolutionDownBy = 1;
34853
+ item.networkPriority = "high";
34854
+ item.priority = "high";
34855
+ item.maxBitrate = 4e8;
34827
34856
  });
34857
+ params2.degradationPreference = GetInnerConfig(callEndPointConfig).rTCDegradationPreference;
34828
34858
  }
34829
34859
  sender.setParameters(params2);
34830
34860
  }
@@ -34833,7 +34863,9 @@ function MediaEndPoint(params) {
34833
34863
  offerToReceiveAudio: false,
34834
34864
  offerToReceiveVideo: false
34835
34865
  });
34866
+ const handlePC = GetInnerConfig(callEndPointConfig).pushPeerConnection(pc);
34836
34867
  releaseHandlePush.regRelease(() => __async(this, null, function* () {
34868
+ handlePC.remove();
34837
34869
  while (rtpRtcSenders.length) {
34838
34870
  const item = rtpRtcSenders.pop();
34839
34871
  item && pc.removeTrack(item);
@@ -14,6 +14,13 @@ export declare class CallEndPointConfigManager {
14
14
  }): {
15
15
  remove: () => void;
16
16
  };
17
+ private szPeerConnections;
18
+ pushPeerConnection(pc: RTCPeerConnection): {
19
+ remove: () => void;
20
+ };
21
+ rTCDegradationPreference: RTCDegradationPreference;
22
+ handlePeerConnectionParamsChagne(): void;
23
+ SetRTCDegradationPreference(tempPreference?: RTCDegradationPreference): void;
17
24
  camera: Omit<CallEndPointInputMediaSelectManager, "getVideoInputDeviceId">;
18
25
  setResolution(option?: OptionsResolution): void;
19
26
  getResolutionOptions(): OptionsResolution[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@besovideo/webrtc-player",
3
- "version": "0.10.21",
3
+ "version": "0.10.22",
4
4
  "description": "@besovideo/webrtc-player desc",
5
5
  "type": "module",
6
6
  "types": "./dist/types/main.d.ts",