@coze/realtime-api 0.0.2 → 0.0.4
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 +2 -0
- package/dist/cjs/index.cjs +41928 -0
- package/dist/cjs/index.cjs.LICENSE.txt +1 -0
- package/dist/esm/index.js +41912 -0
- package/dist/esm/index.js.LICENSE.txt +1 -0
- package/dist/{client.d.ts → types/client.d.ts} +6 -3
- package/dist/{event-handler.d.ts → types/event-handler.d.ts} +21 -1
- package/dist/{index.d.ts → types/index.d.ts} +21 -1
- package/dist/{utils.d.ts → types/utils.d.ts} +8 -0
- package/dist/umd/index.js +41931 -0
- package/dist/umd/index.js.LICENSE.txt +1 -0
- package/package.json +22 -14
- package/dist/client.js +0 -205
- package/dist/error.js +0 -36
- package/dist/event-handler.js +0 -106
- package/dist/index.js +0 -223
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/utils.js +0 -25
- /package/dist/{error.d.ts → types/error.d.ts} +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
@@ -3,6 +3,7 @@ import { RealtimeEventHandler } from './event-handler';
|
|
3
3
|
export declare class EngineClient extends RealtimeEventHandler {
|
4
4
|
private engine;
|
5
5
|
private joinUserId;
|
6
|
+
private _AIAnsExtension;
|
6
7
|
constructor(appId: string, debug?: boolean, isTestEnv?: boolean);
|
7
8
|
bindEngineEvents(): void;
|
8
9
|
removeEventListener(): void;
|
@@ -16,9 +17,8 @@ export declare class EngineClient extends RealtimeEventHandler {
|
|
16
17
|
uid: string;
|
17
18
|
audioMutedDefault?: boolean;
|
18
19
|
}): Promise<void>;
|
19
|
-
|
20
|
-
|
21
|
-
}>;
|
20
|
+
setAudioInputDevice(deviceId: string): Promise<void>;
|
21
|
+
setAudioOutputDevice(deviceId: string): Promise<void>;
|
22
22
|
createLocalStream(): Promise<void>;
|
23
23
|
disconnect(): Promise<void>;
|
24
24
|
changeAudioState(isMicOn: boolean): Promise<void>;
|
@@ -27,6 +27,9 @@ export declare class EngineClient extends RealtimeEventHandler {
|
|
27
27
|
enableAudioPropertiesReport(config?: AudioPropertiesConfig): void;
|
28
28
|
handleLocalAudioPropertiesReport(event: any): void;
|
29
29
|
handleRemoteAudioPropertiesReport(event: unknown): void;
|
30
|
+
enableAudioNoiseReduction(): Promise<void>;
|
31
|
+
initAIAnsExtension(): Promise<void>;
|
32
|
+
changeAIAnsExtension(enable: boolean): void;
|
30
33
|
startAudioPlaybackDeviceTest(): Promise<void>;
|
31
34
|
stopAudioPlaybackDeviceTest(): void;
|
32
35
|
}
|
@@ -43,7 +43,27 @@ export declare enum EventNames {
|
|
43
43
|
* en: Client error
|
44
44
|
* zh: 客户端错误
|
45
45
|
*/
|
46
|
-
ERROR = "client.error"
|
46
|
+
ERROR = "client.error",
|
47
|
+
/**
|
48
|
+
* en: Audio noise reduction enabled
|
49
|
+
* zh: 抑制平稳噪声
|
50
|
+
*/
|
51
|
+
SUPPRESS_STATIONARY_NOISE = "client.suppress.stationary.noise",
|
52
|
+
/**
|
53
|
+
* en: Suppress non-stationary noise
|
54
|
+
* zh: 抑制非平稳噪声
|
55
|
+
*/
|
56
|
+
SUPPRESS_NON_STATIONARY_NOISE = "client.suppress.non.stationary.noise",
|
57
|
+
/**
|
58
|
+
* en: Audio input device changed
|
59
|
+
* zh: 音频输入设备改变
|
60
|
+
*/
|
61
|
+
AUDIO_INPUT_DEVICE_CHANGED = "client.input.device.changed",
|
62
|
+
/**
|
63
|
+
* en: Audio output device changed
|
64
|
+
* zh: 音频输出设备改变
|
65
|
+
*/
|
66
|
+
AUDIO_OUTPUT_DEVICE_CHANGED = "client.output.device.changed"
|
47
67
|
}
|
48
68
|
type EventCallback = (eventName: string, event: unknown) => void;
|
49
69
|
export declare class RealtimeEventHandler {
|
@@ -14,7 +14,9 @@ export interface RealtimeClientConfig {
|
|
14
14
|
/** Whether to mute by default, defaults to false
|
15
15
|
* If set to true, audio streams will not be automatically published and subscribed */
|
16
16
|
audioMutedDefault?: boolean;
|
17
|
-
connectorId
|
17
|
+
connectorId: string /** required, Connector Id */;
|
18
|
+
suppressStationaryNoise?: boolean /** optional, Suppress stationary noise, defaults to false */;
|
19
|
+
suppressNonStationaryNoise?: boolean /** optional, Suppress non-stationary noise, defaults to false */;
|
18
20
|
}
|
19
21
|
declare class RealtimeClient extends RealtimeEventHandler {
|
20
22
|
private _config;
|
@@ -46,6 +48,12 @@ declare class RealtimeClient extends RealtimeEventHandler {
|
|
46
48
|
* 可选,是否允许在浏览器环境中使用个人访问令牌。
|
47
49
|
* @param config.audioMutedDefault - Optional, whether audio is muted by default, defaults to false. |
|
48
50
|
* 可选,默认是否静音,默认值为 false。
|
51
|
+
* @param config.connectorId - Required, Connector Id. |
|
52
|
+
* 必填,渠道 Id。
|
53
|
+
* @param config.suppressStationaryNoise - Optional, suppress stationary noise, defaults to false. |
|
54
|
+
* 可选,默认是否抑制静态噪声,默认值为 false。
|
55
|
+
* @param config.suppressNonStationaryNoise - Optional, suppress non-stationary noise, defaults to false. |
|
56
|
+
* 可选,默认是否抑制非静态噪声,默认值为 false。
|
49
57
|
*/
|
50
58
|
constructor(config: RealtimeClientConfig);
|
51
59
|
/**
|
@@ -96,5 +104,17 @@ declare class RealtimeClient extends RealtimeEventHandler {
|
|
96
104
|
* zh: 停止音频播放设备测试(仅限调试模式)
|
97
105
|
*/
|
98
106
|
stopAudioPlaybackDeviceTest(): void;
|
107
|
+
/**
|
108
|
+
* en: Set the audio input device
|
109
|
+
*
|
110
|
+
* zh: 设置音频输入设备
|
111
|
+
*/
|
112
|
+
setAudioInputDevice(deviceId: string): Promise<void>;
|
113
|
+
/**
|
114
|
+
* en: Set the audio output device
|
115
|
+
*
|
116
|
+
* zh: 设置音频输出设备
|
117
|
+
*/
|
118
|
+
setAudioOutputDevice(deviceId: string): Promise<void>;
|
99
119
|
}
|
100
120
|
export { RealtimeUtils, RealtimeClient, RealtimeAPIError, RealtimeError, EventNames, };
|
@@ -9,3 +9,11 @@ export declare const sleep: (milliseconds: number) => Promise<void>;
|
|
9
9
|
* Check microphone permission,return boolean
|
10
10
|
*/
|
11
11
|
export declare const checkPermission: () => Promise<boolean>;
|
12
|
+
/**
|
13
|
+
* Get audio devices
|
14
|
+
* @returns Promise<AudioDevices> Object containing arrays of audio input and output devices
|
15
|
+
*/
|
16
|
+
export declare const getAudioDevices: () => Promise<{
|
17
|
+
audioInputs: MediaDeviceInfo[];
|
18
|
+
audioOutputs: MediaDeviceInfo[];
|
19
|
+
}>;
|