trtc-electron-sdk 12.3.705-beta.1 → 12.3.705-beta.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.
@@ -24,8 +24,8 @@ const ResizeAnchorCSSClass = {
24
24
  const ResizeAnchorStyle = {
25
25
  resizeAnchor: {
26
26
  position: 'absolute',
27
- width: '0.5rem',
28
- height: '0.5rem',
27
+ width: '8px',
28
+ height: '8px',
29
29
  border: '1px solid transparent',
30
30
  backgroundColor: 'transparent'
31
31
  },
@@ -36,7 +36,7 @@ const ResizeAnchorStyle = {
36
36
  },
37
37
  topAnchor: {
38
38
  top: '0',
39
- left: 'calc(50% - 0.25rem)',
39
+ left: 'calc(50% - 4px)',
40
40
  cursor: 'n-resize'
41
41
  },
42
42
  topRightAnchor: {
@@ -45,12 +45,12 @@ const ResizeAnchorStyle = {
45
45
  cursor: 'ne-resize'
46
46
  },
47
47
  leftAnchor: {
48
- top: 'calc(50% - 0.25rem)',
48
+ top: 'calc(50% - 4px)',
49
49
  left: '0',
50
50
  cursor: 'w-resize'
51
51
  },
52
52
  rightAnchor: {
53
- top: 'calc(50% - 0.25rem)',
53
+ top: 'calc(50% - 4px)',
54
54
  right: '0',
55
55
  cursor: 'e-resize'
56
56
  },
@@ -61,7 +61,7 @@ const ResizeAnchorStyle = {
61
61
  },
62
62
  bottomAnchor: {
63
63
  bottom: '0',
64
- left: 'calc(50% - 0.25rem)',
64
+ left: 'calc(50% - 4px)',
65
65
  cursor: 's-resize'
66
66
  },
67
67
  bottomRightAnchor: {
@@ -13,7 +13,8 @@ declare class VideoRenderFPSMonitor {
13
13
  private lastVideoRenderFPS;
14
14
  private statisticDuration;
15
15
  constructor();
16
- private initPageRefreshFPSStatistic;
16
+ start(): void;
17
+ stop(): void;
17
18
  private statisticPageRefreshFPS;
18
19
  /**
19
20
  * 规则:
@@ -23,13 +23,28 @@ class VideoRenderFPSMonitor {
23
23
  this.statisticDuration = 2000;
24
24
  this.statisticPageRefreshFPS = this.statisticPageRefreshFPS.bind(this);
25
25
  this.onVisibilityChange = this.onVisibilityChange.bind(this);
26
- this.initPageRefreshFPSStatistic();
27
- document.addEventListener('visibilitychange', this.onVisibilityChange);
26
+ this.start();
28
27
  }
29
- initPageRefreshFPSStatistic() {
28
+ start() {
29
+ logger_1.default.debug(`${this.logPrefix}start`);
30
30
  if (window.requestAnimationFrame) {
31
31
  this.nextAnimationFrame = window.requestAnimationFrame(this.statisticPageRefreshFPS);
32
32
  }
33
+ document.addEventListener('visibilitychange', this.onVisibilityChange);
34
+ }
35
+ stop() {
36
+ logger_1.default.debug(`${this.logPrefix}stop`);
37
+ if (this.nextAnimationFrame !== 0) {
38
+ window.cancelAnimationFrame(this.nextAnimationFrame);
39
+ this.nextAnimationFrame = 0;
40
+ }
41
+ document.removeEventListener('visibilitychange', this.onVisibilityChange);
42
+ this.lastTimestamp = 0;
43
+ this.refreshCount = 0;
44
+ this.pageRefreshFPS = 0;
45
+ this.lastPageRefreshFPS = 60;
46
+ this.videoRenderFPS = 0;
47
+ this.lastVideoRenderFPS = -1;
33
48
  }
34
49
  statisticPageRefreshFPS(timestamp) {
35
50
  if (this.lastTimestamp === 0) {
@@ -100,18 +115,16 @@ class VideoRenderFPSMonitor {
100
115
  }
101
116
  notifyFPS() {
102
117
  logger_1.default.debug(`${this.logPrefix} pageRefreshFPS:${this.pageRefreshFPS} videoRenderFPS: ${this.videoRenderFPS}`);
103
- this.emit('videoRenderFPS', {
104
- pageFPS: this.pageRefreshFPS,
105
- videoFPS: this.videoRenderFPS,
106
- });
107
- }
108
- destroy() {
109
118
  if (this.nextAnimationFrame) {
110
- window.cancelAnimationFrame(this.nextAnimationFrame);
111
- this.nextAnimationFrame = 0;
119
+ this.emit('videoRenderFPS', {
120
+ pageFPS: this.pageRefreshFPS,
121
+ videoFPS: this.videoRenderFPS,
122
+ });
112
123
  }
124
+ }
125
+ destroy() {
126
+ this.stop();
113
127
  this.emitter.removeAllListeners();
114
- document.removeEventListener('visibilitychange', this.onVisibilityChange);
115
128
  }
116
129
  on(event, listener) {
117
130
  this.emitter.on(event, listener);
package/liteav/trtc.d.ts CHANGED
@@ -2768,14 +2768,6 @@ declare class TRTCCloud extends EventEmitter {
2768
2768
  * @param {Function | null} callback - 日志回调。 Function 的参数格式为 (log:string, level:TRTCLogLevel, module:string) => void。
2769
2769
  */
2770
2770
  setLogCallback(callback?: (log: string, level: TRTCLogLevel, module: string) => void | null): void;
2771
- /**
2772
- * 调用实验性 API 接口
2773
- *
2774
- * 注意:该接口用于调用一些实验性功能
2775
- *
2776
- * @param {String} jsonStr - 接口及参数描述的 JSON 字符串
2777
- */
2778
- callExperimentalAPI(jsonStr: string): void;
2779
2771
  private _localVideoRenderCallback;
2780
2772
  addLocalVideoRenderCallback(): void;
2781
2773
  removeLocalVideoRenderCallback(): void;
@@ -2940,5 +2932,14 @@ declare class TRTCCloud extends EventEmitter {
2940
2932
  * @returns {TRTCPluginManager}
2941
2933
  */
2942
2934
  private getPluginManager;
2935
+ /**
2936
+ * 调用实验性 API 接口
2937
+ *
2938
+ * 注意:该接口用于调用一些实验性功能
2939
+ *
2940
+ * @param {String} jsonStr - 接口及参数描述的 JSON 字符串
2941
+ */
2942
+ callExperimentalAPI(jsonStr: string): void;
2943
+ private disableLocalRenderFPSOptimization;
2943
2944
  }
2944
2945
  export default TRTCCloud;
package/liteav/trtc.js CHANGED
@@ -4617,16 +4617,6 @@ class TRTCCloud extends events_1.EventEmitter {
4617
4617
  setLogCallback(callback) {
4618
4618
  this.rtcCloud.setLogCallback(callback);
4619
4619
  }
4620
- /**
4621
- * 调用实验性 API 接口
4622
- *
4623
- * 注意:该接口用于调用一些实验性功能
4624
- *
4625
- * @param {String} jsonStr - 接口及参数描述的 JSON 字符串
4626
- */
4627
- callExperimentalAPI(jsonStr) {
4628
- this.rtcCloud.callExperimentalAPI(jsonStr);
4629
- }
4630
4620
  /////////////////////////////////////////////////////////////////////////////////
4631
4621
  //
4632
4622
  // (十五) 废弃接口函数
@@ -5334,6 +5324,45 @@ class TRTCCloud extends events_1.EventEmitter {
5334
5324
  getPluginManager() {
5335
5325
  return this.pluginManager;
5336
5326
  }
5327
+ /////////////////////////////////////////////////////////////////////////////////
5328
+ //
5329
+ // 实验接口
5330
+ //
5331
+ /////////////////////////////////////////////////////////////////////////////////
5332
+ /**
5333
+ * 调用实验性 API 接口
5334
+ *
5335
+ * 注意:该接口用于调用一些实验性功能
5336
+ *
5337
+ * @param {String} jsonStr - 接口及参数描述的 JSON 字符串
5338
+ */
5339
+ callExperimentalAPI(jsonStr) {
5340
+ try {
5341
+ const json = JSON.parse(jsonStr);
5342
+ const { api, params } = json;
5343
+ if (this[api] && typeof this[api] === 'function') {
5344
+ this[api](params);
5345
+ }
5346
+ else {
5347
+ this.rtcCloud.callExperimentalAPI(jsonStr);
5348
+ }
5349
+ }
5350
+ catch (error) {
5351
+ this.logger.warn(`callExperimentalAPI invalid JSON parameter`, error);
5352
+ }
5353
+ }
5354
+ disableLocalRenderFPSOptimization(params) {
5355
+ this.videoRenderFPS = 60;
5356
+ if (params.disable === true) {
5357
+ VideoRenderFPSMonitor_1.videoRenderFPSMonitor.stop();
5358
+ }
5359
+ else {
5360
+ VideoRenderFPSMonitor_1.videoRenderFPSMonitor.start();
5361
+ }
5362
+ if (!TRTCCloud.isIPCMode) {
5363
+ this.rtcCloud.setVideoRenderFPS(this.videoRenderFPS);
5364
+ }
5365
+ }
5337
5366
  }
5338
5367
  class VideoRenderCallback {
5339
5368
  constructor() {
@@ -234,7 +234,7 @@ export declare class TRTCVideoFrame {
234
234
  * 音频帧数据
235
235
  *
236
236
  * @param {TRTCAudioFrameFormat} audioFormat - 音频帧的格式
237
- * @param {ArrayBuffer} data - 音频数据
237
+ * @param {Buffer|ArrayBuffer} data - 音频数据
238
238
  * @param {Number} length - 音频数据的长度
239
239
  * @param {Number} sampleRate - 采样率
240
240
  * @param {Number} channel - 声道数
@@ -244,7 +244,7 @@ export declare class TRTCVideoFrame {
244
244
  */
245
245
  export declare class TRTCAudioFrame {
246
246
  audioFormat: TRTCAudioFrameFormat;
247
- data: ArrayBuffer | null;
247
+ data: Buffer | ArrayBuffer | null;
248
248
  length: number;
249
249
  sampleRate: number;
250
250
  channel: number;
@@ -651,7 +651,7 @@ exports.TRTCVideoFrame = TRTCVideoFrame;
651
651
  * 音频帧数据
652
652
  *
653
653
  * @param {TRTCAudioFrameFormat} audioFormat - 音频帧的格式
654
- * @param {ArrayBuffer} data - 音频数据
654
+ * @param {Buffer|ArrayBuffer} data - 音频数据
655
655
  * @param {Number} length - 音频数据的长度
656
656
  * @param {Number} sampleRate - 采样率
657
657
  * @param {Number} channel - 声道数
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "12.3.705-beta.1",
3
+ "version": "12.3.705-beta.3",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/index.js",
6
6
  "types": "./liteav/index.d.ts",
@@ -69,11 +69,11 @@ if (process.platform === "win32") {
69
69
  path.resolve(SDK_JS_PATH, `build/Release/${process.arch}/trtc_electron_sdk.node`)
70
70
  );
71
71
  copySync(
72
- path.resolve(SDK_CPP_PATH, `src/linux/libs/${soPrefix}/`),
72
+ path.resolve(SDK_CPP_PATH, `src/remote-liteav/sdk/linux/libs/${soPrefix}/`),
73
73
  path.resolve(SDK_JS_PATH, 'build/Release/')
74
74
  );
75
75
  copySync(
76
- path.resolve(SDK_CPP_PATH, `src/linux/libs/${soPrefix}/`),
76
+ path.resolve(SDK_CPP_PATH, `src/remote-liteav/sdk/linux/libs/${soPrefix}/`),
77
77
  path.resolve(SDK_JS_PATH, `build/Release/${process.arch}/`)
78
78
  );
79
79
  }