zann-voice 0.1.73 → 0.1.74
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 +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ import ZannVoice from "zann-voice";
|
|
|
18
18
|
//maxReconnect 最大重连次数非必填
|
|
19
19
|
const voice = new ZannVoice({
|
|
20
20
|
wss: "wss://example.com",
|
|
21
|
-
maxReconnect:
|
|
21
|
+
maxReconnect:10
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
|
|
@@ -27,6 +27,7 @@ voice.connect({
|
|
|
27
27
|
onOpen: () => console.log("Connected!"),
|
|
28
28
|
onError: (type: string, event: any) => console.error(e),
|
|
29
29
|
onAuth:(e) => console.log(e),
|
|
30
|
+
onConnect:(e)=>console.log(e),
|
|
30
31
|
onMessage: (msg) => console.log("WS Message", msg)
|
|
31
32
|
});
|
|
32
33
|
|
|
@@ -46,7 +47,7 @@ voice.startMicrophone();
|
|
|
46
47
|
| 属性 | 类型| 是否必须 |备注 |
|
|
47
48
|
| -------------| :-----------: | :-----------: | :-----------: |
|
|
48
49
|
| wss | string |是 | WebSocket地址 |
|
|
49
|
-
| maxReconnect | number |否 | 最大重连次数非必填默认
|
|
50
|
+
| maxReconnect | number |否 | 最大重连次数非必填默认10 |
|
|
50
51
|
|
|
51
52
|
|
|
52
53
|
|
|
@@ -63,6 +64,7 @@ voice.connect({
|
|
|
63
64
|
media:{ audio:true, video:false},
|
|
64
65
|
onOpen: () => console.log("Connected!"),
|
|
65
66
|
onAuth:(e) => console.log(e),
|
|
67
|
+
onConnect:(e)=>console.log(e),
|
|
66
68
|
onError: (type: string, event: any) => console.error(e),
|
|
67
69
|
onMessage: (msg) => console.log("WS Message", msg)
|
|
68
70
|
});
|
|
@@ -78,6 +80,7 @@ voice.connect({
|
|
|
78
80
|
| onAuth | function | 是 | 监听到需要用户授权麦克风或者摄像头,返回值参考 <code>PermissionState.state 授权状态</code>|
|
|
79
81
|
| onMicrophoneChange | function | 否 | 监听麦克风变化,并返回 MediaStream |
|
|
80
82
|
| onCameraChange | function | 否 | 监听摄像头变化,并返回 MediaStream |
|
|
83
|
+
| onConnect | function | 是 | 监听是否正在重连
|
|
81
84
|
|
|
82
85
|
媒体模式参数
|
|
83
86
|
``` markdown
|