@coze/realtime-api 1.2.1-beta.2 → 1.2.1-beta.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/dist/cjs/event-names/index.js +5 -1
- package/dist/cjs/index.js +13 -1
- package/dist/esm/event-names/index.js +5 -1
- package/dist/esm/index.js +13 -1
- package/dist/types/event-names/event-names.d.ts +6 -1
- package/dist/types/event-names/index.d.ts +3 -1
- package/dist/types/event-names.d.ts +6 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/umd/index.js +13 -1
- package/package.json +1 -1
@@ -49,6 +49,10 @@ var EventNames = /*#__PURE__*/ function(EventNames) {
|
|
49
49
|
* zh: 所有服务端事件
|
50
50
|
*/ EventNames["ALL_SERVER"] = "server.*";
|
51
51
|
/**
|
52
|
+
* en: Room info
|
53
|
+
* zh: 房间信息
|
54
|
+
*/ EventNames["ROOM_INFO"] = "client.room.info";
|
55
|
+
/**
|
52
56
|
* en: Client connected
|
53
57
|
* zh: 客户端连接
|
54
58
|
*/ EventNames["CONNECTED"] = "client.connected";
|
@@ -147,7 +151,7 @@ var EventNames = /*#__PURE__*/ function(EventNames) {
|
|
147
151
|
/**
|
148
152
|
* en: Session updated
|
149
153
|
* zh: 会话更新
|
150
|
-
*/ EventNames["
|
154
|
+
*/ EventNames["SESSION_UPDATED"] = "server.session.updated";
|
151
155
|
return EventNames;
|
152
156
|
}(EventNames || {});
|
153
157
|
/* ESM default export */ const __WEBPACK_DEFAULT_EXPORT__ = EventNames;
|
package/dist/cjs/index.js
CHANGED
@@ -162,6 +162,10 @@ var event_names_EventNames = /*#__PURE__*/ function(EventNames) {
|
|
162
162
|
* zh: 所有服务端事件
|
163
163
|
*/ EventNames["ALL_SERVER"] = "server.*";
|
164
164
|
/**
|
165
|
+
* en: Room info
|
166
|
+
* zh: 房间信息
|
167
|
+
*/ EventNames["ROOM_INFO"] = "client.room.info";
|
168
|
+
/**
|
165
169
|
* en: Client connected
|
166
170
|
* zh: 客户端连接
|
167
171
|
*/ EventNames["CONNECTED"] = "client.connected";
|
@@ -260,7 +264,7 @@ var event_names_EventNames = /*#__PURE__*/ function(EventNames) {
|
|
260
264
|
/**
|
261
265
|
* en: Session updated
|
262
266
|
* zh: 会话更新
|
263
|
-
*/ EventNames["
|
267
|
+
*/ EventNames["SESSION_UPDATED"] = "server.session.updated";
|
264
268
|
return EventNames;
|
265
269
|
}(event_names_EventNames || {});
|
266
270
|
/* ESM default export */ const event_names = event_names_EventNames;
|
@@ -628,6 +632,7 @@ class RealtimeClient extends RealtimeEventHandler {
|
|
628
632
|
else {
|
629
633
|
const config = {};
|
630
634
|
if (this._config.prologueContent) config.prologue_content = this._config.prologueContent;
|
635
|
+
if (void 0 !== this._config.roomMode && null !== this._config.roomMode) config.room_mode = this._config.roomMode;
|
631
636
|
if (this._config.videoConfig) {
|
632
637
|
if (isScreenShareDevice(this._config.videoConfig.videoInputDeviceId)) config.video_config = {
|
633
638
|
stream_video_type: 'screen'
|
@@ -650,6 +655,12 @@ class RealtimeClient extends RealtimeEventHandler {
|
|
650
655
|
this.dispatch(event_names.ERROR, error);
|
651
656
|
throw new RealtimeAPIError(error_RealtimeError.CREATE_ROOM_ERROR, error instanceof Error ? error.message : 'Unknown error', error);
|
652
657
|
}
|
658
|
+
this.dispatch(event_names.ROOM_INFO, {
|
659
|
+
roomId: roomInfo.room_id,
|
660
|
+
uid: roomInfo.uid,
|
661
|
+
token: roomInfo.token,
|
662
|
+
appId: roomInfo.app_id
|
663
|
+
});
|
653
664
|
this._isTestEnv = TEST_APP_ID === roomInfo.app_id;
|
654
665
|
// Step2 create engine
|
655
666
|
this._client = new EngineClient(roomInfo.app_id, this._config.debug, this._isTestEnv, this._isSupportVideo, this._config.videoConfig);
|
@@ -853,6 +864,7 @@ class RealtimeClient extends RealtimeEventHandler {
|
|
853
864
|
* @param config.videoConfig.screenConfig - Optional, Screen share configuration if videoInputDeviceId is 'screenShare' see https://www.volcengine.com/docs/6348/104481#screenconfig for more details. |
|
854
865
|
* 可选,屏幕共享配置,如果 videoInputDeviceId 是 'screenShare',请参考 https://www.volcengine.com/docs/6348/104481#screenconfig 了解更多详情。
|
855
866
|
* @param config.prologueContent - Optional, Prologue content. | 可选,开场白内容。
|
867
|
+
* @param config.roomMode - Optional, Room mode. | 可选,房间模式。
|
856
868
|
*/ constructor(config){
|
857
869
|
super(config.debug), this._client = null, this.isConnected = false, this._isTestEnv = false, this._isSupportVideo = false;
|
858
870
|
this._config = config;
|
@@ -12,6 +12,10 @@ var event_names_EventNames = /*#__PURE__*/ function(EventNames) {
|
|
12
12
|
* zh: 所有服务端事件
|
13
13
|
*/ EventNames["ALL_SERVER"] = "server.*";
|
14
14
|
/**
|
15
|
+
* en: Room info
|
16
|
+
* zh: 房间信息
|
17
|
+
*/ EventNames["ROOM_INFO"] = "client.room.info";
|
18
|
+
/**
|
15
19
|
* en: Client connected
|
16
20
|
* zh: 客户端连接
|
17
21
|
*/ EventNames["CONNECTED"] = "client.connected";
|
@@ -110,7 +114,7 @@ var event_names_EventNames = /*#__PURE__*/ function(EventNames) {
|
|
110
114
|
/**
|
111
115
|
* en: Session updated
|
112
116
|
* zh: 会话更新
|
113
|
-
*/ EventNames["
|
117
|
+
*/ EventNames["SESSION_UPDATED"] = "server.session.updated";
|
114
118
|
return EventNames;
|
115
119
|
}(event_names_EventNames || {});
|
116
120
|
/* ESM default export */ const event_names = event_names_EventNames;
|
package/dist/esm/index.js
CHANGED
@@ -135,6 +135,10 @@ var event_names_EventNames = /*#__PURE__*/ function(EventNames) {
|
|
135
135
|
* zh: 所有服务端事件
|
136
136
|
*/ EventNames["ALL_SERVER"] = "server.*";
|
137
137
|
/**
|
138
|
+
* en: Room info
|
139
|
+
* zh: 房间信息
|
140
|
+
*/ EventNames["ROOM_INFO"] = "client.room.info";
|
141
|
+
/**
|
138
142
|
* en: Client connected
|
139
143
|
* zh: 客户端连接
|
140
144
|
*/ EventNames["CONNECTED"] = "client.connected";
|
@@ -233,7 +237,7 @@ var event_names_EventNames = /*#__PURE__*/ function(EventNames) {
|
|
233
237
|
/**
|
234
238
|
* en: Session updated
|
235
239
|
* zh: 会话更新
|
236
|
-
*/ EventNames["
|
240
|
+
*/ EventNames["SESSION_UPDATED"] = "server.session.updated";
|
237
241
|
return EventNames;
|
238
242
|
}(event_names_EventNames || {});
|
239
243
|
/* ESM default export */ const event_names = event_names_EventNames;
|
@@ -599,6 +603,7 @@ class RealtimeClient extends RealtimeEventHandler {
|
|
599
603
|
else {
|
600
604
|
const config = {};
|
601
605
|
if (this._config.prologueContent) config.prologue_content = this._config.prologueContent;
|
606
|
+
if (void 0 !== this._config.roomMode && null !== this._config.roomMode) config.room_mode = this._config.roomMode;
|
602
607
|
if (this._config.videoConfig) {
|
603
608
|
if (isScreenShareDevice(this._config.videoConfig.videoInputDeviceId)) config.video_config = {
|
604
609
|
stream_video_type: 'screen'
|
@@ -621,6 +626,12 @@ class RealtimeClient extends RealtimeEventHandler {
|
|
621
626
|
this.dispatch(event_names.ERROR, error);
|
622
627
|
throw new RealtimeAPIError(error_RealtimeError.CREATE_ROOM_ERROR, error instanceof Error ? error.message : 'Unknown error', error);
|
623
628
|
}
|
629
|
+
this.dispatch(event_names.ROOM_INFO, {
|
630
|
+
roomId: roomInfo.room_id,
|
631
|
+
uid: roomInfo.uid,
|
632
|
+
token: roomInfo.token,
|
633
|
+
appId: roomInfo.app_id
|
634
|
+
});
|
624
635
|
this._isTestEnv = TEST_APP_ID === roomInfo.app_id;
|
625
636
|
// Step2 create engine
|
626
637
|
this._client = new EngineClient(roomInfo.app_id, this._config.debug, this._isTestEnv, this._isSupportVideo, this._config.videoConfig);
|
@@ -824,6 +835,7 @@ class RealtimeClient extends RealtimeEventHandler {
|
|
824
835
|
* @param config.videoConfig.screenConfig - Optional, Screen share configuration if videoInputDeviceId is 'screenShare' see https://www.volcengine.com/docs/6348/104481#screenconfig for more details. |
|
825
836
|
* 可选,屏幕共享配置,如果 videoInputDeviceId 是 'screenShare',请参考 https://www.volcengine.com/docs/6348/104481#screenconfig 了解更多详情。
|
826
837
|
* @param config.prologueContent - Optional, Prologue content. | 可选,开场白内容。
|
838
|
+
* @param config.roomMode - Optional, Room mode. | 可选,房间模式。
|
827
839
|
*/ constructor(config){
|
828
840
|
super(config.debug), this._client = null, this.isConnected = false, this._isTestEnv = false, this._isSupportVideo = false;
|
829
841
|
this._config = config;
|
@@ -14,6 +14,11 @@ declare enum EventNames {
|
|
14
14
|
* zh: 所有服务端事件
|
15
15
|
*/
|
16
16
|
ALL_SERVER = "server.*",
|
17
|
+
/**
|
18
|
+
* en: Room info
|
19
|
+
* zh: 房间信息
|
20
|
+
*/
|
21
|
+
ROOM_INFO = "client.room.info",
|
17
22
|
/**
|
18
23
|
* en: Client connected
|
19
24
|
* zh: 客户端连接
|
@@ -138,6 +143,6 @@ declare enum EventNames {
|
|
138
143
|
* en: Session updated
|
139
144
|
* zh: 会话更新
|
140
145
|
*/
|
141
|
-
|
146
|
+
SESSION_UPDATED = "server.session.updated"
|
142
147
|
}
|
143
148
|
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
|
/**
|
@@ -14,6 +14,11 @@ declare enum EventNames {
|
|
14
14
|
* zh: 所有服务端事件
|
15
15
|
*/
|
16
16
|
ALL_SERVER = "server.*",
|
17
|
+
/**
|
18
|
+
* en: Room info
|
19
|
+
* zh: 房间信息
|
20
|
+
*/
|
21
|
+
ROOM_INFO = "client.room.info",
|
17
22
|
/**
|
18
23
|
* en: Client connected
|
19
24
|
* zh: 客户端连接
|
@@ -138,6 +143,6 @@ declare enum EventNames {
|
|
138
143
|
* en: Session updated
|
139
144
|
* zh: 会话更新
|
140
145
|
*/
|
141
|
-
|
146
|
+
SESSION_UPDATED = "server.session.updated"
|
142
147
|
}
|
143
148
|
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
@@ -199,6 +199,10 @@
|
|
199
199
|
* zh: 所有服务端事件
|
200
200
|
*/ EventNames["ALL_SERVER"] = "server.*";
|
201
201
|
/**
|
202
|
+
* en: Room info
|
203
|
+
* zh: 房间信息
|
204
|
+
*/ EventNames["ROOM_INFO"] = "client.room.info";
|
205
|
+
/**
|
202
206
|
* en: Client connected
|
203
207
|
* zh: 客户端连接
|
204
208
|
*/ EventNames["CONNECTED"] = "client.connected";
|
@@ -297,7 +301,7 @@
|
|
297
301
|
/**
|
298
302
|
* en: Session updated
|
299
303
|
* zh: 会话更新
|
300
|
-
*/ EventNames["
|
304
|
+
*/ EventNames["SESSION_UPDATED"] = "server.session.updated";
|
301
305
|
return EventNames;
|
302
306
|
}(event_names_EventNames || {});
|
303
307
|
/* ESM default export */ const event_names = event_names_EventNames;
|
@@ -666,6 +670,7 @@
|
|
666
670
|
else {
|
667
671
|
const config = {};
|
668
672
|
if (this._config.prologueContent) config.prologue_content = this._config.prologueContent;
|
673
|
+
if (void 0 !== this._config.roomMode && null !== this._config.roomMode) config.room_mode = this._config.roomMode;
|
669
674
|
if (this._config.videoConfig) {
|
670
675
|
if (isScreenShareDevice(this._config.videoConfig.videoInputDeviceId)) config.video_config = {
|
671
676
|
stream_video_type: 'screen'
|
@@ -688,6 +693,12 @@
|
|
688
693
|
this.dispatch(event_names.ERROR, error);
|
689
694
|
throw new RealtimeAPIError(error_RealtimeError.CREATE_ROOM_ERROR, error instanceof Error ? error.message : 'Unknown error', error);
|
690
695
|
}
|
696
|
+
this.dispatch(event_names.ROOM_INFO, {
|
697
|
+
roomId: roomInfo.room_id,
|
698
|
+
uid: roomInfo.uid,
|
699
|
+
token: roomInfo.token,
|
700
|
+
appId: roomInfo.app_id
|
701
|
+
});
|
691
702
|
this._isTestEnv = TEST_APP_ID === roomInfo.app_id;
|
692
703
|
// Step2 create engine
|
693
704
|
this._client = new EngineClient(roomInfo.app_id, this._config.debug, this._isTestEnv, this._isSupportVideo, this._config.videoConfig);
|
@@ -891,6 +902,7 @@
|
|
891
902
|
* @param config.videoConfig.screenConfig - Optional, Screen share configuration if videoInputDeviceId is 'screenShare' see https://www.volcengine.com/docs/6348/104481#screenconfig for more details. |
|
892
903
|
* 可选,屏幕共享配置,如果 videoInputDeviceId 是 'screenShare',请参考 https://www.volcengine.com/docs/6348/104481#screenconfig 了解更多详情。
|
893
904
|
* @param config.prologueContent - Optional, Prologue content. | 可选,开场白内容。
|
905
|
+
* @param config.roomMode - Optional, Room mode. | 可选,房间模式。
|
894
906
|
*/ constructor(config){
|
895
907
|
super(config.debug), this._client = null, this.isConnected = false, this._isTestEnv = false, this._isSupportVideo = false;
|
896
908
|
this._config = config;
|
package/package.json
CHANGED