omnirtc-web 1.6.0 → 1.7.1

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/aigc.d.ts CHANGED
@@ -5,8 +5,8 @@ import { TurnServerConfig, RemoteStreamType, RemoteStreamFallbackType, Encryptio
5
5
  declare class Request {
6
6
  private axios;
7
7
  constructor(baseURL: string, appId: string);
8
- get(url: string, config?: AxiosRequestConfig): Record<string, any>;
9
- post(url: string, data: any, config?: AxiosRequestConfig): Record<string, any>;
8
+ get(url: string, config?: AxiosRequestConfig): Promise<Record<string, any>>;
9
+ post(url: string, data: any, config?: AxiosRequestConfig): Promise<Record<string, any>>;
10
10
  }
11
11
 
12
12
  declare interface OmniRTCStats {
@@ -228,6 +228,7 @@ declare interface IOmniRTCClient extends EventEmitter {
228
228
  // setStreamFallbackOption(uid: UID, fallbackType: RemoteStreamFallbackType): Promise<void>;
229
229
 
230
230
  // setEncryptionConfig(encryptionMode: EncryptionMode, secret: string, salt?: Uint8Array): void;
231
+ sendRoomBinaryMessage(message: Uint8Array): Promise<number>;
231
232
 
232
233
  renewToken(token: string): Promise<void>;
233
234
 
@@ -683,6 +684,7 @@ declare class Client implements IOmniRTCClient {
683
684
  subscribe(user: IOmniRTCRemoteUser, mediaType: "audio"): Promise<IRemoteAudioTrack>;
684
685
  subscribe(user: IOmniRTCRemoteUser, mediaType: "screen"): Promise<IRemoteVideoTrack>;
685
686
  unsubscribe(user: IOmniRTCRemoteUser, mediaType?: 'audio' | 'video' | 'screen'): Promise<void>;
687
+ sendRoomBinaryMessage(message: Uint8Array): Promise<number>;
686
688
  setLowStreamParameter(streamParameter: LowStreamParameter): void;
687
689
  enableDualStream(): Promise<void>;
688
690
  disableDualStream(): Promise<void>;
@@ -798,6 +800,7 @@ interface EventMap {
798
800
  [Events.MESSAGE]: [data: object | string | Uint8Array];
799
801
  }
800
802
  declare class Aigc extends EventEmitter$2<EventMap> {
803
+ static BASE_URL_TEST: string;
801
804
  static BASE_URL: string;
802
805
  static DICTIONARY: string;
803
806
  static UUID: string;
@@ -812,7 +815,7 @@ declare class Aigc extends EventEmitter$2<EventMap> {
812
815
  * 查询当前应用的AIGC配置
813
816
  * @returns
814
817
  */
815
- query(): Record<string, any>;
818
+ query(): Promise<Record<string, any>>;
816
819
  /**
817
820
  *
818
821
  * @param taskType 使用的aigc类型
@@ -821,15 +824,16 @@ declare class Aigc extends EventEmitter$2<EventMap> {
821
824
  * @param options 附带信息
822
825
  * @returns
823
826
  */
824
- start(taskType: 'asr', config: AsrConfig, robotId: string, options?: Record<string, any>): any;
825
- start(taskType: 'voicechat' | 'visionchat', config: ChatConfig, robotId: string, options?: Record<string, any>): any;
826
- start(taskType: 'avatarchat', config: AvatarConfig, robotId: string, options?: Record<string, any>): any;
827
+ start(taskType: 'asr', config: AsrConfig, robotId: string, options?: Record<string, any>): Promise<Record<string, any>>;
828
+ start(taskType: 'voicechat' | 'visionchat', config: ChatConfig, robotId: string, options?: Record<string, any>): Promise<Record<string, any>>;
829
+ start(taskType: 'avatarchat', config: AvatarConfig, robotId: string, options?: Record<string, any>): Promise<Record<string, any>>;
830
+ start(taskType: TaskType, config: AsrConfig | ChatConfig | AvatarConfig, robotId: string, options?: Record<string, any>): Promise<Record<string, any>>;
827
831
  /**
828
832
  * 停止当前aigc任务
829
833
  * @param options 附带信息
830
834
  * @returns
831
835
  */
832
- stop(options?: Record<string, any>): Record<string, any>;
836
+ stop(options?: Record<string, any>): Promise<Record<string, any>>;
833
837
  /**
834
838
  *
835
839
  * @param type 更新类型
@@ -837,12 +841,13 @@ declare class Aigc extends EventEmitter$2<EventMap> {
837
841
  * @param options
838
842
  * @returns
839
843
  */
840
- update(type: TaskTypeEnum.UPDATE_PROMPT, config: SendPrompt, options?: Record<string, any>): any;
841
- update(type: TaskTypeEnum.BREAK_AI_RESPONSE, config: null, options?: Record<string, any>): any;
842
- update(type: TaskTypeEnum.BROADCAST_CONTENT, config: BroadcastContent, options?: Record<string, any>): any;
843
- update(type: TaskTypeEnum.SEND_CONTENT_TO_LLM, config: SendPrompt, options?: Record<string, any>): any;
844
- update(type: TaskTypeEnum.SUBMIT_VOICE_TO_LLM, config: null, options?: Record<string, any>): any;
845
- update(type: TaskTypeEnum.SEND_SIGNALING_TO_CLIENT, config: CustomSignaling, options?: Record<string, any>): any;
844
+ update(type: TaskTypeEnum.UPDATE_PROMPT, config: SendPrompt, options?: Record<string, any>): Promise<Record<string, any>>;
845
+ update(type: TaskTypeEnum.BREAK_AI_RESPONSE, config: null, options?: Record<string, any>): Promise<Record<string, any>>;
846
+ update(type: TaskTypeEnum.BROADCAST_CONTENT, config: BroadcastContent, options?: Record<string, any>): Promise<Record<string, any>>;
847
+ update(type: TaskTypeEnum.SEND_CONTENT_TO_LLM, config: SendPrompt, options?: Record<string, any>): Promise<Record<string, any>>;
848
+ update(type: TaskTypeEnum.SUBMIT_VOICE_TO_LLM, config: null, options?: Record<string, any>): Promise<Record<string, any>>;
849
+ update(type: TaskTypeEnum.SEND_SIGNALING_TO_CLIENT, config: CustomSignaling, options?: Record<string, any>): Promise<Record<string, any>>;
850
+ update(type: TaskTypeEnum, config: SendPrompt | BroadcastContent | CustomSignaling | null, options?: Record<string, any>): Promise<Record<string, any>>;
846
851
  /**
847
852
  * 绑定事件触发器
848
853
  */
package/dist/aigc.js CHANGED
@@ -6983,7 +6983,7 @@
6983
6983
  this.taskId = this.generateTaskId();
6984
6984
  this.taskType = taskType;
6985
6985
  var ts = Date.now().toString();
6986
- var data = __assign((_a = { appId: this.config.engineConfig.adaptAppId, room: this.config.roomStr, user: String(this.config.user), robotId: robotId, taskId: this.taskId, taskType: taskType }, _a[taskType] = config, _a.ts = ts, _a), options);
6986
+ var data = __assign((_a = { appId: this.config.engineConfig.adaptAppId, room: this.config.roomStr, user: String(this.config.user), robotId: robotId, taskId: this.taskId, taskType: taskType }, _a[taskType === 'visionchat' ? 'vision' : taskType] = config, _a.ts = ts, _a), options);
6987
6987
  return this.request.post('/api/aigc/start', data, {
6988
6988
  headers: {
6989
6989
  'X-Auth-TimeStamp': ts,
@@ -7043,6 +7043,7 @@
7043
7043
  }
7044
7044
  return taskId;
7045
7045
  };
7046
+ Aigc.BASE_URL_TEST = 'https://api2.xueersi.com/rtcapi2stage';
7046
7047
  Aigc.BASE_URL = 'https://api2.xueersi.com/rtcapi2';
7047
7048
  Aigc.DICTIONARY = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
7048
7049
  Aigc.UUID = 'd327b12049ac3bfb09925af9ea3b21f9';
package/dist/es-aigc.js CHANGED
@@ -6979,7 +6979,7 @@ var Aigc = /** @class */ (function (_super) {
6979
6979
  this.taskId = this.generateTaskId();
6980
6980
  this.taskType = taskType;
6981
6981
  var ts = Date.now().toString();
6982
- var data = __assign((_a = { appId: this.config.engineConfig.adaptAppId, room: this.config.roomStr, user: String(this.config.user), robotId: robotId, taskId: this.taskId, taskType: taskType }, _a[taskType] = config, _a.ts = ts, _a), options);
6982
+ var data = __assign((_a = { appId: this.config.engineConfig.adaptAppId, room: this.config.roomStr, user: String(this.config.user), robotId: robotId, taskId: this.taskId, taskType: taskType }, _a[taskType === 'visionchat' ? 'vision' : taskType] = config, _a.ts = ts, _a), options);
6983
6983
  return this.request.post('/api/aigc/start', data, {
6984
6984
  headers: {
6985
6985
  'X-Auth-TimeStamp': ts,
@@ -7039,6 +7039,7 @@ var Aigc = /** @class */ (function (_super) {
7039
7039
  }
7040
7040
  return taskId;
7041
7041
  };
7042
+ Aigc.BASE_URL_TEST = 'https://api2.xueersi.com/rtcapi2stage';
7042
7043
  Aigc.BASE_URL = 'https://api2.xueersi.com/rtcapi2';
7043
7044
  Aigc.DICTIONARY = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
7044
7045
  Aigc.UUID = 'd327b12049ac3bfb09925af9ea3b21f9';
@@ -5432,7 +5432,7 @@ _stream.addTrack(track.track);context=getAudioContext();source=context.createMed
5432
5432
  */function getAudioBuffer(source,cacheOnlineFile){return __awaiter$1(this,void 0,void 0,/*#__PURE__*/regenerator.mark(function _callee228(){var arrayBuffer,cacheAudioBuffer,getFileArrayBuffer,audioBuffer;return regenerator.wrap(function _callee228$(_context243){while(1)switch(_context243.prev=_context243.next){case 0:if(!('string'==typeof source)){_context243.next=15;break;}cacheAudioBuffer=cacheMap.get(source);if(!cacheAudioBuffer){_context243.next=4;break;}return _context243.abrupt("return",cacheAudioBuffer);case 4:_context243.prev=4;_context243.next=7;return getStringArrayBuffer(source);case 7:arrayBuffer=_context243.sent;_context243.next=13;break;case 10:_context243.prev=10;_context243.t0=_context243["catch"](4);throw new CoreRTCError(CoreRTCErrorCode.CHECK_VIDEO_TRACK_ERROR,typeof _context243.t0==='string'?_context243.t0:'fetch audio file failed');case 13:_context243.next=19;break;case 15:getFileArrayBuffer=new Promise(function(resolve,reject){var fileReader=new FileReader();fileReader.addEventListener('load',function(res){if(res.target){resolve(res.target.result);}else {reject(new CoreRTCError(CoreRTCErrorCode.READ_LOCAL_AUDIO_FILE_ERROR,'read local audio file error'));}});fileReader.addEventListener('error',function(){reject(new CoreRTCError(CoreRTCErrorCode.READ_LOCAL_AUDIO_FILE_ERROR,'read local audio file error'));});fileReader.readAsArrayBuffer(source);});_context243.next=18;return getFileArrayBuffer;case 18:arrayBuffer=_context243.sent;case 19:_context243.next=21;return decodeAudioData(arrayBuffer);case 21:audioBuffer=_context243.sent;if('string'==typeof source&&cacheOnlineFile)cacheMap.set(source,audioBuffer);return _context243.abrupt("return",audioBuffer);case 24:case"end":return _context243.stop();}},_callee228,null,[[4,10]]);}));}
5433
5433
 
5434
5434
  var StaticConfig = {
5435
- agentVersion: "OmniRTC_Web_V1.6.0",
5435
+ agentVersion: "OmniRTC_Web_V1.7.1",
5436
5436
  logVersion: 1,
5437
5437
  serviceType: 320,
5438
5438
  logBackendUrl: "https://rtc-logs.magic-school.com/stream.gif"
@@ -7801,6 +7801,9 @@ var Client = /** @class */ (function () {
7801
7801
  return;
7802
7802
  });
7803
7803
  };
7804
+ Client.prototype.sendRoomBinaryMessage = function (message) {
7805
+ return this._client.sendRoomBinaryMessage(message);
7806
+ };
7804
7807
  Client.prototype.setLowStreamParameter = function (streamParameter) {
7805
7808
  return this._client.setLowStreamParameter(streamParameter);
7806
7809
  };
@@ -8360,7 +8363,7 @@ function log(clsName) {
8360
8363
  sdk_api_name: '中间层-函数调用',
8361
8364
  message: "\u4E2D\u95F4\u5C42-".concat(clsName, ".").concat(name),
8362
8365
  from_encapsulation_layer: true,
8363
- encapsulation_layer_built_timestamp: '2025/12/19 14:36:54',
8366
+ encapsulation_layer_built_timestamp: '2026/3/23 10:36:58',
8364
8367
  });
8365
8368
  }
8366
8369
  }
@@ -11958,7 +11961,7 @@ var VolcLocalVideoTrack = /** @class */ (function (_super) {
11958
11961
  }
11959
11962
  return VideoRenderMode.RENDER_MODE_HIDDEN;
11960
11963
  };
11961
- if (config.mirror) {
11964
+ if (config && config.mirror) {
11962
11965
  this._mirrowing = !!config.mirror;
11963
11966
  }
11964
11967
  if (this.track) {
@@ -14425,6 +14428,9 @@ var VolcClient = /** @class */ (function (_super) {
14425
14428
  return this._engine.setUserVisibility(false);
14426
14429
  }
14427
14430
  };
14431
+ VolcClient.prototype.sendRoomBinaryMessage = function (message) {
14432
+ return this._engine.sendRoomBinaryMessage(message.buffer);
14433
+ };
14428
14434
  // Px
14429
14435
  // setProxyServer(proxyServer: string): void => {};
14430
14436
  // Px
@@ -5440,7 +5440,7 @@
5440
5440
  */function getAudioBuffer(source,cacheOnlineFile){return __awaiter$1(this,void 0,void 0,/*#__PURE__*/regenerator.mark(function _callee228(){var arrayBuffer,cacheAudioBuffer,getFileArrayBuffer,audioBuffer;return regenerator.wrap(function _callee228$(_context243){while(1)switch(_context243.prev=_context243.next){case 0:if(!('string'==typeof source)){_context243.next=15;break;}cacheAudioBuffer=cacheMap.get(source);if(!cacheAudioBuffer){_context243.next=4;break;}return _context243.abrupt("return",cacheAudioBuffer);case 4:_context243.prev=4;_context243.next=7;return getStringArrayBuffer(source);case 7:arrayBuffer=_context243.sent;_context243.next=13;break;case 10:_context243.prev=10;_context243.t0=_context243["catch"](4);throw new CoreRTCError(CoreRTCErrorCode.CHECK_VIDEO_TRACK_ERROR,typeof _context243.t0==='string'?_context243.t0:'fetch audio file failed');case 13:_context243.next=19;break;case 15:getFileArrayBuffer=new Promise(function(resolve,reject){var fileReader=new FileReader();fileReader.addEventListener('load',function(res){if(res.target){resolve(res.target.result);}else {reject(new CoreRTCError(CoreRTCErrorCode.READ_LOCAL_AUDIO_FILE_ERROR,'read local audio file error'));}});fileReader.addEventListener('error',function(){reject(new CoreRTCError(CoreRTCErrorCode.READ_LOCAL_AUDIO_FILE_ERROR,'read local audio file error'));});fileReader.readAsArrayBuffer(source);});_context243.next=18;return getFileArrayBuffer;case 18:arrayBuffer=_context243.sent;case 19:_context243.next=21;return decodeAudioData(arrayBuffer);case 21:audioBuffer=_context243.sent;if('string'==typeof source&&cacheOnlineFile)cacheMap.set(source,audioBuffer);return _context243.abrupt("return",audioBuffer);case 24:case"end":return _context243.stop();}},_callee228,null,[[4,10]]);}));}
5441
5441
 
5442
5442
  var StaticConfig = {
5443
- agentVersion: "OmniRTC_Web_V1.6.0",
5443
+ agentVersion: "OmniRTC_Web_V1.7.1",
5444
5444
  logVersion: 1,
5445
5445
  serviceType: 320,
5446
5446
  logBackendUrl: "https://rtc-logs.magic-school.com/stream.gif"
@@ -7809,6 +7809,9 @@
7809
7809
  return;
7810
7810
  });
7811
7811
  };
7812
+ Client.prototype.sendRoomBinaryMessage = function (message) {
7813
+ return this._client.sendRoomBinaryMessage(message);
7814
+ };
7812
7815
  Client.prototype.setLowStreamParameter = function (streamParameter) {
7813
7816
  return this._client.setLowStreamParameter(streamParameter);
7814
7817
  };
@@ -8368,7 +8371,7 @@
8368
8371
  sdk_api_name: '中间层-函数调用',
8369
8372
  message: "\u4E2D\u95F4\u5C42-".concat(clsName, ".").concat(name),
8370
8373
  from_encapsulation_layer: true,
8371
- encapsulation_layer_built_timestamp: '2025/12/19 14:36:54',
8374
+ encapsulation_layer_built_timestamp: '2026/3/23 10:36:58',
8372
8375
  });
8373
8376
  }
8374
8377
  }
@@ -11966,7 +11969,7 @@
11966
11969
  }
11967
11970
  return VERTC.VideoRenderMode.RENDER_MODE_HIDDEN;
11968
11971
  };
11969
- if (config.mirror) {
11972
+ if (config && config.mirror) {
11970
11973
  this._mirrowing = !!config.mirror;
11971
11974
  }
11972
11975
  if (this.track) {
@@ -14433,6 +14436,9 @@
14433
14436
  return this._engine.setUserVisibility(false);
14434
14437
  }
14435
14438
  };
14439
+ VolcClient.prototype.sendRoomBinaryMessage = function (message) {
14440
+ return this._engine.sendRoomBinaryMessage(message.buffer);
14441
+ };
14436
14442
  // Px
14437
14443
  // setProxyServer(proxyServer: string): void => {};
14438
14444
  // Px
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "omnirtc-web",
3
- "version": "1.6.0",
3
+ "version": "1.7.1",
4
4
  "description": "",
5
5
  "main": "./dist/es-omnirtc-web.js",
6
6
  "module": "./dist/es-omnirtc-web.js",
7
7
  "exports": {
8
8
  ".": {
9
- "types": "./src/omni.d.ts",
9
+ "types": "./dist/omni.d.ts",
10
10
  "import": "./dist/es-omnirtc-web.js",
11
11
  "require": "./dist/omnirtc-web.js"
12
12
  },
13
13
  "./aigc": {
14
- "types": "./src/aigc.d.ts",
14
+ "types": "./dist/aigc.d.ts",
15
15
  "import": "./dist/es-aigc.js",
16
16
  "require": "./dist/aigc.js"
17
17
  }
18
18
  },
19
- "types": "./src/omni.d.ts",
19
+ "types": "./dist/omni.d.ts",
20
20
  "scripts": {
21
21
  "start": "rollup -c rollup.config.js --watch",
22
22
  "build-test": "rollup -c rollup.test.js",
@@ -75,8 +75,7 @@
75
75
  },
76
76
  "files": [
77
77
  "dist/*.js",
78
- "dist/*.d.ts",
79
- "src/*.d.ts"
78
+ "dist/*.d.ts"
80
79
  ],
81
80
  "repository": {
82
81
  "type": "git",