omnirtc-web 1.1.3 → 1.1.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.
@@ -7833,7 +7833,7 @@ _stream.addTrack(track.track);context=getAudioContext();source=context.createMed
7833
7833
  */function getAudioBuffer(source,cacheOnlineFile){return __awaiter$1(this,void 0,void 0,/*#__PURE__*/regenerator.mark(function _callee87(){var arrayBuffer,cacheAudioBuffer,getFileArrayBuffer,audioBuffer;return regenerator.wrap(function _callee87$(_context87){while(1)switch(_context87.prev=_context87.next){case 0:if(!('string'==typeof source)){_context87.next=15;break;}cacheAudioBuffer=cacheMap.get(source);if(!cacheAudioBuffer){_context87.next=4;break;}return _context87.abrupt("return",cacheAudioBuffer);case 4:_context87.prev=4;_context87.next=7;return getStringArrayBuffer(source);case 7:arrayBuffer=_context87.sent;_context87.next=13;break;case 10:_context87.prev=10;_context87.t0=_context87["catch"](4);throw new CoreRTCError(CoreRTCErrorCode.CHECK_VIDEO_TRACK_ERROR,typeof _context87.t0==='string'?_context87.t0:'fetch audio file failed');case 13:_context87.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);});_context87.next=18;return getFileArrayBuffer;case 18:arrayBuffer=_context87.sent;case 19:_context87.next=21;return decodeAudioData(arrayBuffer);case 21:audioBuffer=_context87.sent;if('string'==typeof source&&cacheOnlineFile)cacheMap.set(source,audioBuffer);return _context87.abrupt("return",audioBuffer);case 24:case"end":return _context87.stop();}},_callee87,null,[[4,10]]);}));}
7834
7834
 
7835
7835
  var StaticConfig = {
7836
- agentVersion: "OmniRTC_Web_V1.1.3",
7836
+ agentVersion: "OmniRTC_Web_V1.1.4",
7837
7837
  logVersion: 1,
7838
7838
  serviceType: 320,
7839
7839
  logBackendUrl: "https://rtc-logs.magic-school.com/stream.gif"
@@ -9539,6 +9539,11 @@ var StatisticLog = /** @class */ (function (_super) {
9539
9539
  SERVER: "disconnect by server",
9540
9540
  CLIENT: "disconnect by client",
9541
9541
  };
9542
+ StatisticLog.EngineMap = {
9543
+ 1: "Agora",
9544
+ 7: "CoreRTC",
9545
+ 8: "Volc"
9546
+ };
9542
9547
  return StatisticLog;
9543
9548
  }(events.EventEmitter));
9544
9549
  var LogFrame = /** @class */ (function (_super) {
@@ -13089,16 +13094,16 @@ var VolcCoreRTC = /** @class */ (function () {
13089
13094
  var localVideoTrack, localAudioTrack, screenVideoTrack, screenAudioTrack;
13090
13095
  return __generator(this, function (_a) {
13091
13096
  switch (_a.label) {
13092
- case 0: return [4 /*yield*/, this._engine.stopScreenCapture()];
13097
+ case 0:
13098
+ // await this._engine.stopScreenCapture();
13099
+ return [4 /*yield*/, this._handleScreenVideoTrackInitConfig(config)];
13093
13100
  case 1:
13094
- _a.sent();
13095
- return [4 /*yield*/, this._handleScreenVideoTrackInitConfig(config)];
13096
- case 2:
13101
+ // await this._engine.stopScreenCapture();
13097
13102
  _a.sent();
13098
13103
  return [4 /*yield*/, this._engine.startScreenCapture({
13099
13104
  enableAudio: withAudio !== 'disable',
13100
13105
  })];
13101
- case 3:
13106
+ case 2:
13102
13107
  _a.sent();
13103
13108
  localVideoTrack = this._engine.getLocalStreamTrack(StreamIndex.STREAM_INDEX_SCREEN, 'video');
13104
13109
  localAudioTrack = this._engine.getLocalStreamTrack(StreamIndex.STREAM_INDEX_SCREEN, 'audio');
@@ -13407,7 +13412,7 @@ var VolcCoreRTC$1 = new VolcCoreRTC();
13407
13412
 
13408
13413
  var Client = /** @class */ (function () {
13409
13414
  function Client(client, _a) {
13410
- var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, token = _a.token, type = _a.type;
13415
+ var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, token = _a.token, type = _a.type, plan = _a.plan;
13411
13416
  this.reconnectTimestamp = 0; // 开始重连的时间戳
13412
13417
  this.reconnectTimes = 0; // 重连次数
13413
13418
  // for log
@@ -13418,6 +13423,7 @@ var Client = /** @class */ (function () {
13418
13423
  this._token = token;
13419
13424
  this._client = client;
13420
13425
  this._type = type;
13426
+ this._plan = plan;
13421
13427
  this._statisticLog = new StatisticLog();
13422
13428
  switch (type) {
13423
13429
  case RTCEngineType.Core:
@@ -13496,11 +13502,12 @@ var Client = /** @class */ (function () {
13496
13502
  });
13497
13503
  this._statisticLog.updateCommonInfo({
13498
13504
  ver: this._engineVersion,
13499
- engine: this._type + " " + this._engineVersion,
13505
+ engine: StatisticLog.EngineMap[this._type] + "_Web_" + this._engineVersion,
13500
13506
  room: this._roomId,
13501
13507
  roomStr: '' + this._roomId,
13502
13508
  uid: '' + this._userId,
13503
13509
  sessionId: sessionId,
13510
+ plan: this._plan,
13504
13511
  });
13505
13512
  this._statisticLog.run();
13506
13513
  this._statisticLog.emit('connection-state', OmniConnectionState.Connecting, 'connecting');
@@ -13790,13 +13797,14 @@ var bindListeners = function (client) {
13790
13797
 
13791
13798
  var AgoraRTC = /** @class */ (function () {
13792
13799
  function AgoraRTC(_a) {
13793
- var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, sdkToken = _a.sdkToken;
13800
+ var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, sdkToken = _a.sdkToken, plan = _a.plan;
13794
13801
  this.VERSION = Agora.VERSION;
13795
13802
  // constructor() {
13796
13803
  this._appId = appId;
13797
13804
  this._roomId = roomId;
13798
13805
  this._userId = userId;
13799
13806
  this._token = sdkToken;
13807
+ this._plan = plan;
13800
13808
  Agora.setLogLevel(3);
13801
13809
  }
13802
13810
  AgoraRTC.prototype.createClient = function (config) {
@@ -13807,6 +13815,7 @@ var AgoraRTC = /** @class */ (function () {
13807
13815
  roomId: this._roomId,
13808
13816
  userId: this._userId,
13809
13817
  token: this._token,
13818
+ plan: this._plan,
13810
13819
  type: RTCEngineType.Agora
13811
13820
  });
13812
13821
  };
@@ -13928,13 +13937,13 @@ var AgoraRTC = /** @class */ (function () {
13928
13937
 
13929
13938
  var CoreRTC$1 = /** @class */ (function () {
13930
13939
  function CoreRTC(_a) {
13931
- var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, sdkToken = _a.sdkToken;
13940
+ var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, sdkToken = _a.sdkToken, plan = _a.plan;
13932
13941
  this.VERSION = coreRTC.VERSION;
13933
- // constructor() {
13934
13942
  this._appId = appId;
13935
13943
  this._roomId = roomId;
13936
13944
  this._userId = userId;
13937
13945
  this._token = sdkToken;
13946
+ this._plan = plan;
13938
13947
  }
13939
13948
  CoreRTC.prototype.createClient = function (config) {
13940
13949
  var client = coreRTC.createClient(config);
@@ -13944,6 +13953,7 @@ var CoreRTC$1 = /** @class */ (function () {
13944
13953
  roomId: this._roomId,
13945
13954
  userId: this._userId,
13946
13955
  token: this._token,
13956
+ plan: this._plan,
13947
13957
  type: RTCEngineType.Core,
13948
13958
  });
13949
13959
  };
@@ -14088,11 +14098,12 @@ window.volcCoreRTC = VolcCoreRTC$1;
14088
14098
  var VolcCoreRTCWrapper = /** @class */ (function () {
14089
14099
  // @ts-ignore
14090
14100
  function VolcCoreRTCWrapper(_a) {
14091
- var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, sdkToken = _a.sdkToken, extraInfo = _a.extraInfo;
14101
+ var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, sdkToken = _a.sdkToken, plan = _a.plan, extraInfo = _a.extraInfo;
14092
14102
  this._appId = appId;
14093
14103
  this._roomId = roomId;
14094
14104
  this._userId = userId;
14095
14105
  this._token = sdkToken;
14106
+ this._plan = plan;
14096
14107
  index.setParameter('STATS_SCALLBACK_SUPPORT', false);
14097
14108
  this._engine = index.createEngine(this._appId);
14098
14109
  VolcCoreRTC$1.setEngine(this._engine);
@@ -14119,6 +14130,7 @@ var VolcCoreRTCWrapper = /** @class */ (function () {
14119
14130
  roomId: this._roomId,
14120
14131
  userId: this._userId,
14121
14132
  token: this._token,
14133
+ plan: this._plan,
14122
14134
  type: RTCEngineType.VolcEngine,
14123
14135
  });
14124
14136
  };
@@ -14332,6 +14344,7 @@ function getRTCInstance(token, extraInfo) {
14332
14344
  roomId: data.roomStr,
14333
14345
  userId: data.user,
14334
14346
  sdkToken: data.attachToken || data.token,
14347
+ plan: data.planid,
14335
14348
  });
14336
14349
  case RTCEngineType.Core:
14337
14350
  return new CoreRTC$1({
@@ -14339,6 +14352,7 @@ function getRTCInstance(token, extraInfo) {
14339
14352
  roomId: data.roomStr,
14340
14353
  userId: data.user,
14341
14354
  sdkToken: data.attachToken || data.token,
14355
+ plan: data.planid,
14342
14356
  });
14343
14357
  case RTCEngineType.VolcEngine:
14344
14358
  return new VolcCoreRTCWrapper({
@@ -14346,6 +14360,7 @@ function getRTCInstance(token, extraInfo) {
14346
14360
  roomId: data.roomStr,
14347
14361
  userId: data.user.toString(),
14348
14362
  sdkToken: data.attachToken || data.token,
14363
+ plan: data.planid,
14349
14364
  extraInfo: extraInfo,
14350
14365
  });
14351
14366
  default:
@@ -7839,7 +7839,7 @@
7839
7839
  */function getAudioBuffer(source,cacheOnlineFile){return __awaiter$1(this,void 0,void 0,/*#__PURE__*/regenerator.mark(function _callee87(){var arrayBuffer,cacheAudioBuffer,getFileArrayBuffer,audioBuffer;return regenerator.wrap(function _callee87$(_context87){while(1)switch(_context87.prev=_context87.next){case 0:if(!('string'==typeof source)){_context87.next=15;break;}cacheAudioBuffer=cacheMap.get(source);if(!cacheAudioBuffer){_context87.next=4;break;}return _context87.abrupt("return",cacheAudioBuffer);case 4:_context87.prev=4;_context87.next=7;return getStringArrayBuffer(source);case 7:arrayBuffer=_context87.sent;_context87.next=13;break;case 10:_context87.prev=10;_context87.t0=_context87["catch"](4);throw new CoreRTCError(CoreRTCErrorCode.CHECK_VIDEO_TRACK_ERROR,typeof _context87.t0==='string'?_context87.t0:'fetch audio file failed');case 13:_context87.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);});_context87.next=18;return getFileArrayBuffer;case 18:arrayBuffer=_context87.sent;case 19:_context87.next=21;return decodeAudioData(arrayBuffer);case 21:audioBuffer=_context87.sent;if('string'==typeof source&&cacheOnlineFile)cacheMap.set(source,audioBuffer);return _context87.abrupt("return",audioBuffer);case 24:case"end":return _context87.stop();}},_callee87,null,[[4,10]]);}));}
7840
7840
 
7841
7841
  var StaticConfig = {
7842
- agentVersion: "OmniRTC_Web_V1.1.3",
7842
+ agentVersion: "OmniRTC_Web_V1.1.4",
7843
7843
  logVersion: 1,
7844
7844
  serviceType: 320,
7845
7845
  logBackendUrl: "https://rtc-logs.magic-school.com/stream.gif"
@@ -9545,6 +9545,11 @@
9545
9545
  SERVER: "disconnect by server",
9546
9546
  CLIENT: "disconnect by client",
9547
9547
  };
9548
+ StatisticLog.EngineMap = {
9549
+ 1: "Agora",
9550
+ 7: "CoreRTC",
9551
+ 8: "Volc"
9552
+ };
9548
9553
  return StatisticLog;
9549
9554
  }(events.EventEmitter));
9550
9555
  var LogFrame = /** @class */ (function (_super) {
@@ -13095,16 +13100,16 @@
13095
13100
  var localVideoTrack, localAudioTrack, screenVideoTrack, screenAudioTrack;
13096
13101
  return __generator(this, function (_a) {
13097
13102
  switch (_a.label) {
13098
- case 0: return [4 /*yield*/, this._engine.stopScreenCapture()];
13103
+ case 0:
13104
+ // await this._engine.stopScreenCapture();
13105
+ return [4 /*yield*/, this._handleScreenVideoTrackInitConfig(config)];
13099
13106
  case 1:
13100
- _a.sent();
13101
- return [4 /*yield*/, this._handleScreenVideoTrackInitConfig(config)];
13102
- case 2:
13107
+ // await this._engine.stopScreenCapture();
13103
13108
  _a.sent();
13104
13109
  return [4 /*yield*/, this._engine.startScreenCapture({
13105
13110
  enableAudio: withAudio !== 'disable',
13106
13111
  })];
13107
- case 3:
13112
+ case 2:
13108
13113
  _a.sent();
13109
13114
  localVideoTrack = this._engine.getLocalStreamTrack(StreamIndex.STREAM_INDEX_SCREEN, 'video');
13110
13115
  localAudioTrack = this._engine.getLocalStreamTrack(StreamIndex.STREAM_INDEX_SCREEN, 'audio');
@@ -13413,7 +13418,7 @@
13413
13418
 
13414
13419
  var Client = /** @class */ (function () {
13415
13420
  function Client(client, _a) {
13416
- var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, token = _a.token, type = _a.type;
13421
+ var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, token = _a.token, type = _a.type, plan = _a.plan;
13417
13422
  this.reconnectTimestamp = 0; // 开始重连的时间戳
13418
13423
  this.reconnectTimes = 0; // 重连次数
13419
13424
  // for log
@@ -13424,6 +13429,7 @@
13424
13429
  this._token = token;
13425
13430
  this._client = client;
13426
13431
  this._type = type;
13432
+ this._plan = plan;
13427
13433
  this._statisticLog = new StatisticLog();
13428
13434
  switch (type) {
13429
13435
  case RTCEngineType.Core:
@@ -13502,11 +13508,12 @@
13502
13508
  });
13503
13509
  this._statisticLog.updateCommonInfo({
13504
13510
  ver: this._engineVersion,
13505
- engine: this._type + " " + this._engineVersion,
13511
+ engine: StatisticLog.EngineMap[this._type] + "_Web_" + this._engineVersion,
13506
13512
  room: this._roomId,
13507
13513
  roomStr: '' + this._roomId,
13508
13514
  uid: '' + this._userId,
13509
13515
  sessionId: sessionId,
13516
+ plan: this._plan,
13510
13517
  });
13511
13518
  this._statisticLog.run();
13512
13519
  this._statisticLog.emit('connection-state', OmniConnectionState.Connecting, 'connecting');
@@ -13796,13 +13803,14 @@
13796
13803
 
13797
13804
  var AgoraRTC = /** @class */ (function () {
13798
13805
  function AgoraRTC(_a) {
13799
- var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, sdkToken = _a.sdkToken;
13806
+ var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, sdkToken = _a.sdkToken, plan = _a.plan;
13800
13807
  this.VERSION = Agora.VERSION;
13801
13808
  // constructor() {
13802
13809
  this._appId = appId;
13803
13810
  this._roomId = roomId;
13804
13811
  this._userId = userId;
13805
13812
  this._token = sdkToken;
13813
+ this._plan = plan;
13806
13814
  Agora.setLogLevel(3);
13807
13815
  }
13808
13816
  AgoraRTC.prototype.createClient = function (config) {
@@ -13813,6 +13821,7 @@
13813
13821
  roomId: this._roomId,
13814
13822
  userId: this._userId,
13815
13823
  token: this._token,
13824
+ plan: this._plan,
13816
13825
  type: RTCEngineType.Agora
13817
13826
  });
13818
13827
  };
@@ -13934,13 +13943,13 @@
13934
13943
 
13935
13944
  var CoreRTC$1 = /** @class */ (function () {
13936
13945
  function CoreRTC(_a) {
13937
- var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, sdkToken = _a.sdkToken;
13946
+ var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, sdkToken = _a.sdkToken, plan = _a.plan;
13938
13947
  this.VERSION = coreRTC.VERSION;
13939
- // constructor() {
13940
13948
  this._appId = appId;
13941
13949
  this._roomId = roomId;
13942
13950
  this._userId = userId;
13943
13951
  this._token = sdkToken;
13952
+ this._plan = plan;
13944
13953
  }
13945
13954
  CoreRTC.prototype.createClient = function (config) {
13946
13955
  var client = coreRTC.createClient(config);
@@ -13950,6 +13959,7 @@
13950
13959
  roomId: this._roomId,
13951
13960
  userId: this._userId,
13952
13961
  token: this._token,
13962
+ plan: this._plan,
13953
13963
  type: RTCEngineType.Core,
13954
13964
  });
13955
13965
  };
@@ -14094,11 +14104,12 @@
14094
14104
  var VolcCoreRTCWrapper = /** @class */ (function () {
14095
14105
  // @ts-ignore
14096
14106
  function VolcCoreRTCWrapper(_a) {
14097
- var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, sdkToken = _a.sdkToken, extraInfo = _a.extraInfo;
14107
+ var appId = _a.appId, roomId = _a.roomId, userId = _a.userId, sdkToken = _a.sdkToken, plan = _a.plan, extraInfo = _a.extraInfo;
14098
14108
  this._appId = appId;
14099
14109
  this._roomId = roomId;
14100
14110
  this._userId = userId;
14101
14111
  this._token = sdkToken;
14112
+ this._plan = plan;
14102
14113
  index.setParameter('STATS_SCALLBACK_SUPPORT', false);
14103
14114
  this._engine = index.createEngine(this._appId);
14104
14115
  VolcCoreRTC$1.setEngine(this._engine);
@@ -14125,6 +14136,7 @@
14125
14136
  roomId: this._roomId,
14126
14137
  userId: this._userId,
14127
14138
  token: this._token,
14139
+ plan: this._plan,
14128
14140
  type: RTCEngineType.VolcEngine,
14129
14141
  });
14130
14142
  };
@@ -14338,6 +14350,7 @@
14338
14350
  roomId: data.roomStr,
14339
14351
  userId: data.user,
14340
14352
  sdkToken: data.attachToken || data.token,
14353
+ plan: data.planid,
14341
14354
  });
14342
14355
  case RTCEngineType.Core:
14343
14356
  return new CoreRTC$1({
@@ -14345,6 +14358,7 @@
14345
14358
  roomId: data.roomStr,
14346
14359
  userId: data.user,
14347
14360
  sdkToken: data.attachToken || data.token,
14361
+ plan: data.planid,
14348
14362
  });
14349
14363
  case RTCEngineType.VolcEngine:
14350
14364
  return new VolcCoreRTCWrapper({
@@ -14352,6 +14366,7 @@
14352
14366
  roomId: data.roomStr,
14353
14367
  userId: data.user.toString(),
14354
14368
  sdkToken: data.attachToken || data.token,
14369
+ plan: data.planid,
14355
14370
  extraInfo: extraInfo,
14356
14371
  });
14357
14372
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnirtc-web",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "",
5
5
  "main": "./dist/es-omnirtc-web.js",
6
6
  "types": "./dist/omni.d.ts",