@coze/realtime-api 1.3.1 → 1.3.2-alpha.30153e

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.
@@ -1,25 +1,18 @@
1
1
  "use strict";
2
- // The require scope
3
2
  var __webpack_require__ = {};
4
- /************************************************************************/ // webpack/runtime/define_property_getters
5
3
  (()=>{
6
- __webpack_require__.d = function(exports1, definition) {
4
+ __webpack_require__.d = (exports1, definition)=>{
7
5
  for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
8
6
  enumerable: true,
9
7
  get: definition[key]
10
8
  });
11
9
  };
12
10
  })();
13
- // webpack/runtime/has_own_property
14
11
  (()=>{
15
- __webpack_require__.o = function(obj, prop) {
16
- return Object.prototype.hasOwnProperty.call(obj, prop);
17
- };
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
18
13
  })();
19
- // webpack/runtime/make_namespace_object
20
14
  (()=>{
21
- // define __esModule on exports
22
- __webpack_require__.r = function(exports1) {
15
+ __webpack_require__.r = (exports1)=>{
23
16
  if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
24
17
  value: 'Module'
25
18
  });
@@ -28,20 +21,41 @@ var __webpack_require__ = {};
28
21
  });
29
22
  };
30
23
  })();
31
- /************************************************************************/ var __webpack_exports__ = {};
32
- // ESM COMPAT FLAG
24
+ var __webpack_exports__ = {};
33
25
  __webpack_require__.r(__webpack_exports__);
34
- // EXPORTS
35
26
  __webpack_require__.d(__webpack_exports__, {
36
- WebLiveClient: ()=>/* binding */ WebLiveClient,
37
- ResourceStatus: ()=>/* binding */ live_ResourceStatus
27
+ WebLiveClient: ()=>WebLiveClient,
28
+ ResourceStatus: ()=>live_ResourceStatus
38
29
  });
39
30
  const api_namespaceObject = require("@coze/api");
40
- // WTN服务基础URL
31
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
32
+ try {
33
+ var info = gen[key](arg);
34
+ var value = info.value;
35
+ } catch (error) {
36
+ reject(error);
37
+ return;
38
+ }
39
+ if (info.done) resolve(value);
40
+ else Promise.resolve(value).then(_next, _throw);
41
+ }
42
+ function _async_to_generator(fn) {
43
+ return function() {
44
+ var self = this, args = arguments;
45
+ return new Promise(function(resolve, reject) {
46
+ var gen = fn.apply(self, args);
47
+ function _next(value) {
48
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
49
+ }
50
+ function _throw(err) {
51
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
52
+ }
53
+ _next(void 0);
54
+ });
55
+ };
56
+ }
41
57
  const WTN_BASE_URL = 'https://wtn.volcvideo.com';
42
- /**
43
- * WebRTC资源状态
44
- */ var live_ResourceStatus = /*#__PURE__*/ function(ResourceStatus) {
58
+ var live_ResourceStatus = /*#__PURE__*/ function(ResourceStatus) {
45
59
  ResourceStatus["IDLE"] = "idle";
46
60
  ResourceStatus["CONNECTING"] = "connecting";
47
61
  ResourceStatus["CONNECTED"] = "connected";
@@ -50,168 +64,120 @@ const WTN_BASE_URL = 'https://wtn.volcvideo.com';
50
64
  ResourceStatus["CLOSED"] = "closed";
51
65
  return ResourceStatus;
52
66
  }({});
53
- /**
54
- * 同声传译客户端
55
- */ class WebLiveClient {
56
- /**
57
- * 获取当前连接状态
58
- */ getStatus() {
67
+ class WebLiveClient {
68
+ getStatus() {
59
69
  return this.status;
60
70
  }
61
- /**
62
- * 添加状态变化监听器
63
- * @param callback 状态变化回调函数
64
- */ onStatusChange(callback) {
71
+ onStatusChange(callback) {
65
72
  this.statusListeners.push(callback);
66
73
  }
67
- /**
68
- * 移除状态变化监听器
69
- * @param callback 要移除的回调函数
70
- */ offStatusChange(callback) {
74
+ offStatusChange(callback) {
71
75
  this.removeStatusListener(callback);
72
76
  }
73
- /**
74
- * 移除状态变化监听器
75
- * @param callback 要移除的回调函数
76
- */ removeStatusListener(callback) {
77
+ removeStatusListener(callback) {
77
78
  const index = this.statusListeners.indexOf(callback);
78
79
  if (-1 !== index) this.statusListeners.splice(index, 1);
79
80
  }
80
- /**
81
- * 订阅音频资源
82
- * @param appId 应用ID
83
- * @param streamId 流ID
84
- * @param clientId 客户端ID
85
- */ async subscribe(appId, streamId) {
86
- let clientId = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : '';
87
- try {
88
- var _pc_localDescription;
89
- // 先清理现有连接
90
- if (this.peerConnection) {
91
- this.peerConnection.close();
92
- this.peerConnection = null;
93
- }
94
- this.setStatus("connecting");
95
- // 1. 创建RTCPeerConnection
96
- const rtcConfig = {};
97
- const pc = new RTCPeerConnection(rtcConfig);
98
- pc.ontrack = (event)=>{
99
- // 音频流
100
- this.player.onloadeddata = ()=>{
101
- this.player.play();
81
+ subscribe(appId, streamId, clientId = '') {
82
+ return _async_to_generator(function*() {
83
+ try {
84
+ var _pc_localDescription;
85
+ if (this.peerConnection) {
86
+ this.peerConnection.close();
87
+ this.peerConnection = null;
88
+ }
89
+ this.setStatus("connecting");
90
+ const rtcConfig = {};
91
+ const pc = new RTCPeerConnection(rtcConfig);
92
+ pc.ontrack = (event)=>{
93
+ this.player.onloadeddata = ()=>{
94
+ this.player.play();
95
+ };
96
+ this.player.srcObject = event.streams[0];
102
97
  };
103
- this.player.srcObject = event.streams[0];
104
- };
105
- this.peerConnection = pc;
106
- this.setupPeerConnectionListeners();
107
- pc.addTransceiver('audio', {
108
- direction: 'recvonly'
109
- });
110
- // 2. 创建Offer (SDP)
111
- const offer = await pc.createOffer();
112
- // 设置本地描述
113
- await pc.setLocalDescription(offer);
114
- // 等待ICE收集完成再继续
115
- await this.waitForIceGathering(pc);
116
- if (!(null === (_pc_localDescription = pc.localDescription) || void 0 === _pc_localDescription ? void 0 : _pc_localDescription.sdp)) throw new Error('Failed to create SDP offer');
117
- // 3. 发送Offer到WTN服务订阅资源
118
- let subscribeUrl = `${WTN_BASE_URL}/sub/${appId}/${streamId}?MuteVideo=true`;
119
- if (clientId) subscribeUrl += `&clientid=${clientId}`;
120
- const response = await fetch(subscribeUrl, {
121
- method: 'POST',
122
- headers: {
123
- 'Content-Type': 'application/sdp'
124
- },
125
- body: offer.sdp
126
- });
127
- if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
128
- // 4. 保存资源URL (用于销毁资源)
129
- this.resourceUrl = response.headers.get('location') || '';
130
- // 5. 设置远程SDP (Answer)
131
- // 直接获取文本响应,因为服务器返回的是application/sdp格式而非json
132
- const answerSdp = await response.text();
133
- const answer = new RTCSessionDescription({
134
- type: 'answer',
135
- sdp: answerSdp
136
- });
137
- await this.peerConnection.setRemoteDescription(answer);
138
- // 7. 返回结果
139
- return {
140
- status: this.status,
141
- peerConnection: this.peerConnection
142
- };
143
- } catch (error) {
144
- this.status = "failed";
145
- console.error('Failed to subscribe WebRTC stream:', error);
146
- return Promise.reject(error);
147
- }
98
+ this.peerConnection = pc;
99
+ this.setupPeerConnectionListeners();
100
+ pc.addTransceiver('audio', {
101
+ direction: 'recvonly'
102
+ });
103
+ const offer = yield pc.createOffer();
104
+ yield pc.setLocalDescription(offer);
105
+ yield this.waitForIceGathering(pc);
106
+ if (!(null == (_pc_localDescription = pc.localDescription) ? void 0 : _pc_localDescription.sdp)) throw new Error('Failed to create SDP offer');
107
+ let subscribeUrl = `${WTN_BASE_URL}/sub/${appId}/${streamId}?MuteVideo=true`;
108
+ if (clientId) subscribeUrl += `&clientid=${clientId}`;
109
+ const response = yield fetch(subscribeUrl, {
110
+ method: 'POST',
111
+ headers: {
112
+ 'Content-Type': 'application/sdp'
113
+ },
114
+ body: offer.sdp
115
+ });
116
+ if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
117
+ this.resourceUrl = response.headers.get('location') || '';
118
+ const answerSdp = yield response.text();
119
+ const answer = new RTCSessionDescription({
120
+ type: 'answer',
121
+ sdp: answerSdp
122
+ });
123
+ yield this.peerConnection.setRemoteDescription(answer);
124
+ return {
125
+ status: this.status,
126
+ peerConnection: this.peerConnection
127
+ };
128
+ } catch (error) {
129
+ this.status = "failed";
130
+ console.error('Failed to subscribe WebRTC stream:', error);
131
+ return Promise.reject(error);
132
+ }
133
+ }).call(this);
148
134
  }
149
- /**
150
- * 销毁订阅资源
151
- */ async unsubscribe() {
152
- try {
153
- // 销毁订阅资源
154
- if (!this.resourceUrl) throw new Error('No valid subscription resource URL to unsubscribe');
155
- this.setStatus("closing");
156
- const response = await fetch(this.resourceUrl, {
157
- method: 'DELETE'
158
- });
159
- if (!response.ok) throw new Error(`Failed to unsubscribe: ${response.status} ${response.statusText}`);
160
- // 关闭RTC连接
161
- if (this.peerConnection) {
162
- this.peerConnection.close();
163
- this.peerConnection = null;
135
+ unsubscribe() {
136
+ return _async_to_generator(function*() {
137
+ try {
138
+ if (!this.resourceUrl) throw new Error("No valid subscription resource URL to unsubscribe");
139
+ this.setStatus("closing");
140
+ const response = yield fetch(this.resourceUrl, {
141
+ method: 'DELETE'
142
+ });
143
+ if (!response.ok) throw new Error(`Failed to unsubscribe: ${response.status} ${response.statusText}`);
144
+ if (this.peerConnection) {
145
+ this.peerConnection.close();
146
+ this.peerConnection = null;
147
+ }
148
+ this.resourceUrl = '';
149
+ this.status = "closed";
150
+ return true;
151
+ } catch (error) {
152
+ console.error('Error unsubscribing resource:', error);
153
+ this.status = "failed";
154
+ return Promise.reject(error);
164
155
  }
165
- this.resourceUrl = '';
166
- this.status = "closed";
167
- return true;
168
- } catch (error) {
169
- console.error('Error unsubscribing resource:', error);
170
- this.status = "failed";
171
- return Promise.reject(error);
172
- }
156
+ }).call(this);
173
157
  }
174
- /**
175
- * 静音/取消静音
176
- * @param muted 是否静音
177
- */ setMuted(muted) {
158
+ setMuted(muted) {
178
159
  this.player.muted = muted;
179
160
  }
180
- /**
181
- * 关闭并清理资源
182
- */ close() {
183
- // 关闭PeerConnection
161
+ close() {
184
162
  this.closePeerConnection();
185
- // Clean up audio element
186
163
  if (this.player) {
187
164
  this.player.pause();
188
165
  this.player.srcObject = null;
189
166
  this.player.remove();
190
167
  }
191
- // 重置状态
192
168
  this.resourceUrl = '';
193
169
  this.setStatus("idle");
194
170
  }
195
- /**
196
- * 等待ICE收集完成
197
- * @param pc RTCPeerConnection实例
198
- */ waitForIceGathering(pc) {
171
+ waitForIceGathering(pc) {
199
172
  return new Promise((resolve)=>{
200
- // 如果已经收集完成,直接返回
201
- if ('complete' === pc.iceGatheringState) {
202
- resolve();
203
- return;
204
- }
205
- // 设置收集完成时的回调
173
+ if ('complete' === pc.iceGatheringState) return void resolve();
206
174
  const checkState = ()=>{
207
175
  if ('complete' === pc.iceGatheringState) {
208
176
  pc.removeEventListener('icegatheringstatechange', checkState);
209
177
  resolve();
210
178
  }
211
179
  };
212
- // 监听收集状态变化
213
180
  pc.addEventListener('icegatheringstatechange', checkState);
214
- // 添加超时处理,防止永远等待
215
181
  setTimeout(()=>resolve(), 5000);
216
182
  });
217
183
  }
@@ -219,8 +185,8 @@ const WTN_BASE_URL = 'https://wtn.volcvideo.com';
219
185
  if (!this.peerConnection) return;
220
186
  this.peerConnection.oniceconnectionstatechange = ()=>{
221
187
  var _this_peerConnection, _this_peerConnection1;
222
- console.log('ICE connection state changed:', null === (_this_peerConnection = this.peerConnection) || void 0 === _this_peerConnection ? void 0 : _this_peerConnection.iceConnectionState);
223
- switch(null === (_this_peerConnection1 = this.peerConnection) || void 0 === _this_peerConnection1 ? void 0 : _this_peerConnection1.iceConnectionState){
188
+ console.log('ICE connection state changed:', null == (_this_peerConnection = this.peerConnection) ? void 0 : _this_peerConnection.iceConnectionState);
189
+ switch(null == (_this_peerConnection1 = this.peerConnection) ? void 0 : _this_peerConnection1.iceConnectionState){
224
190
  case 'connected':
225
191
  case 'completed':
226
192
  this.setStatus("connected");
@@ -234,7 +200,7 @@ const WTN_BASE_URL = 'https://wtn.volcvideo.com';
234
200
  break;
235
201
  default:
236
202
  var _this_peerConnection2;
237
- console.log('ICE connection state changed:', null === (_this_peerConnection2 = this.peerConnection) || void 0 === _this_peerConnection2 ? void 0 : _this_peerConnection2.iceConnectionState);
203
+ console.log('ICE connection state changed:', null == (_this_peerConnection2 = this.peerConnection) ? void 0 : _this_peerConnection2.iceConnectionState);
238
204
  break;
239
205
  }
240
206
  };
@@ -242,23 +208,16 @@ const WTN_BASE_URL = 'https://wtn.volcvideo.com';
242
208
  if (event.candidate) console.log('New ICE candidate:', event.candidate);
243
209
  };
244
210
  }
245
- /**
246
- * 关闭PeerConnection
247
- */ closePeerConnection() {
211
+ closePeerConnection() {
248
212
  if (this.peerConnection) {
249
213
  this.peerConnection.close();
250
214
  this.peerConnection = null;
251
215
  }
252
216
  }
253
- /**
254
- * 设置状态并触发监听回调
255
- * @param newStatus 新状态
256
- * @private 私有方法,仅内部使用
257
- */ setStatus(newStatus) {
217
+ setStatus(newStatus) {
258
218
  const oldStatus = this.status;
259
219
  if (oldStatus !== newStatus) {
260
220
  this.status = newStatus;
261
- // 触发所有监听器
262
221
  for (const listener of this.statusListeners)try {
263
222
  listener(newStatus);
264
223
  } catch (error) {
@@ -271,22 +230,24 @@ const WTN_BASE_URL = 'https://wtn.volcvideo.com';
271
230
  this.resourceUrl = '';
272
231
  this.status = "idle";
273
232
  this.statusListeners = [];
274
- /**
275
- * 获取直播信息
276
- */ this.getLiveData = async ()=>{
277
- const api = new api_namespaceObject.CozeAPI({
278
- baseURL: api_namespaceObject.COZE_CN_BASE_URL,
279
- token: ''
280
- });
281
- return await api.audio.live.retrieve(this.liveId);
282
- };
233
+ this.getLiveData = ()=>_async_to_generator(function*() {
234
+ const api = new api_namespaceObject.CozeAPI({
235
+ baseURL: api_namespaceObject.COZE_CN_BASE_URL,
236
+ token: ''
237
+ });
238
+ return yield api.audio.live.retrieve(this.liveId);
239
+ }).call(this);
283
240
  this.setupPeerConnectionListeners();
284
241
  this.player = document.createElement('audio');
285
242
  this.liveId = liveId;
286
243
  }
287
244
  }
288
- var __webpack_export_target__ = exports;
289
- for(var i in __webpack_exports__)__webpack_export_target__[i] = __webpack_exports__[i];
290
- if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
245
+ exports.ResourceStatus = __webpack_exports__.ResourceStatus;
246
+ exports.WebLiveClient = __webpack_exports__.WebLiveClient;
247
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
248
+ "ResourceStatus",
249
+ "WebLiveClient"
250
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
251
+ Object.defineProperty(exports, '__esModule', {
291
252
  value: true
292
253
  });
@@ -1,173 +1,47 @@
1
1
  var event_names_EventNames = /*#__PURE__*/ function(EventNames) {
2
- /**
3
- * en: All events
4
- * zh: 所有事件
5
- */ EventNames["ALL"] = "realtime.event";
6
- /**
7
- * en: All client events
8
- * zh: 所有客户端事件
9
- */ EventNames["ALL_CLIENT"] = "client.*";
10
- /**
11
- * en: All server events
12
- * zh: 所有服务端事件
13
- */ EventNames["ALL_SERVER"] = "server.*";
14
- /**
15
- * en: Room info
16
- * zh: 房间信息
17
- */ EventNames["ROOM_INFO"] = "client.room.info";
18
- /**
19
- * en: Client connected
20
- * zh: 客户端连接
21
- */ EventNames["CONNECTED"] = "client.connected";
22
- /**
23
- * en: Client connecting
24
- * zh: 客户端连接中
25
- */ EventNames["CONNECTING"] = "client.connecting";
26
- /**
27
- * en: Client interrupted
28
- * zh: 客户端中断
29
- */ EventNames["INTERRUPTED"] = "client.interrupted";
30
- /**
31
- * en: Client disconnected
32
- * zh: 客户端断开
33
- */ EventNames["DISCONNECTED"] = "client.disconnected";
34
- /**
35
- * en: Client audio unmuted
36
- * zh: 客户端音频未静音
37
- */ EventNames["AUDIO_UNMUTED"] = "client.audio.unmuted";
38
- /**
39
- * en: Client audio muted
40
- * zh: 客户端音频静音
41
- */ EventNames["AUDIO_MUTED"] = "client.audio.muted";
42
- /**
43
- * en: Client video on
44
- * zh: 客户端视频开启
45
- */ EventNames["VIDEO_ON"] = "client.video.on";
46
- /**
47
- * en: Client video off
48
- * zh: 客户端视频关闭
49
- */ EventNames["VIDEO_OFF"] = "client.video.off";
50
- /**
51
- * en: Client video error
52
- * zh: 客户端视频(或屏幕共享)错误
53
- */ EventNames["VIDEO_ERROR"] = "client.video.error";
54
- /**
55
- * en: Client video event
56
- * zh: 客户端视频事件
57
- */ EventNames["PLAYER_EVENT"] = "client.video.event";
58
- /**
59
- * en: Client error
60
- * zh: 客户端错误
61
- */ EventNames["ERROR"] = "client.error";
62
- /**
63
- * en: Audio noise reduction enabled
64
- * zh: 抑制平稳噪声
65
- */ EventNames["SUPPRESS_STATIONARY_NOISE"] = "client.suppress.stationary.noise";
66
- /**
67
- * en: Suppress non-stationary noise
68
- * zh: 抑制非平稳噪声
69
- */ EventNames["SUPPRESS_NON_STATIONARY_NOISE"] = "client.suppress.non.stationary.noise";
70
- /**
71
- * en: Audio input device changed
72
- * zh: 音频输入设备改变
73
- */ EventNames["AUDIO_INPUT_DEVICE_CHANGED"] = "client.input.device.changed";
74
- /**
75
- * en: Audio output device changed
76
- * zh: 音频输出设备改变
77
- */ EventNames["AUDIO_OUTPUT_DEVICE_CHANGED"] = "client.output.device.changed";
78
- /**
79
- * en: Video input device changed
80
- * zh: 视频输入设备改变
81
- */ EventNames["VIDEO_INPUT_DEVICE_CHANGED"] = "client.video.input.device.changed";
82
- /**
83
- * en: Network quality changed
84
- * zh: 网络质量改变
85
- */ EventNames["NETWORK_QUALITY"] = "client.network.quality";
86
- /**
87
- * en: Bot joined
88
- * zh: Bot 加入
89
- */ EventNames["BOT_JOIN"] = "server.bot.join";
90
- /**
91
- * en: Bot left
92
- * zh: Bot 离开
93
- */ EventNames["BOT_LEAVE"] = "server.bot.leave";
94
- /**
95
- * en: Audio speech started
96
- * zh: 开始说话
97
- */ EventNames["AUDIO_AGENT_SPEECH_STARTED"] = "server.audio.agent.speech_started";
98
- /**
99
- * en: Audio speech stopped
100
- * zh: 停止说话
101
- */ EventNames["AUDIO_AGENT_SPEECH_STOPPED"] = "server.audio.agent.speech_stopped";
102
- /**
103
- * en: Server error
104
- * zh: 服务端错误
105
- */ EventNames["SERVER_ERROR"] = "server.error";
106
- /**
107
- * en: User speech started
108
- * zh: 用户开始说话
109
- */ EventNames["AUDIO_USER_SPEECH_STARTED"] = "server.audio.user.speech_started";
110
- /**
111
- * en: User speech stopped
112
- * zh: 用户停止说话
113
- */ EventNames["AUDIO_USER_SPEECH_STOPPED"] = "server.audio.user.speech_stopped";
114
- /**
115
- * en: User successfully enters the room
116
- * zh: 用户成功进入房间后,会收到该事件
117
- */ EventNames["SESSION_CREATED"] = "server.session.created";
118
- /**
119
- * en: Session updated
120
- * zh: 会话更新
121
- */ EventNames["SESSION_UPDATED"] = "server.session.updated";
122
- /**
123
- * en: Conversation created
124
- * zh: 会话创建
125
- */ EventNames["CONVERSATION_CREATED"] = "server.conversation.created";
126
- /**
127
- * en: Conversation chat created
128
- * zh: 会话对话创建
129
- */ EventNames["CONVERSATION_CHAT_CREATED"] = "server.conversation.chat.created";
130
- /**
131
- * en: Conversation chat in progress
132
- * zh: 对话正在处理中
133
- */ EventNames["CONVERSATION_CHAT_IN_PROGRESS"] = "server.conversation.chat.in_progress";
134
- /**
135
- * en: Conversation message delta received
136
- * zh: 文本消息增量返回
137
- */ EventNames["CONVERSATION_MESSAGE_DELTA"] = "server.conversation.message.delta";
138
- /**
139
- * en: Conversation message completed
140
- * zh: 文本消息完成
141
- */ EventNames["CONVERSATION_MESSAGE_COMPLETED"] = "server.conversation.message.completed";
142
- /**
143
- * en: Conversation chat completed
144
- * zh: 对话完成
145
- */ EventNames["CONVERSATION_CHAT_COMPLETED"] = "server.conversation.chat.completed";
146
- /**
147
- * en: Conversation chat requires action
148
- * zh: 对话需要插件
149
- */ EventNames["CONVERSATION_CHAT_REQUIRES_ACTION"] = "server.conversation.chat.requires_action";
150
- /**
151
- * en: Conversation chat failed
152
- * zh: 对话失败
153
- */ EventNames["CONVERSATION_CHAT_FAILED"] = "server.conversation.chat.failed";
154
- /**
155
- * en: Session pre answer updated
156
- * zh: 安抚配置更新成功
157
- */ EventNames["SESSION_PRE_ANSWER_UPDATED"] = "server.session.pre_answer.updated";
158
- /**
159
- * en: Conversation audio transcript delta
160
- * zh: 用户语音识别字幕
161
- */ EventNames["CONVERSATION_AUDIO_TRANSCRIPT_DELTA"] = "server.conversation.audio_transcript.delta";
162
- /**
163
- * en: Mode updated
164
- * zh: 更新房间模式成功
165
- */ EventNames["MODE_UPDATED"] = "server.mode.updated";
166
- /**
167
- * en: Live created
168
- * zh: 直播创建
169
- */ EventNames["LIVE_CREATED"] = "server.live.created";
2
+ EventNames["ALL"] = "realtime.event";
3
+ EventNames["ALL_CLIENT"] = "client.*";
4
+ EventNames["ALL_SERVER"] = "server.*";
5
+ EventNames["ROOM_INFO"] = "client.room.info";
6
+ EventNames["CONNECTED"] = "client.connected";
7
+ EventNames["CONNECTING"] = "client.connecting";
8
+ EventNames["INTERRUPTED"] = "client.interrupted";
9
+ EventNames["DISCONNECTED"] = "client.disconnected";
10
+ EventNames["AUDIO_UNMUTED"] = "client.audio.unmuted";
11
+ EventNames["AUDIO_MUTED"] = "client.audio.muted";
12
+ EventNames["VIDEO_ON"] = "client.video.on";
13
+ EventNames["VIDEO_OFF"] = "client.video.off";
14
+ EventNames["VIDEO_ERROR"] = "client.video.error";
15
+ EventNames["PLAYER_EVENT"] = "client.video.event";
16
+ EventNames["ERROR"] = "client.error";
17
+ EventNames["SUPPRESS_STATIONARY_NOISE"] = "client.suppress.stationary.noise";
18
+ EventNames["SUPPRESS_NON_STATIONARY_NOISE"] = "client.suppress.non.stationary.noise";
19
+ EventNames["AUDIO_INPUT_DEVICE_CHANGED"] = "client.input.device.changed";
20
+ EventNames["AUDIO_OUTPUT_DEVICE_CHANGED"] = "client.output.device.changed";
21
+ EventNames["VIDEO_INPUT_DEVICE_CHANGED"] = "client.video.input.device.changed";
22
+ EventNames["NETWORK_QUALITY"] = "client.network.quality";
23
+ EventNames["BOT_JOIN"] = "server.bot.join";
24
+ EventNames["BOT_LEAVE"] = "server.bot.leave";
25
+ EventNames["AUDIO_AGENT_SPEECH_STARTED"] = "server.audio.agent.speech_started";
26
+ EventNames["AUDIO_AGENT_SPEECH_STOPPED"] = "server.audio.agent.speech_stopped";
27
+ EventNames["SERVER_ERROR"] = "server.error";
28
+ EventNames["AUDIO_USER_SPEECH_STARTED"] = "server.audio.user.speech_started";
29
+ EventNames["AUDIO_USER_SPEECH_STOPPED"] = "server.audio.user.speech_stopped";
30
+ EventNames["SESSION_CREATED"] = "server.session.created";
31
+ EventNames["SESSION_UPDATED"] = "server.session.updated";
32
+ EventNames["CONVERSATION_CREATED"] = "server.conversation.created";
33
+ EventNames["CONVERSATION_CHAT_CREATED"] = "server.conversation.chat.created";
34
+ EventNames["CONVERSATION_CHAT_IN_PROGRESS"] = "server.conversation.chat.in_progress";
35
+ EventNames["CONVERSATION_MESSAGE_DELTA"] = "server.conversation.message.delta";
36
+ EventNames["CONVERSATION_MESSAGE_COMPLETED"] = "server.conversation.message.completed";
37
+ EventNames["CONVERSATION_CHAT_COMPLETED"] = "server.conversation.chat.completed";
38
+ EventNames["CONVERSATION_CHAT_REQUIRES_ACTION"] = "server.conversation.chat.requires_action";
39
+ EventNames["CONVERSATION_CHAT_FAILED"] = "server.conversation.chat.failed";
40
+ EventNames["SESSION_PRE_ANSWER_UPDATED"] = "server.session.pre_answer.updated";
41
+ EventNames["CONVERSATION_AUDIO_TRANSCRIPT_DELTA"] = "server.conversation.audio_transcript.delta";
42
+ EventNames["MODE_UPDATED"] = "server.mode.updated";
43
+ EventNames["LIVE_CREATED"] = "server.live.created";
170
44
  return EventNames;
171
45
  }(event_names_EventNames || {});
172
- /* ESM default export */ const event_names = event_names_EventNames;
46
+ const event_names = event_names_EventNames;
173
47
  export { event_names as default };