usc-rtc-client 2.2.1 → 3.0.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.
- package/Readme.md +15 -11
- package/dist/client/RtcClient.d.ts +2 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.es.js +359 -320
- package/dist/index.umd.js +4 -6
- package/dist/session/RtcAbstractSession.d.ts +0 -2
- package/package.json +1 -1
- package/dist/session/UscRtcProtocol.d.ts +0 -6
package/Readme.md
CHANGED
|
@@ -243,8 +243,11 @@ async function startMonitoring(remoteNumber) {
|
|
|
243
243
|
monitorPlayer, // 视频容器
|
|
244
244
|
{
|
|
245
245
|
audioOnly: false, // 是否仅播放音频
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
heartTime: 30, // 心跳间隔时间(秒)
|
|
247
|
+
expireTime: 60, // 信令过期时间(秒)
|
|
248
|
+
onerror: (error) => {
|
|
249
|
+
console.error('监控错误:', error)
|
|
250
|
+
}
|
|
248
251
|
}
|
|
249
252
|
)
|
|
250
253
|
|
|
@@ -271,17 +274,19 @@ async function startMonitoring(remoteNumber) {
|
|
|
271
274
|
| options | object | 可选配置项 | 否 |
|
|
272
275
|
|
|
273
276
|
options 配置项:
|
|
274
|
-
| 配置项 | 类型 | 默认值 | 描述 |
|
|
275
277
|
|
|
278
|
+
| 配置项 | 类型 | 默认值 | 描述 |
|
|
276
279
|
|--------|------|--------|------|
|
|
277
280
|
| audioOnly | boolean | false | 是否仅播放音频 |
|
|
278
|
-
|
|
|
279
|
-
|
|
|
281
|
+
| expireTime | number | 60 | 注册信令的过期时间(秒) |
|
|
282
|
+
| heartTime | number | 30 | 向信令服务器发送心跳的间隔时间(秒) |
|
|
283
|
+
| onerror | function | undefined | 错误回调函数,在发生错误时调用 |
|
|
280
284
|
|
|
281
285
|
### 3.监控模式的特点
|
|
282
286
|
|
|
283
|
-
-
|
|
287
|
+
- 监控模式使用'anonymous'作为本地号码,无需登录即可使用
|
|
284
288
|
- 监控模式是单向的,被监控方不会收到任何通知
|
|
289
|
+
- 监控模式支持配置心跳间隔和信令过期时间
|
|
285
290
|
- 监控模式适合用于监控、预览等场景
|
|
286
291
|
|
|
287
292
|
## 5.ptt 消息接口
|
|
@@ -467,14 +472,13 @@ export function playRemote(
|
|
|
467
472
|
remoteNumber: string,
|
|
468
473
|
container: HTMLVideoElement,
|
|
469
474
|
options?: {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
475
|
+
expireTime?: number;
|
|
476
|
+
heartTime?: number;
|
|
477
|
+
onerror?: (e: any) => void;
|
|
478
|
+
audioOnly?: boolean;
|
|
473
479
|
}
|
|
474
480
|
): Promise<{
|
|
475
481
|
destroy: () => void;
|
|
476
|
-
on: (event: string, callback: Function) => void;
|
|
477
|
-
off: (event: string, callback: Function) => void;
|
|
478
482
|
}>
|
|
479
483
|
|
|
480
484
|
export function renderStreamToContainer(stream: MediaStream, container: HTMLVideoElement | HTMLAudioElement): void
|
|
@@ -6,9 +6,8 @@ export declare class RtcClient extends RtcClientBase {
|
|
|
6
6
|
createSession(remoteNumber?: string): RtcSession;
|
|
7
7
|
playRemote(remoteNumber: string, container: HTMLVideoElement, options?: {
|
|
8
8
|
audioOnly?: boolean;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}): Promise<RtcSession>;
|
|
9
|
+
onerror?: (e: any) => void;
|
|
10
|
+
}): RtcSession;
|
|
12
11
|
processMessage(data: any): void;
|
|
13
12
|
destroy(): void;
|
|
14
13
|
removeSession(session: RtcAbstractSession): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -15,12 +15,12 @@ export declare const createRtcClient: (config: {
|
|
|
15
15
|
pttServer?: string;
|
|
16
16
|
}) => Promise<RtcClient>;
|
|
17
17
|
export declare const playRemote: (server: string, remoteNumber: string, container: HTMLVideoElement, option?: {
|
|
18
|
-
expireTime?: number;
|
|
19
|
-
heartTime?: number;
|
|
20
|
-
|
|
18
|
+
expireTime?: number | undefined;
|
|
19
|
+
heartTime?: number | undefined;
|
|
20
|
+
onerror?: ((e: any) => void) | undefined;
|
|
21
|
+
audioOnly?: boolean | undefined;
|
|
22
|
+
} | undefined) => Promise<{
|
|
21
23
|
destroy: () => void;
|
|
22
|
-
on: (event: string, callback: (...args: any[]) => void) => void;
|
|
23
|
-
off: (event: string, callback: (...args: any[]) => void) => void;
|
|
24
24
|
}>;
|
|
25
25
|
/**
|
|
26
26
|
* 获取webrtc授权, 只需要调用一次,在合适的场景下使用就可以了
|