trtc-electron-sdk 13.4.800-alpha.0 → 13.4.802-beta.0

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/README.md CHANGED
@@ -11,13 +11,13 @@ Tencent Real-Time Communication (TRTC) is a set of low-latency, high-quality rea
11
11
  - ⬆️ [Publishing to CSS CDN](https://www.tencentcloud.com/document/product/647/47858#)
12
12
 
13
13
  ## 💻 Environment Support
14
- - 🍎 Support macOS x64 and arm64(**Electron 11+**)
15
- - ⚙️ Support Windows ia32 and x64
14
+ - 🍎 macOS **11.0 (Big Sur)** and above, x64 and arm64 (**Electron 11+**)
15
+ - 🪟 Windows 7 SP1 and above, ia32 and x64
16
16
  - 🌈 Electron: 8.5.0 and above
17
17
 
18
- | macOS | Windows | Electron |
19
- | :----------: | :---------: | :------------: |
20
- | x64 \| arm64 | ia32 \| x64 | 8.5.0 and above |
18
+ | macOS | Windows | Electron |
19
+ | :--------------------: | :---------: | :------------: |
20
+ | 11.0+ (x64 \| arm64) | ia32 \| x64 | 8.5.0 and above |
21
21
 
22
22
 
23
23
  ## ⏬ Install
@@ -25,28 +25,28 @@ export interface YUVFormat {
25
25
  displayHeight?: number;
26
26
  }
27
27
  /**
28
- * Represents underlying image data for a single luma or chroma plane.
29
- * Cannot be interpreted without the format data from a frame buffer.
30
- * @typedef {Object} YUVPlane
31
- * @property {Uint8Array} bytes - typed array containing image data bytes
32
- * @property {number} stride - byte distance between rows in data
33
- */
28
+ * Represents underlying image data for a single luma or chroma plane.
29
+ * Cannot be interpreted without the format data from a frame buffer.
30
+ * @typedef {Object} YUVPlane
31
+ * @property {Uint8Array} bytes - typed array containing image data bytes
32
+ * @property {number} stride - byte distance between rows in data
33
+ */
34
34
  export interface YUVPlane {
35
35
  bytes: Uint8Array;
36
36
  stride: number;
37
37
  }
38
38
  /**
39
- * Represents a YUV image frame buffer, with enough format information
40
- * to interpret the data usefully. Buffer objects use generic objects
41
- * under the hood and can be transferred between worker threads using
42
- * the structured clone algorithm.
43
- *
44
- * @typedef {Object} YUVFrame
45
- * @property {YUVFormat} format
46
- * @property {YUVPlane} y
47
- * @property {YUVPlane} u
48
- * @property {YUVPlane} v
49
- */
39
+ * Represents a YUV image frame buffer, with enough format information
40
+ * to interpret the data usefully. Buffer objects use generic objects
41
+ * under the hood and can be transferred between worker threads using
42
+ * the structured clone algorithm.
43
+ *
44
+ * @typedef {Object} YUVFrame
45
+ * @property {YUVFormat} format
46
+ * @property {YUVPlane} y
47
+ * @property {YUVPlane} u
48
+ * @property {YUVPlane} v
49
+ */
50
50
  export interface YUVFrame {
51
51
  format: YUVFormat;
52
52
  y: YUVPlane;
@@ -166,12 +166,12 @@ var YUVBuffer = {
166
166
  stride = stride || this.suitableStride(width);
167
167
  this.validateDimension(stride);
168
168
  if (stride < width) {
169
- throw "Invalid input stride for YUV plane; must be larger than width";
169
+ throw 'Invalid input stride for YUV plane; must be larger than width';
170
170
  }
171
171
  size = stride * height;
172
172
  if (source) {
173
173
  if (source.length - offset < size) {
174
- throw "Invalid input buffer for YUV plane; must be large enough for stride times height";
174
+ throw 'Invalid input buffer for YUV plane; must be large enough for stride times height';
175
175
  }
176
176
  bytes = source; // source.slice(offset, offset + size);
177
177
  }
@@ -54,6 +54,8 @@ export declare enum TRTCMediaMixingEvent {
54
54
  onError = "onError",
55
55
  /**
56
56
  * @description 设备插入事件
57
+ * @deprecated
58
+ * @private
57
59
  *
58
60
  * @event TRTCMediaMixingEvent#onSourcePlugged
59
61
  * @param {TRTCPhoneMirrorParam} source 投屏手机状态信息
@@ -62,6 +64,8 @@ export declare enum TRTCMediaMixingEvent {
62
64
  onSourcePlugged = "onSourcePlugged",
63
65
  /**
64
66
  * @description 设备链接事件
67
+ * @deprecated
68
+ * @private
65
69
  *
66
70
  * @event TRTCMediaMixingEvent#onSourceConnected
67
71
  * @param {TRTCPhoneMirrorParam} source 投屏手机状态信息
@@ -70,6 +74,8 @@ export declare enum TRTCMediaMixingEvent {
70
74
  onSourceConnected = "onSourceConnected",
71
75
  /**
72
76
  * @description 设备断开链接事件
77
+ * @deprecated
78
+ * @private
73
79
  *
74
80
  * @event TRTCMediaMixingEvent#onSourceDisconnected
75
81
  * @param {TRTCPhoneMirrorParam} source 投屏手机状态信息
@@ -78,6 +84,8 @@ export declare enum TRTCMediaMixingEvent {
78
84
  onSourceDisconnected = "onSourceDisconnected",
79
85
  /**
80
86
  * @description 设备拔出事件
87
+ * @deprecated
88
+ * @private
81
89
  *
82
90
  * @event TRTCMediaMixingEvent#onSourceUnplugged
83
91
  * @param {TRTCPhoneMirrorParam} source 投屏手机状态信息
@@ -95,6 +103,13 @@ export declare enum TRTCMediaMixingEvent {
95
103
  * @param {Number} size.height 媒体源最新高度
96
104
  */
97
105
  onMediaSourceSizeChanged = "onMediaSourceSizeChanged",
106
+ /**
107
+ * @description 本地混流服务丢失事件
108
+ * @deprecated
109
+ * @private
110
+ *
111
+ * @event TRTCMediaMixingEvent#onMediaMixingServerLost
112
+ */
98
113
  onMediaMixingServerLost = "onMediaMixingServerLost"
99
114
  }
100
115
  declare enum TRTCMediaMixingServerMode {
@@ -128,6 +143,7 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
128
143
  private autoControlServer;
129
144
  private serverStatus;
130
145
  private serverMode;
146
+ private addMediaSourceTimers;
131
147
  private webRenderer;
132
148
  private pixelFormat;
133
149
  private pixelLength;
@@ -240,6 +256,7 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
240
256
  * @returns {Promise<void>}
241
257
  */
242
258
  addMediaSource(mediaSource: TRTCMediaSource): Promise<void>;
259
+ private getAddMediaSourceTimeoutMs;
243
260
  /**
244
261
  * 删除本地混流媒体源
245
262
  * @param mediaSource {TRTCMediaSource} - 媒体源信息
@@ -256,12 +273,17 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
256
273
  updateMediaSource(mediaSource: TRTCMediaSource): Promise<void>;
257
274
  /**
258
275
  * 设置摄像头采集参数
276
+ *
277
+ * @deprecated 请使用 `addMediaSource` 或 `updateMediaSource` 代替
278
+ *
259
279
  * @param cameraID {string} - 摄像头 ID
260
280
  * @param params {TRTCCameraCaptureParams} - 摄像头采集参数
261
281
  */
262
282
  setCameraCaptureParam(cameraID: string, params: TRTCCameraCaptureParams): void;
263
283
  /**
264
284
  * 设置手机投屏参数
285
+ *
286
+ * @deprecated
265
287
  * @private
266
288
  * @param phoneMirrorSourceId {string} - 手机投屏媒体源 ID
267
289
  * @param param {TRTCPhoneMirrorParam} - 手机投屏参数
@@ -269,18 +291,27 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
269
291
  setPhoneMirrorParam(phoneMirrorSourceId: string, param: TRTCPhoneMirrorParam): void;
270
292
  /**
271
293
  * 设置屏幕采集参数
294
+ *
295
+ * @deprecated 请使用 `addMediaSource` 或 `updateMediaSource` 代替
296
+ *
272
297
  * @param screenOrWindowID {String} - 屏幕 ID 或 窗口 ID
273
298
  * @param property {TRTCScreenCaptureProperty} - 屏幕采集属性
274
299
  */
275
300
  setScreenCaptureProperty(screenOrWindowID: string, property: TRTCScreenCaptureProperty): void;
276
301
  /**
277
302
  * 设置在线视频源播放参数
303
+ *
304
+ * @deprecated 请使用 `addMediaSource` 或 `updateMediaSource` 代替
305
+ *
278
306
  * @param url {string} - 在线视频源 URL
279
307
  * @param param {TRTCOnlineVideoParam} - 在线视频源播放参数
280
308
  */
281
309
  setOnlineVideoParam(url: string, param: TRTCOnlineVideoParam): void;
282
310
  /**
283
311
  * 设置视频文件播放参数
312
+ *
313
+ * @deprecated 请使用 `addMediaSource` 或 `updateMediaSource` 代替
314
+ *
284
315
  * @param videoFilePath {string} - 视频文件路径
285
316
  * @param param {TRTCVideoFileParam} - 视频文件播放参数
286
317
  */
@@ -449,6 +480,58 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
449
480
  private onCallExperimentalAPIFinish;
450
481
  private recoverMediaMixingServer;
451
482
  private onDevicePixelRatioChange;
483
+ /**
484
+ * @private
485
+ * Apply camera capture params BEFORE native addMediaSource.
486
+ *
487
+ * Calling setCameraCaptureParam after the camera has already been added
488
+ * triggers an extra camera restart (the camera first starts with default
489
+ * params and then restarts with the new ones). To avoid this we set
490
+ * camera params up-front for the add path. For all other source types
491
+ * the corresponding setters are dispatched in the post-add callback
492
+ * (`onMediaSourceAdded` -> `_applyMediaSourceParams`).
493
+ */
494
+ private _applyCameraParamsBeforeAdd;
495
+ /**
496
+ * @private
497
+ * Apply capture params from TRTCMediaSource to the native plugin.
498
+ *
499
+ * This method is called after media source is added or updated. To avoid
500
+ * costly side-effects of native setters (e.g. setCameraCaptureParam will
501
+ * restart the camera), the setter is invoked only when params are actually
502
+ * provided AND differ from the previous value carried by `oldMediaSource`.
503
+ *
504
+ * Camera handling differs by phase:
505
+ * - Add path (oldMediaSource is undefined): camera params have been set
506
+ * before native addMediaSource via `_applyCameraParamsBeforeAdd`, so
507
+ * this method skips kCamera to avoid duplicate setter invocation.
508
+ * - Update path (oldMediaSource is provided): kCamera goes through the
509
+ * same diff check as other types and is dispatched only when changed.
510
+ *
511
+ * @param mediaSource - The new media source carrying capture params.
512
+ * @param oldMediaSource - The previous media source (omit for the add path
513
+ * where no previous params exist; in that case the
514
+ * setter is always invoked when params are present).
515
+ */
516
+ private _applyMediaSourceParams;
517
+ /**
518
+ * @private
519
+ * Shallow-but-stable equality check on capture param objects via JSON.
520
+ *
521
+ * Returns true when both sides represent the "same" params, false otherwise.
522
+ * Semantics:
523
+ * - both empty (undefined / null) → true (no change requested)
524
+ * - exactly one side empty → false (first-time apply or transition)
525
+ * - both non-empty → byte-equal after JSON.stringify
526
+ *
527
+ * Note: JSON.stringify is sensitive to key ordering. Capture param objects
528
+ * carried by `TRTCMediaSource` are constructed by the SDK via
529
+ * `JSON.parse(JSON.stringify(...))` flow, so key order is stable in
530
+ * practice; for caller-supplied literal objects with unstable key order,
531
+ * the comparison may yield a false-negative and trigger an unnecessary
532
+ * setter call.
533
+ */
534
+ private _isSameCaptureParams;
452
535
  private previewInNativeWindow;
453
536
  private previewInWebElement;
454
537
  private previewInNone;