@besovideo/webrtc-player 0.10.21 → 0.10.23

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.23", 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)) + "%"
@@ -34332,6 +34332,7 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
34332
34332
  processHandle.reg(() => __async(this, null, function* () {
34333
34333
  yield callApis.avCall(
34334
34334
  __spreadProps(__spreadValues({}, callInfo), {
34335
+ id: remoteUserId,
34335
34336
  status: 6 /* END */
34336
34337
  }),
34337
34338
  token
@@ -34339,6 +34340,7 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
34339
34340
  }));
34340
34341
  const callResult = yield callApis.avCall(callInfo, token);
34341
34342
  const result = callResult.data;
34343
+ const remoteUserId = result == null ? void 0 : result.id;
34342
34344
  if (result && (result.status == 3 /* REPLY */ || result.status == 4 /* CONNECTING */ || result.status == 5 /* TALKING */)) {
34343
34345
  rc.data = result;
34344
34346
  } else {
@@ -34450,6 +34452,8 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
34450
34452
  constructor() {
34451
34453
  this.currentConstraints = {};
34452
34454
  this.szStreamInfo = [];
34455
+ this.szPeerConnections = [];
34456
+ this.rTCDegradationPreference = "balanced";
34453
34457
  this.camera = new CallEndPointInputMediaSelectManager(this);
34454
34458
  }
34455
34459
  setConfig(config) {
@@ -34518,6 +34522,30 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
34518
34522
  }
34519
34523
  };
34520
34524
  }
34525
+ pushPeerConnection(pc) {
34526
+ this.szPeerConnections.push(pc);
34527
+ return {
34528
+ remove: () => {
34529
+ const index = this.szPeerConnections.findIndex((item) => item == pc);
34530
+ this.szPeerConnections.splice(index, 1);
34531
+ }
34532
+ };
34533
+ }
34534
+ handlePeerConnectionParamsChagne() {
34535
+ this.szPeerConnections.forEach((pc) => {
34536
+ pc.getSenders().forEach((sender) => {
34537
+ const params = sender.getParameters();
34538
+ params.degradationPreference = this.rTCDegradationPreference;
34539
+ });
34540
+ });
34541
+ }
34542
+ SetRTCDegradationPreference(tempPreference) {
34543
+ const preference = tempPreference || "balanced";
34544
+ if (this.rTCDegradationPreference != preference) {
34545
+ this.rTCDegradationPreference = preference;
34546
+ this.handlePeerConnectionParamsChagne();
34547
+ }
34548
+ }
34521
34549
  setResolution(option) {
34522
34550
  if (option) {
34523
34551
  if (gresolutionOptions.find((opt) => opt == option)) {
@@ -34842,7 +34870,11 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
34842
34870
  if (params2.encodings) {
34843
34871
  params2.encodings.forEach((item) => {
34844
34872
  item.scaleResolutionDownBy = 1;
34873
+ item.networkPriority = "high";
34874
+ item.priority = "high";
34875
+ item.maxBitrate = 4e8;
34845
34876
  });
34877
+ params2.degradationPreference = GetInnerConfig(callEndPointConfig).rTCDegradationPreference;
34846
34878
  }
34847
34879
  sender.setParameters(params2);
34848
34880
  }
@@ -34851,7 +34883,9 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
34851
34883
  offerToReceiveAudio: false,
34852
34884
  offerToReceiveVideo: false
34853
34885
  });
34886
+ const handlePC = GetInnerConfig(callEndPointConfig).pushPeerConnection(pc);
34854
34887
  releaseHandlePush.regRelease(() => __async(this, null, function* () {
34888
+ handlePC.remove();
34855
34889
  while (rtpRtcSenders.length) {
34856
34890
  const item = rtpRtcSenders.pop();
34857
34891
  item && pc.removeTrack(item);
@@ -35373,12 +35407,12 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
35373
35407
  core_default.dom.removeSelf(divTemp);
35374
35408
  resolve("NoAnwser");
35375
35409
  };
35376
- const ele = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h(jsx_default.Fragment, null, /* @__PURE__ */ jsx_default.h("div", { className: "popInvite" }, /* @__PURE__ */ jsx_default.h("div", { className: "callContent" }, /* @__PURE__ */ jsx_default.h("div", null, t("shou-dao"), " ", avCall2.name, " ", `${t("hu-jiao-qing-qiu")}`), /* @__PURE__ */ jsx_default.h("div", null, timeSpan)), /* @__PURE__ */ jsx_default.h("div", { className: "btnLine" }, /* @__PURE__ */ jsx_default.h("button", { className: "btnAgree", onclick: onApply }, t("jie-ting")), /* @__PURE__ */ jsx_default.h("button", { className: "btnRefuse", onclick: onRefuse }, t("ju-jue"))))));
35410
+ const elePopInvite = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h(jsx_default.Fragment, null, /* @__PURE__ */ jsx_default.h("div", { className: "popInvite" }, /* @__PURE__ */ jsx_default.h("div", { className: "callContent" }, /* @__PURE__ */ jsx_default.h("div", null, t("shou-dao"), " ", avCall2.name, " ", `${t("hu-jiao-qing-qiu")}`), /* @__PURE__ */ jsx_default.h("div", null, timeSpan)), /* @__PURE__ */ jsx_default.h("div", { className: "btnLine" }, /* @__PURE__ */ jsx_default.h("button", { className: "btnAgree", onclick: onApply }, t("jie-ting")), /* @__PURE__ */ jsx_default.h("button", { className: "btnRefuse", onclick: onRefuse }, t("ju-jue"))))));
35377
35411
  const messageSpan = core_default.dom.create("span");
35378
35412
  messageSpan.innerText = `${t("hu-jiao-yi-qu-xiao")}`;
35379
35413
  const eleCancel = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h(jsx_default.Fragment, null, /* @__PURE__ */ jsx_default.h("div", { className: "popInvite" }, /* @__PURE__ */ jsx_default.h("div", { className: "callContent" }, /* @__PURE__ */ jsx_default.h("div", null, avCall2.name, " ", messageSpan)), /* @__PURE__ */ jsx_default.h("div", { className: "btnLine" }))));
35380
35414
  const divTemp = core_default.dom.create("div");
35381
- core_default.dom.append(divTemp, ele);
35415
+ core_default.dom.append(divTemp, elePopInvite);
35382
35416
  if (typeof params.zIndex === "number") {
35383
35417
  const popInviteEles = divTemp.getElementsByClassName("popInvite");
35384
35418
  if (popInviteEles.length > 0) {
@@ -35388,11 +35422,18 @@ registerProcessor('bv-audio-processor', BVAudioProcessor);
35388
35422
  core_default.dom.append(document.body, divTemp);
35389
35423
  function callCancel(message) {
35390
35424
  return __async(this, null, function* () {
35391
- core_default.dom.removeSelf(ele);
35425
+ core_default.dom.removeSelf(elePopInvite);
35392
35426
  if (message) {
35393
35427
  messageSpan.innerText = message;
35394
35428
  }
35429
+ core_default.dom.empty(divTemp);
35395
35430
  core_default.dom.append(divTemp, eleCancel);
35431
+ if (typeof params.zIndex === "number") {
35432
+ const popInviteEles = divTemp.getElementsByClassName("popInvite");
35433
+ if (popInviteEles.length > 0) {
35434
+ popInviteEles[0].style.zIndex = `${params.zIndex}`;
35435
+ }
35436
+ }
35396
35437
  yield new Promise((r) => setTimeout(r, 2e3));
35397
35438
  });
35398
35439
  }
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.23", 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)) + "%"
@@ -34314,6 +34314,7 @@ function CreateCallConnectionManager(params) {
34314
34314
  processHandle.reg(() => __async(this, null, function* () {
34315
34315
  yield callApis.avCall(
34316
34316
  __spreadProps(__spreadValues({}, callInfo), {
34317
+ id: remoteUserId,
34317
34318
  status: 6 /* END */
34318
34319
  }),
34319
34320
  token
@@ -34321,6 +34322,7 @@ function CreateCallConnectionManager(params) {
34321
34322
  }));
34322
34323
  const callResult = yield callApis.avCall(callInfo, token);
34323
34324
  const result = callResult.data;
34325
+ const remoteUserId = result == null ? void 0 : result.id;
34324
34326
  if (result && (result.status == 3 /* REPLY */ || result.status == 4 /* CONNECTING */ || result.status == 5 /* TALKING */)) {
34325
34327
  rc.data = result;
34326
34328
  } else {
@@ -34432,6 +34434,8 @@ var CallEndPointConfigManager = class {
34432
34434
  constructor() {
34433
34435
  this.currentConstraints = {};
34434
34436
  this.szStreamInfo = [];
34437
+ this.szPeerConnections = [];
34438
+ this.rTCDegradationPreference = "balanced";
34435
34439
  this.camera = new CallEndPointInputMediaSelectManager(this);
34436
34440
  }
34437
34441
  setConfig(config) {
@@ -34500,6 +34504,30 @@ var CallEndPointConfigManager = class {
34500
34504
  }
34501
34505
  };
34502
34506
  }
34507
+ pushPeerConnection(pc) {
34508
+ this.szPeerConnections.push(pc);
34509
+ return {
34510
+ remove: () => {
34511
+ const index = this.szPeerConnections.findIndex((item) => item == pc);
34512
+ this.szPeerConnections.splice(index, 1);
34513
+ }
34514
+ };
34515
+ }
34516
+ handlePeerConnectionParamsChagne() {
34517
+ this.szPeerConnections.forEach((pc) => {
34518
+ pc.getSenders().forEach((sender) => {
34519
+ const params = sender.getParameters();
34520
+ params.degradationPreference = this.rTCDegradationPreference;
34521
+ });
34522
+ });
34523
+ }
34524
+ SetRTCDegradationPreference(tempPreference) {
34525
+ const preference = tempPreference || "balanced";
34526
+ if (this.rTCDegradationPreference != preference) {
34527
+ this.rTCDegradationPreference = preference;
34528
+ this.handlePeerConnectionParamsChagne();
34529
+ }
34530
+ }
34503
34531
  setResolution(option) {
34504
34532
  if (option) {
34505
34533
  if (gresolutionOptions.find((opt) => opt == option)) {
@@ -34824,7 +34852,11 @@ function MediaEndPoint(params) {
34824
34852
  if (params2.encodings) {
34825
34853
  params2.encodings.forEach((item) => {
34826
34854
  item.scaleResolutionDownBy = 1;
34855
+ item.networkPriority = "high";
34856
+ item.priority = "high";
34857
+ item.maxBitrate = 4e8;
34827
34858
  });
34859
+ params2.degradationPreference = GetInnerConfig(callEndPointConfig).rTCDegradationPreference;
34828
34860
  }
34829
34861
  sender.setParameters(params2);
34830
34862
  }
@@ -34833,7 +34865,9 @@ function MediaEndPoint(params) {
34833
34865
  offerToReceiveAudio: false,
34834
34866
  offerToReceiveVideo: false
34835
34867
  });
34868
+ const handlePC = GetInnerConfig(callEndPointConfig).pushPeerConnection(pc);
34836
34869
  releaseHandlePush.regRelease(() => __async(this, null, function* () {
34870
+ handlePC.remove();
34837
34871
  while (rtpRtcSenders.length) {
34838
34872
  const item = rtpRtcSenders.pop();
34839
34873
  item && pc.removeTrack(item);
@@ -35355,12 +35389,12 @@ function runPopInvite(avCall2, params) {
35355
35389
  core_default.dom.removeSelf(divTemp);
35356
35390
  resolve("NoAnwser");
35357
35391
  };
35358
- const ele = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h(jsx_default.Fragment, null, /* @__PURE__ */ jsx_default.h("div", { className: "popInvite" }, /* @__PURE__ */ jsx_default.h("div", { className: "callContent" }, /* @__PURE__ */ jsx_default.h("div", null, t("shou-dao"), " ", avCall2.name, " ", `${t("hu-jiao-qing-qiu")}`), /* @__PURE__ */ jsx_default.h("div", null, timeSpan)), /* @__PURE__ */ jsx_default.h("div", { className: "btnLine" }, /* @__PURE__ */ jsx_default.h("button", { className: "btnAgree", onclick: onApply }, t("jie-ting")), /* @__PURE__ */ jsx_default.h("button", { className: "btnRefuse", onclick: onRefuse }, t("ju-jue"))))));
35392
+ const elePopInvite = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h(jsx_default.Fragment, null, /* @__PURE__ */ jsx_default.h("div", { className: "popInvite" }, /* @__PURE__ */ jsx_default.h("div", { className: "callContent" }, /* @__PURE__ */ jsx_default.h("div", null, t("shou-dao"), " ", avCall2.name, " ", `${t("hu-jiao-qing-qiu")}`), /* @__PURE__ */ jsx_default.h("div", null, timeSpan)), /* @__PURE__ */ jsx_default.h("div", { className: "btnLine" }, /* @__PURE__ */ jsx_default.h("button", { className: "btnAgree", onclick: onApply }, t("jie-ting")), /* @__PURE__ */ jsx_default.h("button", { className: "btnRefuse", onclick: onRefuse }, t("ju-jue"))))));
35359
35393
  const messageSpan = core_default.dom.create("span");
35360
35394
  messageSpan.innerText = `${t("hu-jiao-yi-qu-xiao")}`;
35361
35395
  const eleCancel = core_default.dom.createByJsx(/* @__PURE__ */ jsx_default.h(jsx_default.Fragment, null, /* @__PURE__ */ jsx_default.h("div", { className: "popInvite" }, /* @__PURE__ */ jsx_default.h("div", { className: "callContent" }, /* @__PURE__ */ jsx_default.h("div", null, avCall2.name, " ", messageSpan)), /* @__PURE__ */ jsx_default.h("div", { className: "btnLine" }))));
35362
35396
  const divTemp = core_default.dom.create("div");
35363
- core_default.dom.append(divTemp, ele);
35397
+ core_default.dom.append(divTemp, elePopInvite);
35364
35398
  if (typeof params.zIndex === "number") {
35365
35399
  const popInviteEles = divTemp.getElementsByClassName("popInvite");
35366
35400
  if (popInviteEles.length > 0) {
@@ -35370,11 +35404,18 @@ function runPopInvite(avCall2, params) {
35370
35404
  core_default.dom.append(document.body, divTemp);
35371
35405
  function callCancel(message) {
35372
35406
  return __async(this, null, function* () {
35373
- core_default.dom.removeSelf(ele);
35407
+ core_default.dom.removeSelf(elePopInvite);
35374
35408
  if (message) {
35375
35409
  messageSpan.innerText = message;
35376
35410
  }
35411
+ core_default.dom.empty(divTemp);
35377
35412
  core_default.dom.append(divTemp, eleCancel);
35413
+ if (typeof params.zIndex === "number") {
35414
+ const popInviteEles = divTemp.getElementsByClassName("popInvite");
35415
+ if (popInviteEles.length > 0) {
35416
+ popInviteEles[0].style.zIndex = `${params.zIndex}`;
35417
+ }
35418
+ }
35378
35419
  yield new Promise((r) => setTimeout(r, 2e3));
35379
35420
  });
35380
35421
  }
@@ -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.23",
4
4
  "description": "@besovideo/webrtc-player desc",
5
5
  "type": "module",
6
6
  "types": "./dist/types/main.d.ts",