@coze/realtime-api 1.2.1-beta.3 → 1.2.1-beta.5
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/dist/cjs/event-names/index.js +9 -1
- package/dist/cjs/index.js +23 -1
- package/dist/esm/event-names/index.js +9 -1
- package/dist/esm/index.js +23 -1
- package/dist/types/client.d.ts +2 -0
- package/dist/types/event-names/client.d.ts +2 -0
- package/dist/types/event-names/event-names.d.ts +11 -1
- package/dist/types/event-names/index.d.ts +3 -1
- package/dist/types/event-names.d.ts +11 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/umd/index.js +23 -1
- package/package.json +4 -4
@@ -117,6 +117,14 @@ var EventNames = /*#__PURE__*/ function(EventNames) {
|
|
117
117
|
* zh: 网络质量改变
|
118
118
|
*/ EventNames["NETWORK_QUALITY"] = "client.network.quality";
|
119
119
|
/**
|
120
|
+
* en: User publish screen
|
121
|
+
* zh: 用户发布屏幕
|
122
|
+
*/ EventNames["USER_PUBLISH_SCREEN"] = "client.user.publish.screen";
|
123
|
+
/**
|
124
|
+
* en: User unpublish screen
|
125
|
+
* zh: 用户取消发布屏幕
|
126
|
+
*/ EventNames["USER_UNPUBLISH_SCREEN"] = "client.user.unpublish.screen";
|
127
|
+
/**
|
120
128
|
* en: Bot joined
|
121
129
|
* zh: Bot 加入
|
122
130
|
*/ EventNames["BOT_JOIN"] = "server.bot.join";
|
@@ -151,7 +159,7 @@ var EventNames = /*#__PURE__*/ function(EventNames) {
|
|
151
159
|
/**
|
152
160
|
* en: Session updated
|
153
161
|
* zh: 会话更新
|
154
|
-
*/ EventNames["
|
162
|
+
*/ EventNames["SESSION_UPDATED"] = "server.session.updated";
|
155
163
|
return EventNames;
|
156
164
|
}(EventNames || {});
|
157
165
|
/* ESM default export */ const __WEBPACK_DEFAULT_EXPORT__ = EventNames;
|
package/dist/cjs/index.js
CHANGED
@@ -230,6 +230,14 @@ var event_names_EventNames = /*#__PURE__*/ function(EventNames) {
|
|
230
230
|
* zh: 网络质量改变
|
231
231
|
*/ EventNames["NETWORK_QUALITY"] = "client.network.quality";
|
232
232
|
/**
|
233
|
+
* en: User publish screen
|
234
|
+
* zh: 用户发布屏幕
|
235
|
+
*/ EventNames["USER_PUBLISH_SCREEN"] = "client.user.publish.screen";
|
236
|
+
/**
|
237
|
+
* en: User unpublish screen
|
238
|
+
* zh: 用户取消发布屏幕
|
239
|
+
*/ EventNames["USER_UNPUBLISH_SCREEN"] = "client.user.unpublish.screen";
|
240
|
+
/**
|
233
241
|
* en: Bot joined
|
234
242
|
* zh: Bot 加入
|
235
243
|
*/ EventNames["BOT_JOIN"] = "server.bot.join";
|
@@ -264,7 +272,7 @@ var event_names_EventNames = /*#__PURE__*/ function(EventNames) {
|
|
264
272
|
/**
|
265
273
|
* en: Session updated
|
266
274
|
* zh: 会话更新
|
267
|
-
*/ EventNames["
|
275
|
+
*/ EventNames["SESSION_UPDATED"] = "server.session.updated";
|
268
276
|
return EventNames;
|
269
277
|
}(event_names_EventNames || {});
|
270
278
|
/* ESM default export */ const event_names = event_names_EventNames;
|
@@ -354,6 +362,8 @@ class EngineClient extends RealtimeEventHandler {
|
|
354
362
|
this.engine.on(rtc_default().events.onUserLeave, this.handleUserLeave);
|
355
363
|
this.engine.on(rtc_default().events.onError, this.handleEventError);
|
356
364
|
this.engine.on(rtc_default().events.onNetworkQuality, this.handleNetworkQuality);
|
365
|
+
this.engine.on(rtc_default().events.onUserPublishScreen, this.handleUserPublishScreen);
|
366
|
+
this.engine.on(rtc_default().events.onUserUnpublishScreen, this.handleUserUnpublishScreen);
|
357
367
|
if (this._isSupportVideo) this.engine.on(rtc_default().events.onPlayerEvent, this.handlePlayerEvent);
|
358
368
|
if (this._debug) {
|
359
369
|
this.engine.on(rtc_default().events.onLocalAudioPropertiesReport, this.handleLocalAudioPropertiesReport);
|
@@ -366,6 +376,8 @@ class EngineClient extends RealtimeEventHandler {
|
|
366
376
|
this.engine.off(rtc_default().events.onUserLeave, this.handleUserLeave);
|
367
377
|
this.engine.off(rtc_default().events.onError, this.handleEventError);
|
368
378
|
this.engine.off(rtc_default().events.onNetworkQuality, this.handleNetworkQuality);
|
379
|
+
this.engine.off(rtc_default().events.onUserPublishScreen, this.handleUserPublishScreen);
|
380
|
+
this.engine.off(rtc_default().events.onUserUnpublishScreen, this.handleUserUnpublishScreen);
|
369
381
|
if (this._isSupportVideo) this.engine.off(rtc_default().events.onPlayerEvent, this.handlePlayerEvent);
|
370
382
|
if (this._debug) {
|
371
383
|
this.engine.off(rtc_default().events.onLocalAudioPropertiesReport, this.handleLocalAudioPropertiesReport);
|
@@ -416,6 +428,12 @@ class EngineClient extends RealtimeEventHandler {
|
|
416
428
|
downlinkNetworkQuality
|
417
429
|
});
|
418
430
|
}
|
431
|
+
handleUserPublishScreen(event) {
|
432
|
+
this.dispatch(event_names.USER_PUBLISH_SCREEN, event);
|
433
|
+
}
|
434
|
+
handleUserUnpublishScreen(event) {
|
435
|
+
this.dispatch(event_names.USER_UNPUBLISH_SCREEN, event);
|
436
|
+
}
|
419
437
|
async joinRoom(options) {
|
420
438
|
const { token, roomId, uid, audioMutedDefault, videoOnDefault, isAutoSubscribeAudio } = options;
|
421
439
|
try {
|
@@ -607,6 +625,8 @@ class EngineClient extends RealtimeEventHandler {
|
|
607
625
|
this.handleEventError = this.handleEventError.bind(this);
|
608
626
|
this.handlePlayerEvent = this.handlePlayerEvent.bind(this);
|
609
627
|
this.handleNetworkQuality = this.handleNetworkQuality.bind(this);
|
628
|
+
this.handleUserPublishScreen = this.handleUserPublishScreen.bind(this);
|
629
|
+
this.handleUserUnpublishScreen = this.handleUserUnpublishScreen.bind(this);
|
610
630
|
// Debug only
|
611
631
|
this.handleLocalAudioPropertiesReport = this.handleLocalAudioPropertiesReport.bind(this);
|
612
632
|
this.handleRemoteAudioPropertiesReport = this.handleRemoteAudioPropertiesReport.bind(this);
|
@@ -632,6 +652,7 @@ class RealtimeClient extends RealtimeEventHandler {
|
|
632
652
|
else {
|
633
653
|
const config = {};
|
634
654
|
if (this._config.prologueContent) config.prologue_content = this._config.prologueContent;
|
655
|
+
if (void 0 !== this._config.roomMode && null !== this._config.roomMode) config.room_mode = this._config.roomMode;
|
635
656
|
if (this._config.videoConfig) {
|
636
657
|
if (isScreenShareDevice(this._config.videoConfig.videoInputDeviceId)) config.video_config = {
|
637
658
|
stream_video_type: 'screen'
|
@@ -863,6 +884,7 @@ class RealtimeClient extends RealtimeEventHandler {
|
|
863
884
|
* @param config.videoConfig.screenConfig - Optional, Screen share configuration if videoInputDeviceId is 'screenShare' see https://www.volcengine.com/docs/6348/104481#screenconfig for more details. |
|
864
885
|
* 可选,屏幕共享配置,如果 videoInputDeviceId 是 'screenShare',请参考 https://www.volcengine.com/docs/6348/104481#screenconfig 了解更多详情。
|
865
886
|
* @param config.prologueContent - Optional, Prologue content. | 可选,开场白内容。
|
887
|
+
* @param config.roomMode - Optional, Room mode. | 可选,房间模式。
|
866
888
|
*/ constructor(config){
|
867
889
|
super(config.debug), this._client = null, this.isConnected = false, this._isTestEnv = false, this._isSupportVideo = false;
|
868
890
|
this._config = config;
|
@@ -80,6 +80,14 @@ var event_names_EventNames = /*#__PURE__*/ function(EventNames) {
|
|
80
80
|
* zh: 网络质量改变
|
81
81
|
*/ EventNames["NETWORK_QUALITY"] = "client.network.quality";
|
82
82
|
/**
|
83
|
+
* en: User publish screen
|
84
|
+
* zh: 用户发布屏幕
|
85
|
+
*/ EventNames["USER_PUBLISH_SCREEN"] = "client.user.publish.screen";
|
86
|
+
/**
|
87
|
+
* en: User unpublish screen
|
88
|
+
* zh: 用户取消发布屏幕
|
89
|
+
*/ EventNames["USER_UNPUBLISH_SCREEN"] = "client.user.unpublish.screen";
|
90
|
+
/**
|
83
91
|
* en: Bot joined
|
84
92
|
* zh: Bot 加入
|
85
93
|
*/ EventNames["BOT_JOIN"] = "server.bot.join";
|
@@ -114,7 +122,7 @@ var event_names_EventNames = /*#__PURE__*/ function(EventNames) {
|
|
114
122
|
/**
|
115
123
|
* en: Session updated
|
116
124
|
* zh: 会话更新
|
117
|
-
*/ EventNames["
|
125
|
+
*/ EventNames["SESSION_UPDATED"] = "server.session.updated";
|
118
126
|
return EventNames;
|
119
127
|
}(event_names_EventNames || {});
|
120
128
|
/* ESM default export */ const event_names = event_names_EventNames;
|
package/dist/esm/index.js
CHANGED
@@ -203,6 +203,14 @@ var event_names_EventNames = /*#__PURE__*/ function(EventNames) {
|
|
203
203
|
* zh: 网络质量改变
|
204
204
|
*/ EventNames["NETWORK_QUALITY"] = "client.network.quality";
|
205
205
|
/**
|
206
|
+
* en: User publish screen
|
207
|
+
* zh: 用户发布屏幕
|
208
|
+
*/ EventNames["USER_PUBLISH_SCREEN"] = "client.user.publish.screen";
|
209
|
+
/**
|
210
|
+
* en: User unpublish screen
|
211
|
+
* zh: 用户取消发布屏幕
|
212
|
+
*/ EventNames["USER_UNPUBLISH_SCREEN"] = "client.user.unpublish.screen";
|
213
|
+
/**
|
206
214
|
* en: Bot joined
|
207
215
|
* zh: Bot 加入
|
208
216
|
*/ EventNames["BOT_JOIN"] = "server.bot.join";
|
@@ -237,7 +245,7 @@ var event_names_EventNames = /*#__PURE__*/ function(EventNames) {
|
|
237
245
|
/**
|
238
246
|
* en: Session updated
|
239
247
|
* zh: 会话更新
|
240
|
-
*/ EventNames["
|
248
|
+
*/ EventNames["SESSION_UPDATED"] = "server.session.updated";
|
241
249
|
return EventNames;
|
242
250
|
}(event_names_EventNames || {});
|
243
251
|
/* ESM default export */ const event_names = event_names_EventNames;
|
@@ -325,6 +333,8 @@ class EngineClient extends RealtimeEventHandler {
|
|
325
333
|
this.engine.on(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onUserLeave, this.handleUserLeave);
|
326
334
|
this.engine.on(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onError, this.handleEventError);
|
327
335
|
this.engine.on(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onNetworkQuality, this.handleNetworkQuality);
|
336
|
+
this.engine.on(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onUserPublishScreen, this.handleUserPublishScreen);
|
337
|
+
this.engine.on(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onUserUnpublishScreen, this.handleUserUnpublishScreen);
|
328
338
|
if (this._isSupportVideo) this.engine.on(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onPlayerEvent, this.handlePlayerEvent);
|
329
339
|
if (this._debug) {
|
330
340
|
this.engine.on(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onLocalAudioPropertiesReport, this.handleLocalAudioPropertiesReport);
|
@@ -337,6 +347,8 @@ class EngineClient extends RealtimeEventHandler {
|
|
337
347
|
this.engine.off(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onUserLeave, this.handleUserLeave);
|
338
348
|
this.engine.off(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onError, this.handleEventError);
|
339
349
|
this.engine.off(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onNetworkQuality, this.handleNetworkQuality);
|
350
|
+
this.engine.off(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onUserPublishScreen, this.handleUserPublishScreen);
|
351
|
+
this.engine.off(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onUserUnpublishScreen, this.handleUserUnpublishScreen);
|
340
352
|
if (this._isSupportVideo) this.engine.off(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onPlayerEvent, this.handlePlayerEvent);
|
341
353
|
if (this._debug) {
|
342
354
|
this.engine.off(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onLocalAudioPropertiesReport, this.handleLocalAudioPropertiesReport);
|
@@ -387,6 +399,12 @@ class EngineClient extends RealtimeEventHandler {
|
|
387
399
|
downlinkNetworkQuality
|
388
400
|
});
|
389
401
|
}
|
402
|
+
handleUserPublishScreen(event) {
|
403
|
+
this.dispatch(event_names.USER_PUBLISH_SCREEN, event);
|
404
|
+
}
|
405
|
+
handleUserUnpublishScreen(event) {
|
406
|
+
this.dispatch(event_names.USER_UNPUBLISH_SCREEN, event);
|
407
|
+
}
|
390
408
|
async joinRoom(options) {
|
391
409
|
const { token, roomId, uid, audioMutedDefault, videoOnDefault, isAutoSubscribeAudio } = options;
|
392
410
|
try {
|
@@ -578,6 +596,8 @@ class EngineClient extends RealtimeEventHandler {
|
|
578
596
|
this.handleEventError = this.handleEventError.bind(this);
|
579
597
|
this.handlePlayerEvent = this.handlePlayerEvent.bind(this);
|
580
598
|
this.handleNetworkQuality = this.handleNetworkQuality.bind(this);
|
599
|
+
this.handleUserPublishScreen = this.handleUserPublishScreen.bind(this);
|
600
|
+
this.handleUserUnpublishScreen = this.handleUserUnpublishScreen.bind(this);
|
581
601
|
// Debug only
|
582
602
|
this.handleLocalAudioPropertiesReport = this.handleLocalAudioPropertiesReport.bind(this);
|
583
603
|
this.handleRemoteAudioPropertiesReport = this.handleRemoteAudioPropertiesReport.bind(this);
|
@@ -603,6 +623,7 @@ class RealtimeClient extends RealtimeEventHandler {
|
|
603
623
|
else {
|
604
624
|
const config = {};
|
605
625
|
if (this._config.prologueContent) config.prologue_content = this._config.prologueContent;
|
626
|
+
if (void 0 !== this._config.roomMode && null !== this._config.roomMode) config.room_mode = this._config.roomMode;
|
606
627
|
if (this._config.videoConfig) {
|
607
628
|
if (isScreenShareDevice(this._config.videoConfig.videoInputDeviceId)) config.video_config = {
|
608
629
|
stream_video_type: 'screen'
|
@@ -834,6 +855,7 @@ class RealtimeClient extends RealtimeEventHandler {
|
|
834
855
|
* @param config.videoConfig.screenConfig - Optional, Screen share configuration if videoInputDeviceId is 'screenShare' see https://www.volcengine.com/docs/6348/104481#screenconfig for more details. |
|
835
856
|
* 可选,屏幕共享配置,如果 videoInputDeviceId 是 'screenShare',请参考 https://www.volcengine.com/docs/6348/104481#screenconfig 了解更多详情。
|
836
857
|
* @param config.prologueContent - Optional, Prologue content. | 可选,开场白内容。
|
858
|
+
* @param config.roomMode - Optional, Room mode. | 可选,房间模式。
|
837
859
|
*/ constructor(config){
|
838
860
|
super(config.debug), this._client = null, this.isConnected = false, this._isTestEnv = false, this._isSupportVideo = false;
|
839
861
|
this._config = config;
|
package/dist/types/client.d.ts
CHANGED
@@ -19,6 +19,8 @@ export declare class EngineClient extends RealtimeEventHandler {
|
|
19
19
|
handleUserLeave(event: onUserLeaveEvent): void;
|
20
20
|
handlePlayerEvent(event: unknown): void;
|
21
21
|
handleNetworkQuality(uplinkNetworkQuality: NetworkQuality, downlinkNetworkQuality: NetworkQuality): void;
|
22
|
+
handleUserPublishScreen(event: unknown): void;
|
23
|
+
handleUserUnpublishScreen(event: unknown): void;
|
22
24
|
joinRoom(options: {
|
23
25
|
token: string;
|
24
26
|
roomId: string;
|
@@ -19,6 +19,8 @@ export declare class EngineClient extends RealtimeEventHandler {
|
|
19
19
|
handleUserLeave(event: onUserLeaveEvent): void;
|
20
20
|
handlePlayerEvent(event: unknown): void;
|
21
21
|
handleNetworkQuality(uplinkNetworkQuality: NetworkQuality, downlinkNetworkQuality: NetworkQuality): void;
|
22
|
+
handleUserPublishScreen(event: unknown): void;
|
23
|
+
handleUserUnpublishScreen(event: unknown): void;
|
22
24
|
joinRoom(options: {
|
23
25
|
token: string;
|
24
26
|
roomId: string;
|
@@ -99,6 +99,16 @@ declare enum EventNames {
|
|
99
99
|
* zh: 网络质量改变
|
100
100
|
*/
|
101
101
|
NETWORK_QUALITY = "client.network.quality",
|
102
|
+
/**
|
103
|
+
* en: User publish screen
|
104
|
+
* zh: 用户发布屏幕
|
105
|
+
*/
|
106
|
+
USER_PUBLISH_SCREEN = "client.user.publish.screen",
|
107
|
+
/**
|
108
|
+
* en: User unpublish screen
|
109
|
+
* zh: 用户取消发布屏幕
|
110
|
+
*/
|
111
|
+
USER_UNPUBLISH_SCREEN = "client.user.unpublish.screen",
|
102
112
|
/**
|
103
113
|
* en: Bot joined
|
104
114
|
* zh: Bot 加入
|
@@ -143,6 +153,6 @@ declare enum EventNames {
|
|
143
153
|
* en: Session updated
|
144
154
|
* zh: 会话更新
|
145
155
|
*/
|
146
|
-
|
156
|
+
SESSION_UPDATED = "server.session.updated"
|
147
157
|
}
|
148
158
|
export default EventNames;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { type ScreenConfig, type AudioPropertiesConfig, type IRTCEngine } from '@volcengine/rtc';
|
2
|
-
import { type CreateRoomData, type GetToken } from '@coze/api';
|
2
|
+
import { type CreateRoomData, type GetToken, type RoomMode } from '@coze/api';
|
3
3
|
import * as RealtimeUtils from './utils';
|
4
4
|
import EventNames from './event-names';
|
5
5
|
import { RealtimeEventHandler } from './event-handler';
|
@@ -31,6 +31,7 @@ export interface RealtimeClientConfig {
|
|
31
31
|
videoConfig?: VideoConfig /** optional, Video configuration */;
|
32
32
|
isAutoSubscribeAudio?: boolean /** optional, Whether to automatically subscribe to bot reply audio streams, defaults to true */;
|
33
33
|
prologueContent?: string /** optional, Prologue content */;
|
34
|
+
roomMode?: RoomMode /** optional, Room mode */;
|
34
35
|
}
|
35
36
|
declare class RealtimeClient extends RealtimeEventHandler {
|
36
37
|
_config: RealtimeClientConfig;
|
@@ -82,6 +83,7 @@ declare class RealtimeClient extends RealtimeEventHandler {
|
|
82
83
|
* @param config.videoConfig.screenConfig - Optional, Screen share configuration if videoInputDeviceId is 'screenShare' see https://www.volcengine.com/docs/6348/104481#screenconfig for more details. |
|
83
84
|
* 可选,屏幕共享配置,如果 videoInputDeviceId 是 'screenShare',请参考 https://www.volcengine.com/docs/6348/104481#screenconfig 了解更多详情。
|
84
85
|
* @param config.prologueContent - Optional, Prologue content. | 可选,开场白内容。
|
86
|
+
* @param config.roomMode - Optional, Room mode. | 可选,房间模式。
|
85
87
|
*/
|
86
88
|
constructor(config: RealtimeClientConfig);
|
87
89
|
/**
|
@@ -99,6 +99,16 @@ declare enum EventNames {
|
|
99
99
|
* zh: 网络质量改变
|
100
100
|
*/
|
101
101
|
NETWORK_QUALITY = "client.network.quality",
|
102
|
+
/**
|
103
|
+
* en: User publish screen
|
104
|
+
* zh: 用户发布屏幕
|
105
|
+
*/
|
106
|
+
USER_PUBLISH_SCREEN = "client.user.publish.screen",
|
107
|
+
/**
|
108
|
+
* en: User unpublish screen
|
109
|
+
* zh: 用户取消发布屏幕
|
110
|
+
*/
|
111
|
+
USER_UNPUBLISH_SCREEN = "client.user.unpublish.screen",
|
102
112
|
/**
|
103
113
|
* en: Bot joined
|
104
114
|
* zh: Bot 加入
|
@@ -143,6 +153,6 @@ declare enum EventNames {
|
|
143
153
|
* en: Session updated
|
144
154
|
* zh: 会话更新
|
145
155
|
*/
|
146
|
-
|
156
|
+
SESSION_UPDATED = "server.session.updated"
|
147
157
|
}
|
148
158
|
export default EventNames;
|
package/dist/types/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { type ScreenConfig, type AudioPropertiesConfig, type IRTCEngine } from '@volcengine/rtc';
|
2
|
-
import { type CreateRoomData, type GetToken } from '@coze/api';
|
2
|
+
import { type CreateRoomData, type GetToken, type RoomMode } from '@coze/api';
|
3
3
|
import * as RealtimeUtils from './utils';
|
4
4
|
import EventNames from './event-names';
|
5
5
|
import { RealtimeEventHandler } from './event-handler';
|
@@ -31,6 +31,7 @@ export interface RealtimeClientConfig {
|
|
31
31
|
videoConfig?: VideoConfig /** optional, Video configuration */;
|
32
32
|
isAutoSubscribeAudio?: boolean /** optional, Whether to automatically subscribe to bot reply audio streams, defaults to true */;
|
33
33
|
prologueContent?: string /** optional, Prologue content */;
|
34
|
+
roomMode?: RoomMode /** optional, Room mode */;
|
34
35
|
}
|
35
36
|
declare class RealtimeClient extends RealtimeEventHandler {
|
36
37
|
_config: RealtimeClientConfig;
|
@@ -82,6 +83,7 @@ declare class RealtimeClient extends RealtimeEventHandler {
|
|
82
83
|
* @param config.videoConfig.screenConfig - Optional, Screen share configuration if videoInputDeviceId is 'screenShare' see https://www.volcengine.com/docs/6348/104481#screenconfig for more details. |
|
83
84
|
* 可选,屏幕共享配置,如果 videoInputDeviceId 是 'screenShare',请参考 https://www.volcengine.com/docs/6348/104481#screenconfig 了解更多详情。
|
84
85
|
* @param config.prologueContent - Optional, Prologue content. | 可选,开场白内容。
|
86
|
+
* @param config.roomMode - Optional, Room mode. | 可选,房间模式。
|
85
87
|
*/
|
86
88
|
constructor(config: RealtimeClientConfig);
|
87
89
|
/**
|
package/dist/umd/index.js
CHANGED
@@ -267,6 +267,14 @@
|
|
267
267
|
* zh: 网络质量改变
|
268
268
|
*/ EventNames["NETWORK_QUALITY"] = "client.network.quality";
|
269
269
|
/**
|
270
|
+
* en: User publish screen
|
271
|
+
* zh: 用户发布屏幕
|
272
|
+
*/ EventNames["USER_PUBLISH_SCREEN"] = "client.user.publish.screen";
|
273
|
+
/**
|
274
|
+
* en: User unpublish screen
|
275
|
+
* zh: 用户取消发布屏幕
|
276
|
+
*/ EventNames["USER_UNPUBLISH_SCREEN"] = "client.user.unpublish.screen";
|
277
|
+
/**
|
270
278
|
* en: Bot joined
|
271
279
|
* zh: Bot 加入
|
272
280
|
*/ EventNames["BOT_JOIN"] = "server.bot.join";
|
@@ -301,7 +309,7 @@
|
|
301
309
|
/**
|
302
310
|
* en: Session updated
|
303
311
|
* zh: 会话更新
|
304
|
-
*/ EventNames["
|
312
|
+
*/ EventNames["SESSION_UPDATED"] = "server.session.updated";
|
305
313
|
return EventNames;
|
306
314
|
}(event_names_EventNames || {});
|
307
315
|
/* ESM default export */ const event_names = event_names_EventNames;
|
@@ -392,6 +400,8 @@
|
|
392
400
|
this.engine.on(rtc_default().events.onUserLeave, this.handleUserLeave);
|
393
401
|
this.engine.on(rtc_default().events.onError, this.handleEventError);
|
394
402
|
this.engine.on(rtc_default().events.onNetworkQuality, this.handleNetworkQuality);
|
403
|
+
this.engine.on(rtc_default().events.onUserPublishScreen, this.handleUserPublishScreen);
|
404
|
+
this.engine.on(rtc_default().events.onUserUnpublishScreen, this.handleUserUnpublishScreen);
|
395
405
|
if (this._isSupportVideo) this.engine.on(rtc_default().events.onPlayerEvent, this.handlePlayerEvent);
|
396
406
|
if (this._debug) {
|
397
407
|
this.engine.on(rtc_default().events.onLocalAudioPropertiesReport, this.handleLocalAudioPropertiesReport);
|
@@ -404,6 +414,8 @@
|
|
404
414
|
this.engine.off(rtc_default().events.onUserLeave, this.handleUserLeave);
|
405
415
|
this.engine.off(rtc_default().events.onError, this.handleEventError);
|
406
416
|
this.engine.off(rtc_default().events.onNetworkQuality, this.handleNetworkQuality);
|
417
|
+
this.engine.off(rtc_default().events.onUserPublishScreen, this.handleUserPublishScreen);
|
418
|
+
this.engine.off(rtc_default().events.onUserUnpublishScreen, this.handleUserUnpublishScreen);
|
407
419
|
if (this._isSupportVideo) this.engine.off(rtc_default().events.onPlayerEvent, this.handlePlayerEvent);
|
408
420
|
if (this._debug) {
|
409
421
|
this.engine.off(rtc_default().events.onLocalAudioPropertiesReport, this.handleLocalAudioPropertiesReport);
|
@@ -454,6 +466,12 @@
|
|
454
466
|
downlinkNetworkQuality
|
455
467
|
});
|
456
468
|
}
|
469
|
+
handleUserPublishScreen(event) {
|
470
|
+
this.dispatch(event_names.USER_PUBLISH_SCREEN, event);
|
471
|
+
}
|
472
|
+
handleUserUnpublishScreen(event) {
|
473
|
+
this.dispatch(event_names.USER_UNPUBLISH_SCREEN, event);
|
474
|
+
}
|
457
475
|
async joinRoom(options) {
|
458
476
|
const { token, roomId, uid, audioMutedDefault, videoOnDefault, isAutoSubscribeAudio } = options;
|
459
477
|
try {
|
@@ -645,6 +663,8 @@
|
|
645
663
|
this.handleEventError = this.handleEventError.bind(this);
|
646
664
|
this.handlePlayerEvent = this.handlePlayerEvent.bind(this);
|
647
665
|
this.handleNetworkQuality = this.handleNetworkQuality.bind(this);
|
666
|
+
this.handleUserPublishScreen = this.handleUserPublishScreen.bind(this);
|
667
|
+
this.handleUserUnpublishScreen = this.handleUserUnpublishScreen.bind(this);
|
648
668
|
// Debug only
|
649
669
|
this.handleLocalAudioPropertiesReport = this.handleLocalAudioPropertiesReport.bind(this);
|
650
670
|
this.handleRemoteAudioPropertiesReport = this.handleRemoteAudioPropertiesReport.bind(this);
|
@@ -670,6 +690,7 @@
|
|
670
690
|
else {
|
671
691
|
const config = {};
|
672
692
|
if (this._config.prologueContent) config.prologue_content = this._config.prologueContent;
|
693
|
+
if (void 0 !== this._config.roomMode && null !== this._config.roomMode) config.room_mode = this._config.roomMode;
|
673
694
|
if (this._config.videoConfig) {
|
674
695
|
if (isScreenShareDevice(this._config.videoConfig.videoInputDeviceId)) config.video_config = {
|
675
696
|
stream_video_type: 'screen'
|
@@ -901,6 +922,7 @@
|
|
901
922
|
* @param config.videoConfig.screenConfig - Optional, Screen share configuration if videoInputDeviceId is 'screenShare' see https://www.volcengine.com/docs/6348/104481#screenconfig for more details. |
|
902
923
|
* 可选,屏幕共享配置,如果 videoInputDeviceId 是 'screenShare',请参考 https://www.volcengine.com/docs/6348/104481#screenconfig 了解更多详情。
|
903
924
|
* @param config.prologueContent - Optional, Prologue content. | 可选,开场白内容。
|
925
|
+
* @param config.roomMode - Optional, Room mode. | 可选,房间模式。
|
904
926
|
*/ constructor(config){
|
905
927
|
super(config.debug), this._client = null, this.isConnected = false, this._isTestEnv = false, this._isSupportVideo = false;
|
906
928
|
this._config = config;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@coze/realtime-api",
|
3
|
-
"version": "1.2.1-beta.
|
3
|
+
"version": "1.2.1-beta.5",
|
4
4
|
"description": "A powerful real-time communication SDK for voice interactions with Coze AI bots | 扣子官方实时通信 SDK,用于与 Coze AI bots 进行语音交互",
|
5
5
|
"keywords": [
|
6
6
|
"coze",
|
@@ -54,8 +54,8 @@
|
|
54
54
|
"test:cov": "vitest --coverage --run"
|
55
55
|
},
|
56
56
|
"dependencies": {
|
57
|
-
"@coze/api": "1.2.1-beta.
|
58
|
-
"@volcengine/rtc": "
|
57
|
+
"@coze/api": "1.2.1-beta.13",
|
58
|
+
"@volcengine/rtc": "~4.62.11"
|
59
59
|
},
|
60
60
|
"devDependencies": {
|
61
61
|
"@coze-infra/eslint-config": "workspace:*",
|
@@ -69,7 +69,7 @@
|
|
69
69
|
"@vitest/coverage-v8": "~2.1.4",
|
70
70
|
"axios": "^1.7.7",
|
71
71
|
"typescript": "^5.5.3",
|
72
|
-
"vitest": "~2.1.
|
72
|
+
"vitest": "~2.1.9"
|
73
73
|
},
|
74
74
|
"cozePublishConfig": {
|
75
75
|
"exports": {
|