@coze/realtime-api 1.2.1-beta.4 → 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 +8 -0
- package/dist/cjs/index.js +20 -0
- package/dist/esm/event-names/index.js +8 -0
- package/dist/esm/index.js +20 -0
- 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 +10 -0
- package/dist/types/event-names.d.ts +10 -0
- package/dist/umd/index.js +20 -0
- 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";
|
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";
|
@@ -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);
|
@@ -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";
|
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";
|
@@ -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);
|
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 加入
|
@@ -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 加入
|
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";
|
@@ -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);
|
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": {
|