@coze/realtime-api 1.1.1 → 1.2.0-beta.1

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.
@@ -0,0 +1,143 @@
1
+ declare enum EventNames {
2
+ /**
3
+ * en: All events
4
+ * zh: 所有事件
5
+ */
6
+ ALL = "realtime.event",
7
+ /**
8
+ * en: All client events
9
+ * zh: 所有客户端事件
10
+ */
11
+ ALL_CLIENT = "client.*",
12
+ /**
13
+ * en: All server events
14
+ * zh: 所有服务端事件
15
+ */
16
+ ALL_SERVER = "server.*",
17
+ /**
18
+ * en: Client connected
19
+ * zh: 客户端连接
20
+ */
21
+ CONNECTED = "client.connected",
22
+ /**
23
+ * en: Client connecting
24
+ * zh: 客户端连接中
25
+ */
26
+ CONNECTING = "client.connecting",
27
+ /**
28
+ * en: Client interrupted
29
+ * zh: 客户端中断
30
+ */
31
+ INTERRUPTED = "client.interrupted",
32
+ /**
33
+ * en: Client disconnected
34
+ * zh: 客户端断开
35
+ */
36
+ DISCONNECTED = "client.disconnected",
37
+ /**
38
+ * en: Client audio unmuted
39
+ * zh: 客户端音频未静音
40
+ */
41
+ AUDIO_UNMUTED = "client.audio.unmuted",
42
+ /**
43
+ * en: Client audio muted
44
+ * zh: 客户端音频静音
45
+ */
46
+ AUDIO_MUTED = "client.audio.muted",
47
+ /**
48
+ * en: Client video on
49
+ * zh: 客户端视频开启
50
+ */
51
+ VIDEO_ON = "client.video.on",
52
+ /**
53
+ * en: Client video off
54
+ * zh: 客户端视频关闭
55
+ */
56
+ VIDEO_OFF = "client.video.off",
57
+ /**
58
+ * en: Client video event
59
+ * zh: 客户端视频事件
60
+ */
61
+ PLAYER_EVENT = "client.video.event",
62
+ /**
63
+ * en: Client error
64
+ * zh: 客户端错误
65
+ */
66
+ ERROR = "client.error",
67
+ /**
68
+ * en: Audio noise reduction enabled
69
+ * zh: 抑制平稳噪声
70
+ */
71
+ SUPPRESS_STATIONARY_NOISE = "client.suppress.stationary.noise",
72
+ /**
73
+ * en: Suppress non-stationary noise
74
+ * zh: 抑制非平稳噪声
75
+ */
76
+ SUPPRESS_NON_STATIONARY_NOISE = "client.suppress.non.stationary.noise",
77
+ /**
78
+ * en: Audio input device changed
79
+ * zh: 音频输入设备改变
80
+ */
81
+ AUDIO_INPUT_DEVICE_CHANGED = "client.input.device.changed",
82
+ /**
83
+ * en: Audio output device changed
84
+ * zh: 音频输出设备改变
85
+ */
86
+ AUDIO_OUTPUT_DEVICE_CHANGED = "client.output.device.changed",
87
+ /**
88
+ * en: Video input device changed
89
+ * zh: 视频输入设备改变
90
+ */
91
+ VIDEO_INPUT_DEVICE_CHANGED = "client.video.input.device.changed",
92
+ /**
93
+ * en: Network quality changed
94
+ * zh: 网络质量改变
95
+ */
96
+ NETWORK_QUALITY = "client.network.quality",
97
+ /**
98
+ * en: Bot joined
99
+ * zh: Bot 加入
100
+ */
101
+ BOT_JOIN = "server.bot.join",
102
+ /**
103
+ * en: Bot left
104
+ * zh: Bot 离开
105
+ */
106
+ BOT_LEAVE = "server.bot.leave",
107
+ /**
108
+ * en: Audio speech started
109
+ * zh: 开始说话
110
+ */
111
+ AUDIO_AGENT_SPEECH_STARTED = "server.audio.agent.speech_started",
112
+ /**
113
+ * en: Audio speech stopped
114
+ * zh: 停止说话
115
+ */
116
+ AUDIO_AGENT_SPEECH_STOPPED = "server.audio.agent.speech_stopped",
117
+ /**
118
+ * en: Server error
119
+ * zh: 服务端错误
120
+ */
121
+ SERVER_ERROR = "server.error",
122
+ /**
123
+ * en: User speech started
124
+ * zh: 用户开始说话
125
+ */
126
+ AUDIO_USER_SPEECH_STARTED = "server.audio.user.speech_started",
127
+ /**
128
+ * en: User speech stopped
129
+ * zh: 用户停止说话
130
+ */
131
+ AUDIO_USER_SPEECH_STOPPED = "server.audio.user.speech_stopped",
132
+ /**
133
+ * en: User successfully enters the room
134
+ * zh: 用户成功进入房间后,会收到该事件
135
+ */
136
+ SESSION_CREATED = "server.session.created",
137
+ /**
138
+ * en: Session updated
139
+ * zh: 会话更新
140
+ */
141
+ SESSION_UPDATE = "server.session.update"
142
+ }
143
+ export default EventNames;
@@ -1,7 +1,8 @@
1
1
  import { type ScreenConfig, type AudioPropertiesConfig, type IRTCEngine } from '@volcengine/rtc';
2
2
  import { type CreateRoomData, type GetToken } from '@coze/api';
3
3
  import * as RealtimeUtils from './utils';
4
- import { RealtimeEventHandler, EventNames } from './event-handler';
4
+ import EventNames from './event-names';
5
+ import { RealtimeEventHandler } from './event-handler';
5
6
  import { RealtimeAPIError, RealtimeError } from './error';
6
7
  export interface VideoConfig {
7
8
  videoOnDefault?: boolean /** optional, Whether to turn on video by default, defaults to true */;
@@ -29,6 +30,7 @@ export interface RealtimeClientConfig {
29
30
  suppressNonStationaryNoise?: boolean /** optional, Suppress non-stationary noise, defaults to false */;
30
31
  videoConfig?: VideoConfig /** optional, Video configuration */;
31
32
  isAutoSubscribeAudio?: boolean /** optional, Whether to automatically subscribe to bot reply audio streams, defaults to true */;
33
+ prologueContent?: string /** optional, Prologue content */;
32
34
  }
33
35
  declare class RealtimeClient extends RealtimeEventHandler {
34
36
  _config: RealtimeClientConfig;
@@ -79,6 +81,7 @@ declare class RealtimeClient extends RealtimeEventHandler {
79
81
  * 可选,视频输入设备的设备 ID。
80
82
  * @param config.videoConfig.screenConfig - Optional, Screen share configuration if videoInputDeviceId is 'screenShare' see https://www.volcengine.com/docs/6348/104481#screenconfig for more details. |
81
83
  * 可选,屏幕共享配置,如果 videoInputDeviceId 是 'screenShare',请参考 https://www.volcengine.com/docs/6348/104481#screenconfig 了解更多详情。
84
+ * @param config.prologueContent - Optional, Prologue content. | 可选,开场白内容。
82
85
  */
83
86
  constructor(config: RealtimeClientConfig);
84
87
  /**
@@ -142,7 +145,12 @@ declare class RealtimeClient extends RealtimeEventHandler {
142
145
  * zh: 设置音频输出设备
143
146
  */
144
147
  setAudioOutputDevice(deviceId: string): Promise<void>;
145
- setVideoInputDevice(deviceId: string): Promise<void>;
148
+ /**
149
+ * en: Set the video input device
150
+ *
151
+ * zh: 设置视频输入设备
152
+ */
153
+ setVideoInputDevice(deviceId: string | 'screenShare' | 'user' | 'environment'): Promise<void>;
146
154
  /**
147
155
  * en: Get the RTC engine instance, for detail visit https://www.volcengine.com/docs/6348/104481
148
156
  *
@@ -36,6 +36,12 @@ export declare const getAudioDevices: ({ video, }?: {
36
36
  videoInputs: MediaDeviceInfo[];
37
37
  }>;
38
38
  export declare const isScreenShareDevice: (deviceId?: string) => boolean;
39
+ /**
40
+ * 判断是否前后置摄像头
41
+ * @param deviceId
42
+ * @returns
43
+ */
44
+ export declare const isMobileVideoDevice: (deviceId?: string) => boolean;
39
45
  /**
40
46
  * Check if browser supports screen sharing
41
47
  * 检查浏览器是否支持屏幕共享