@coze/realtime-api 1.2.1-beta.4 → 1.2.1-beta.6

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.
@@ -117,6 +117,10 @@ var EventNames = /*#__PURE__*/ function(EventNames) {
117
117
  * zh: 网络质量改变
118
118
  */ EventNames["NETWORK_QUALITY"] = "client.network.quality";
119
119
  /**
120
+ * en: Track ended
121
+ * zh: 轨道结束
122
+ */ EventNames["TRACK_ENDED"] = "client.track.ended";
123
+ /**
120
124
  * en: Bot joined
121
125
  * zh: Bot 加入
122
126
  */ EventNames["BOT_JOIN"] = "server.bot.join";
package/dist/cjs/index.js CHANGED
@@ -230,6 +230,10 @@ var event_names_EventNames = /*#__PURE__*/ function(EventNames) {
230
230
  * zh: 网络质量改变
231
231
  */ EventNames["NETWORK_QUALITY"] = "client.network.quality";
232
232
  /**
233
+ * en: Track ended
234
+ * zh: 轨道结束
235
+ */ EventNames["TRACK_ENDED"] = "client.track.ended";
236
+ /**
233
237
  * en: Bot joined
234
238
  * zh: Bot 加入
235
239
  */ EventNames["BOT_JOIN"] = "server.bot.join";
@@ -354,6 +358,7 @@ class EngineClient extends RealtimeEventHandler {
354
358
  this.engine.on(rtc_default().events.onUserLeave, this.handleUserLeave);
355
359
  this.engine.on(rtc_default().events.onError, this.handleEventError);
356
360
  this.engine.on(rtc_default().events.onNetworkQuality, this.handleNetworkQuality);
361
+ this.engine.on(rtc_default().events.onTrackEnded, this.handleTrackEnded);
357
362
  if (this._isSupportVideo) this.engine.on(rtc_default().events.onPlayerEvent, this.handlePlayerEvent);
358
363
  if (this._debug) {
359
364
  this.engine.on(rtc_default().events.onLocalAudioPropertiesReport, this.handleLocalAudioPropertiesReport);
@@ -366,6 +371,7 @@ class EngineClient extends RealtimeEventHandler {
366
371
  this.engine.off(rtc_default().events.onUserLeave, this.handleUserLeave);
367
372
  this.engine.off(rtc_default().events.onError, this.handleEventError);
368
373
  this.engine.off(rtc_default().events.onNetworkQuality, this.handleNetworkQuality);
374
+ this.engine.off(rtc_default().events.onTrackEnded, this.handleTrackEnded);
369
375
  if (this._isSupportVideo) this.engine.off(rtc_default().events.onPlayerEvent, this.handlePlayerEvent);
370
376
  if (this._debug) {
371
377
  this.engine.off(rtc_default().events.onLocalAudioPropertiesReport, this.handleLocalAudioPropertiesReport);
@@ -416,6 +422,9 @@ class EngineClient extends RealtimeEventHandler {
416
422
  downlinkNetworkQuality
417
423
  });
418
424
  }
425
+ handleTrackEnded(event) {
426
+ this.dispatch(event_names.TRACK_ENDED, event);
427
+ }
419
428
  async joinRoom(options) {
420
429
  const { token, roomId, uid, audioMutedDefault, videoOnDefault, isAutoSubscribeAudio } = options;
421
430
  try {
@@ -607,6 +616,7 @@ class EngineClient extends RealtimeEventHandler {
607
616
  this.handleEventError = this.handleEventError.bind(this);
608
617
  this.handlePlayerEvent = this.handlePlayerEvent.bind(this);
609
618
  this.handleNetworkQuality = this.handleNetworkQuality.bind(this);
619
+ this.handleTrackEnded = this.handleTrackEnded.bind(this);
610
620
  // Debug only
611
621
  this.handleLocalAudioPropertiesReport = this.handleLocalAudioPropertiesReport.bind(this);
612
622
  this.handleRemoteAudioPropertiesReport = this.handleRemoteAudioPropertiesReport.bind(this);
@@ -80,6 +80,10 @@ var event_names_EventNames = /*#__PURE__*/ function(EventNames) {
80
80
  * zh: 网络质量改变
81
81
  */ EventNames["NETWORK_QUALITY"] = "client.network.quality";
82
82
  /**
83
+ * en: Track ended
84
+ * zh: 轨道结束
85
+ */ EventNames["TRACK_ENDED"] = "client.track.ended";
86
+ /**
83
87
  * en: Bot joined
84
88
  * zh: Bot 加入
85
89
  */ EventNames["BOT_JOIN"] = "server.bot.join";
package/dist/esm/index.js CHANGED
@@ -203,6 +203,10 @@ var event_names_EventNames = /*#__PURE__*/ function(EventNames) {
203
203
  * zh: 网络质量改变
204
204
  */ EventNames["NETWORK_QUALITY"] = "client.network.quality";
205
205
  /**
206
+ * en: Track ended
207
+ * zh: 轨道结束
208
+ */ EventNames["TRACK_ENDED"] = "client.track.ended";
209
+ /**
206
210
  * en: Bot joined
207
211
  * zh: Bot 加入
208
212
  */ EventNames["BOT_JOIN"] = "server.bot.join";
@@ -325,6 +329,7 @@ class EngineClient extends RealtimeEventHandler {
325
329
  this.engine.on(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onUserLeave, this.handleUserLeave);
326
330
  this.engine.on(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onError, this.handleEventError);
327
331
  this.engine.on(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onNetworkQuality, this.handleNetworkQuality);
332
+ this.engine.on(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onTrackEnded, this.handleTrackEnded);
328
333
  if (this._isSupportVideo) this.engine.on(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onPlayerEvent, this.handlePlayerEvent);
329
334
  if (this._debug) {
330
335
  this.engine.on(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onLocalAudioPropertiesReport, this.handleLocalAudioPropertiesReport);
@@ -337,6 +342,7 @@ class EngineClient extends RealtimeEventHandler {
337
342
  this.engine.off(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onUserLeave, this.handleUserLeave);
338
343
  this.engine.off(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onError, this.handleEventError);
339
344
  this.engine.off(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onNetworkQuality, this.handleNetworkQuality);
345
+ this.engine.off(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onTrackEnded, this.handleTrackEnded);
340
346
  if (this._isSupportVideo) this.engine.off(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onPlayerEvent, this.handlePlayerEvent);
341
347
  if (this._debug) {
342
348
  this.engine.off(__WEBPACK_EXTERNAL_MODULE__volcengine_rtc__["default"].events.onLocalAudioPropertiesReport, this.handleLocalAudioPropertiesReport);
@@ -387,6 +393,9 @@ class EngineClient extends RealtimeEventHandler {
387
393
  downlinkNetworkQuality
388
394
  });
389
395
  }
396
+ handleTrackEnded(event) {
397
+ this.dispatch(event_names.TRACK_ENDED, event);
398
+ }
390
399
  async joinRoom(options) {
391
400
  const { token, roomId, uid, audioMutedDefault, videoOnDefault, isAutoSubscribeAudio } = options;
392
401
  try {
@@ -578,6 +587,7 @@ class EngineClient extends RealtimeEventHandler {
578
587
  this.handleEventError = this.handleEventError.bind(this);
579
588
  this.handlePlayerEvent = this.handlePlayerEvent.bind(this);
580
589
  this.handleNetworkQuality = this.handleNetworkQuality.bind(this);
590
+ this.handleTrackEnded = this.handleTrackEnded.bind(this);
581
591
  // Debug only
582
592
  this.handleLocalAudioPropertiesReport = this.handleLocalAudioPropertiesReport.bind(this);
583
593
  this.handleRemoteAudioPropertiesReport = this.handleRemoteAudioPropertiesReport.bind(this);
@@ -19,6 +19,7 @@ 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
+ handleTrackEnded(event: unknown): void;
22
23
  joinRoom(options: {
23
24
  token: string;
24
25
  roomId: string;
@@ -19,6 +19,7 @@ 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
+ handleTrackEnded(event: unknown): void;
22
23
  joinRoom(options: {
23
24
  token: string;
24
25
  roomId: string;
@@ -99,6 +99,11 @@ declare enum EventNames {
99
99
  * zh: 网络质量改变
100
100
  */
101
101
  NETWORK_QUALITY = "client.network.quality",
102
+ /**
103
+ * en: Track ended
104
+ * zh: 轨道结束
105
+ */
106
+ TRACK_ENDED = "client.track.ended",
102
107
  /**
103
108
  * en: Bot joined
104
109
  * zh: Bot 加入
@@ -99,6 +99,11 @@ declare enum EventNames {
99
99
  * zh: 网络质量改变
100
100
  */
101
101
  NETWORK_QUALITY = "client.network.quality",
102
+ /**
103
+ * en: Track ended
104
+ * zh: 轨道结束
105
+ */
106
+ TRACK_ENDED = "client.track.ended",
102
107
  /**
103
108
  * en: Bot joined
104
109
  * zh: Bot 加入
package/dist/umd/index.js CHANGED
@@ -267,6 +267,10 @@
267
267
  * zh: 网络质量改变
268
268
  */ EventNames["NETWORK_QUALITY"] = "client.network.quality";
269
269
  /**
270
+ * en: Track ended
271
+ * zh: 轨道结束
272
+ */ EventNames["TRACK_ENDED"] = "client.track.ended";
273
+ /**
270
274
  * en: Bot joined
271
275
  * zh: Bot 加入
272
276
  */ EventNames["BOT_JOIN"] = "server.bot.join";
@@ -392,6 +396,7 @@
392
396
  this.engine.on(rtc_default().events.onUserLeave, this.handleUserLeave);
393
397
  this.engine.on(rtc_default().events.onError, this.handleEventError);
394
398
  this.engine.on(rtc_default().events.onNetworkQuality, this.handleNetworkQuality);
399
+ this.engine.on(rtc_default().events.onTrackEnded, this.handleTrackEnded);
395
400
  if (this._isSupportVideo) this.engine.on(rtc_default().events.onPlayerEvent, this.handlePlayerEvent);
396
401
  if (this._debug) {
397
402
  this.engine.on(rtc_default().events.onLocalAudioPropertiesReport, this.handleLocalAudioPropertiesReport);
@@ -404,6 +409,7 @@
404
409
  this.engine.off(rtc_default().events.onUserLeave, this.handleUserLeave);
405
410
  this.engine.off(rtc_default().events.onError, this.handleEventError);
406
411
  this.engine.off(rtc_default().events.onNetworkQuality, this.handleNetworkQuality);
412
+ this.engine.off(rtc_default().events.onTrackEnded, this.handleTrackEnded);
407
413
  if (this._isSupportVideo) this.engine.off(rtc_default().events.onPlayerEvent, this.handlePlayerEvent);
408
414
  if (this._debug) {
409
415
  this.engine.off(rtc_default().events.onLocalAudioPropertiesReport, this.handleLocalAudioPropertiesReport);
@@ -454,6 +460,9 @@
454
460
  downlinkNetworkQuality
455
461
  });
456
462
  }
463
+ handleTrackEnded(event) {
464
+ this.dispatch(event_names.TRACK_ENDED, event);
465
+ }
457
466
  async joinRoom(options) {
458
467
  const { token, roomId, uid, audioMutedDefault, videoOnDefault, isAutoSubscribeAudio } = options;
459
468
  try {
@@ -645,6 +654,7 @@
645
654
  this.handleEventError = this.handleEventError.bind(this);
646
655
  this.handlePlayerEvent = this.handlePlayerEvent.bind(this);
647
656
  this.handleNetworkQuality = this.handleNetworkQuality.bind(this);
657
+ this.handleTrackEnded = this.handleTrackEnded.bind(this);
648
658
  // Debug only
649
659
  this.handleLocalAudioPropertiesReport = this.handleLocalAudioPropertiesReport.bind(this);
650
660
  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.4",
3
+ "version": "1.2.1-beta.6",
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.9",
58
- "@volcengine/rtc": "^4.62.1"
57
+ "@coze/api": "1.2.1-beta.17",
58
+ "@volcengine/rtc": "~4.62.11"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@coze-infra/eslint-config": "workspace:*",
@@ -66,10 +66,10 @@
66
66
  "@types/node": "^20",
67
67
  "@types/uuid": "^9.0.1",
68
68
  "@types/whatwg-fetch": "^0.0.33",
69
- "@vitest/coverage-v8": "~2.1.4",
69
+ "@vitest/coverage-v8": "~2.1.9",
70
70
  "axios": "^1.7.7",
71
71
  "typescript": "^5.5.3",
72
- "vitest": "~2.1.4"
72
+ "vitest": "~2.1.9"
73
73
  },
74
74
  "cozePublishConfig": {
75
75
  "exports": {