@besovideo/webrtc-player 0.8.64 → 0.8.65

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.
package/README.md CHANGED
@@ -77,7 +77,7 @@ const { instance } = PuPlayer({
77
77
  enableController: false,
78
78
  // (可选) 禁用控制器的控制项 下面示例中禁用了云台控制
79
79
  disabledControls: ["ptzControl"],
80
- // (可选) 设置最大重连间隔(s),默认不自动重连
80
+ // (可选) 设置最大重连间隔(s),默认不自动重连,setDefaultProps设置的maxReconnectInterval高于props
81
81
  maxReconnectInterval: 30,
82
82
  // (可选) 设置webrtc下视频预览,当没有视频时有音频情况下,是否展示音频波形
83
83
  noVideoRendeAudioWaveform: false,
@@ -117,7 +117,7 @@ var bvPlayerCore = (() => {
117
117
  var define_processenv_default;
118
118
  var init_define_processenv = __esm({
119
119
  "<define:processenv>"() {
120
- define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.63", PROJECT_NAMESPACE: "bvplayer" };
120
+ define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.65", PROJECT_NAMESPACE: "bvplayer" };
121
121
  }
122
122
  });
123
123
 
@@ -19093,23 +19093,29 @@ ${event.candidate ? event.candidate.candidate : "(null)"}`
19093
19093
  }
19094
19094
  });
19095
19095
  var useReconnect = (instance2, maxInterval) => {
19096
- if (maxInterval < 0)
19097
- return;
19098
19096
  let reconnectInterval = 1;
19099
19097
  let timeoutId;
19100
19098
  let times = 0;
19101
- return {
19102
- //连接失败时调用重连,递增重连间隔
19103
- reconnect: () => {
19104
- if (reconnectInterval > maxInterval) {
19105
- reconnectInterval = maxInterval;
19106
- }
19107
- timeoutId = window.setTimeout(() => {
19099
+ const reconnect = () => {
19100
+ if (maxInterval != defaultProps2.maxReconnectInterval && typeof defaultProps2.maxReconnectInterval == "number") {
19101
+ maxInterval = defaultProps2.maxReconnectInterval;
19102
+ reconnectInterval = 1;
19103
+ }
19104
+ if (reconnectInterval > maxInterval) {
19105
+ reconnectInterval = maxInterval;
19106
+ }
19107
+ timeoutId = window.setTimeout(() => {
19108
+ if (maxInterval > 0) {
19108
19109
  instance2 == null ? void 0 : instance2.open();
19109
19110
  console.log(`\u7B2C${++times}\u6B21\u91CD\u8FDE\uFF0C\u95F4\u9694${reconnectInterval}\u79D2`);
19110
19111
  reconnectInterval *= 2;
19111
- }, reconnectInterval * 1e3);
19112
- },
19112
+ } else {
19113
+ reconnect();
19114
+ }
19115
+ }, reconnectInterval < 0 ? 1e3 : reconnectInterval * 1e3);
19116
+ };
19117
+ return {
19118
+ reconnect,
19113
19119
  //取消重连 重置重连间隔
19114
19120
  cancelReconnect: () => {
19115
19121
  clearTimeout(timeoutId);
package/dist/main.es.js CHANGED
@@ -111,7 +111,7 @@ var __async = (__this, __arguments, generator) => {
111
111
  var define_processenv_default;
112
112
  var init_define_processenv = __esm({
113
113
  "<define:processenv>"() {
114
- define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.63", PROJECT_NAMESPACE: "bvplayer" };
114
+ define_processenv_default = { NODE_ENV: "production", SH_LIB_NAME: "@besovideo/webrtc-player", SH_LIB_VERSION: "0.8.65", PROJECT_NAMESPACE: "bvplayer" };
115
115
  }
116
116
  });
117
117
 
@@ -19079,23 +19079,29 @@ var createProductRemoteSdp = (puOption, tempToken, callBack, signal) => (localDe
19079
19079
  }
19080
19080
  });
19081
19081
  var useReconnect = (instance2, maxInterval) => {
19082
- if (maxInterval < 0)
19083
- return;
19084
19082
  let reconnectInterval = 1;
19085
19083
  let timeoutId;
19086
19084
  let times = 0;
19087
- return {
19088
- //连接失败时调用重连,递增重连间隔
19089
- reconnect: () => {
19090
- if (reconnectInterval > maxInterval) {
19091
- reconnectInterval = maxInterval;
19092
- }
19093
- timeoutId = window.setTimeout(() => {
19085
+ const reconnect = () => {
19086
+ if (maxInterval != defaultProps2.maxReconnectInterval && typeof defaultProps2.maxReconnectInterval == "number") {
19087
+ maxInterval = defaultProps2.maxReconnectInterval;
19088
+ reconnectInterval = 1;
19089
+ }
19090
+ if (reconnectInterval > maxInterval) {
19091
+ reconnectInterval = maxInterval;
19092
+ }
19093
+ timeoutId = window.setTimeout(() => {
19094
+ if (maxInterval > 0) {
19094
19095
  instance2 == null ? void 0 : instance2.open();
19095
19096
  console.log(`\u7B2C${++times}\u6B21\u91CD\u8FDE\uFF0C\u95F4\u9694${reconnectInterval}\u79D2`);
19096
19097
  reconnectInterval *= 2;
19097
- }, reconnectInterval * 1e3);
19098
- },
19098
+ } else {
19099
+ reconnect();
19100
+ }
19101
+ }, reconnectInterval < 0 ? 1e3 : reconnectInterval * 1e3);
19102
+ };
19103
+ return {
19104
+ reconnect,
19099
19105
  //取消重连 重置重连间隔
19100
19106
  cancelReconnect: () => {
19101
19107
  clearTimeout(timeoutId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@besovideo/webrtc-player",
3
- "version": "0.8.64",
3
+ "version": "0.8.65",
4
4
  "description": "@besovideo/webrtc-player desc",
5
5
  "type": "module",
6
6
  "types": "./dist/types/main.d.ts",