trtc-electron-sdk 9.3.8-alpha.0 → 9.3.8-alpha.3

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/liteav/trtc.d.ts CHANGED
@@ -39,8 +39,7 @@ declare class TRTCCloud extends EventEmitter {
39
39
  private audioQuality;
40
40
  private bgmId;
41
41
  private playAudioEffectIdList;
42
- private features;
43
- constructor(enableDebug?: boolean);
42
+ constructor();
44
43
  /**
45
44
  * 创建 TRTCCloud 对象单例
46
45
  * @returns {TRTCCloud}
@@ -2005,7 +2004,5 @@ declare class TRTCCloud extends EventEmitter {
2005
2004
  _YUV2RGBA(width: number, height: number, buffer: ArrayBufferLike): Uint8ClampedArray;
2006
2005
  _BGRA2RGBA(data: ArrayBuffer, width: number, height: number): Uint8ClampedArray;
2007
2006
  _isMacPlatform(): boolean;
2008
- _getFeaturesSetting(): void;
2009
- _isEnableFeature(featureKey: string): boolean;
2010
2007
  }
2011
2008
  export default TRTCCloud;
package/liteav/trtc.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -90,7 +94,7 @@ let oriRtcCloud = null;
90
94
  *
91
95
  */
92
96
  class TRTCCloud extends events_1.EventEmitter {
93
- constructor(enableDebug = false) {
97
+ constructor() {
94
98
  super();
95
99
  oriRtcCloud = new trtc.NodeRTCCloud(pkg.version);
96
100
  this.rtcCloud = Object.assign({}, oriRtcCloud, {
@@ -116,10 +120,6 @@ class TRTCCloud extends events_1.EventEmitter {
116
120
  // 生成一个足够大, 不会与用户输入重复的 id
117
121
  this.bgmId = 1 << 29;
118
122
  this.playAudioEffectIdList = [];
119
- this.features = null;
120
- if (enableDebug) {
121
- this._getFeaturesSetting();
122
- }
123
123
  this.initEventHandler();
124
124
  console.log('constructor render:' + this.renderMode + '|sdk version:' + pkg.version +
125
125
  '|native sdk version:' + this.rtcCloud.getSDKVersion());
@@ -1422,20 +1422,13 @@ class TRTCCloud extends events_1.EventEmitter {
1422
1422
  * @param {HTMLElement} view - 承载预览画面的 DOM
1423
1423
  */
1424
1424
  startLocalPreview(view) {
1425
- if (!this._isEnableFeature('localVideoJS')) {
1426
- return;
1427
- }
1428
1425
  if (view !== undefined) {
1429
1426
  if (view !== null) {
1430
1427
  let key = this.getKey('local_video', trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
1431
- if (this._isEnableFeature('localVideoRenderJS')) {
1432
- this._initRender(key, view);
1433
- }
1428
+ this._initRender(key, view);
1434
1429
  }
1435
1430
  this.rtcCloud.startLocalPreview();
1436
- if (this._isEnableFeature('addLocalVideoRenderCallbackJS')) {
1437
- this.addLocalVideoRenderCallback();
1438
- }
1431
+ this.addLocalVideoRenderCallback();
1439
1432
  }
1440
1433
  else {
1441
1434
  console.error('startLocalPreview, view is undefined!');
@@ -1473,9 +1466,6 @@ class TRTCCloud extends events_1.EventEmitter {
1473
1466
  * @param {TRTCVideoStreamType} streamType - 视频流类型
1474
1467
  */
1475
1468
  startRemoteView(userId, view, streamType) {
1476
- if (!this._isEnableFeature('remoteVideoJS')) {
1477
- return;
1478
- }
1479
1469
  if (streamType === undefined) {
1480
1470
  streamType = this.priorRemoteVideoStreamType;
1481
1471
  }
@@ -1488,13 +1478,9 @@ class TRTCCloud extends events_1.EventEmitter {
1488
1478
  bindStreamType = trtc_define_1.TRTCVideoStreamType.TRTCVideoStreamTypeBig;
1489
1479
  }
1490
1480
  const key = this.getKey(userId, bindStreamType);
1491
- if (this._isEnableFeature('remoteVideoRenderJS')) {
1492
- this._initRender(key, view);
1493
- }
1494
- }
1495
- if (this._isEnableFeature('addRemoteVideoRenderCallback')) {
1496
- this.addRemoteVideoRenderCallback(userId);
1481
+ this._initRender(key, view);
1497
1482
  }
1483
+ this.addRemoteVideoRenderCallback(userId);
1498
1484
  this.rtcCloud.startRemoteView(userId, streamType);
1499
1485
  }
1500
1486
  else {
@@ -3116,9 +3102,7 @@ class TRTCCloud extends events_1.EventEmitter {
3116
3102
  this.pixelformate = trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420;
3117
3103
  }
3118
3104
  this.rtcCloud.addLocalVideoRenderCallback((id, type, width, height, timestamp, rotation, data) => {
3119
- if (this._isEnableFeature('onRenderLocalFrameJS')) {
3120
- this._onRenderFrame(id, type, width, height, timestamp, rotation, data);
3121
- }
3105
+ this._onRenderFrame(id, type, width, height, timestamp, rotation, data);
3122
3106
  }, this.pixelformate);
3123
3107
  }
3124
3108
  addRemoteVideoRenderCallback(userid) {
@@ -3129,9 +3113,7 @@ class TRTCCloud extends events_1.EventEmitter {
3129
3113
  this.pixelformate = trtc_define_1.TRTCVideoPixelFormat.TRTCVideoPixelFormat_I420;
3130
3114
  }
3131
3115
  this.rtcCloud.addRemoteVideoRenderCallback(userid, (id, type, width, height, timestamp, rotation, data) => {
3132
- if (this._isEnableFeature('onRenderRemoteFrameJS')) {
3133
- this._onRenderFrame(id, type, width, height, timestamp, rotation, data);
3134
- }
3116
+ this._onRenderFrame(id, type, width, height, timestamp, rotation, data);
3135
3117
  }, this.pixelformate);
3136
3118
  }
3137
3119
  //----------------------------------//
@@ -3161,35 +3143,20 @@ class TRTCCloud extends events_1.EventEmitter {
3161
3143
  // plugin apis
3162
3144
  //----------------------------------//
3163
3145
  initPluginManager() {
3164
- if (!this._isEnableFeature('enablePluginJS')) {
3165
- return;
3166
- }
3167
3146
  this.rtcCloud.initializePluginManager();
3168
3147
  }
3169
3148
  destroyPluginManager() {
3170
- if (!this._isEnableFeature('enablePluginJS')) {
3171
- return;
3172
- }
3173
3149
  this.rtcCloud.releasePluginManager();
3174
3150
  }
3175
3151
  addPlugin(plugin) {
3176
- if (!this._isEnableFeature('enablePluginJS')) {
3177
- return;
3178
- }
3179
3152
  // type: 1 表示美颜插件
3180
3153
  const pluginType = plugin.type || 1;
3181
3154
  this.rtcCloud.registerPlugin(plugin.id, plugin.path, pluginType);
3182
3155
  }
3183
3156
  removePlugin(id) {
3184
- if (!this._isEnableFeature('enablePluginJS')) {
3185
- return;
3186
- }
3187
3157
  this.rtcCloud.unregisterPlugin(id);
3188
3158
  }
3189
3159
  getPluginList() {
3190
- if (!this._isEnableFeature('enablePluginJS')) {
3191
- return [];
3192
- }
3193
3160
  return this.rtcCloud.getPlugins().map((item) => {
3194
3161
  return this.createPlugin(item.id);
3195
3162
  });
@@ -3212,9 +3179,6 @@ class TRTCCloud extends events_1.EventEmitter {
3212
3179
  };
3213
3180
  }
3214
3181
  setPluginCallback(pluginCb) {
3215
- if (!this._isEnableFeature('enablePluginJS')) {
3216
- return;
3217
- }
3218
3182
  this.rtcCloud.setPluginCallback(pluginCb);
3219
3183
  }
3220
3184
  getKey(uid, type) {
@@ -3508,35 +3472,6 @@ class TRTCCloud extends events_1.EventEmitter {
3508
3472
  _isMacPlatform() {
3509
3473
  return process.platform == 'darwin';
3510
3474
  }
3511
- _getFeaturesSetting() {
3512
- const start = Date.now();
3513
- fetch('https://web.sdk.qcloud.com/trtc/electron/setting/xiaoe.json', {
3514
- cache: 'no-cache'
3515
- })
3516
- .then((response) => {
3517
- const contentType = response.headers.get('content-type');
3518
- if (!contentType || !contentType.includes('application/json')) {
3519
- throw new TypeError("Oops, we haven't got JSON!");
3520
- }
3521
- return response.json();
3522
- }).then(data => {
3523
- this.features = data;
3524
- const experimentApi = {
3525
- 'api': 'setFeatureEnable',
3526
- 'params': this.features
3527
- };
3528
- console.log('_getFeaturesSetting: ', this.features);
3529
- this.callExperimentalAPI(JSON.stringify(experimentApi));
3530
- this.emit('onReady', this.features, Date.now() - start);
3531
- })
3532
- .catch(error => console.error(error));
3533
- }
3534
- _isEnableFeature(featureKey) {
3535
- if (!this.features || this.features[featureKey] === undefined) {
3536
- return true;
3537
- }
3538
- return this.features[featureKey] === 1;
3539
- }
3540
3475
  }
3541
3476
  class VideoRenderCallback {
3542
3477
  constructor() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "9.3.8-alpha.0",
3
+ "version": "9.3.8-alpha.3",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/trtc.js",
6
6
  "types": "./liteav/trtc.d.ts",