trtc-electron-sdk 12.2.115-beta.21 → 12.2.115-beta.22

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.
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.TRTCMediaMixingManager = exports.TRTCMediaMixingEvent = void 0;
16
16
  const events_1 = require("events");
17
17
  const trtc_define_1 = require("../../trtc_define");
18
+ const types_1 = require("./types");
18
19
  const utils_1 = require("../../utils");
19
20
  const constant_1 = require("../../constant");
20
21
  const index_1 = __importDefault(require("../../MediaMixingDesigner/index"));
@@ -484,7 +485,10 @@ class TRTCMediaMixingManager {
484
485
  logger_1.default.log(`${this.logPrefix}addMediaSource:`, mediaSource);
485
486
  const index = this.findMediaSourceIndex(mediaSource);
486
487
  if (index !== -1) {
487
- throw new Error("Media source already existed");
488
+ return Promise.reject({
489
+ code: types_1.TRTCMediaMixingErrorCode.InvalidParams,
490
+ message: "Media source already existed"
491
+ });
488
492
  }
489
493
  const newMediaSource = (0, utils_1.safelyParse)(JSON.stringify(mediaSource));
490
494
  if (newMediaSource.isSelected) {
@@ -517,7 +521,10 @@ class TRTCMediaMixingManager {
517
521
  logger_1.default.log(`${this.logPrefix}removeMediaSource:`, mediaSource);
518
522
  const index = this.findMediaSourceIndex(mediaSource);
519
523
  if (index === -1) {
520
- throw new Error("Not existing media source to remove");
524
+ return Promise.reject({
525
+ code: types_1.TRTCMediaMixingErrorCode.NotFoundSource,
526
+ message: "Not existing media source to remove"
527
+ });
521
528
  }
522
529
  return new Promise((resolve, reject) => {
523
530
  const key = `${promiseKeys.removeMediaSource}-${mediaSource.sourceType}-${mediaSource.sourceId}`;
@@ -536,7 +543,10 @@ class TRTCMediaMixingManager {
536
543
  logger_1.default.log(`${this.logPrefix}updateMediaSource:`, mediaSource);
537
544
  const index = this.findMediaSourceIndex(mediaSource);
538
545
  if (index === -1) {
539
- throw new Error("Not existing media source to update");
546
+ return Promise.reject({
547
+ code: types_1.TRTCMediaMixingErrorCode.NotFoundSource,
548
+ message: "Not existing media source to update"
549
+ });
540
550
  }
541
551
  const newMediaSource = Object.assign(Object.assign({}, this.sourceList[index]), (0, utils_1.safelyParse)(JSON.stringify(mediaSource)));
542
552
  if (mediaSource.isSelected) {
package/liteav/trtc.d.ts CHANGED
@@ -1984,7 +1984,7 @@ declare class TRTCCloud extends EventEmitter {
1984
1984
  * true // enable highlight
1985
1985
  * );
1986
1986
  */
1987
- selectScreenCaptureTarget(source: TRTCScreenCaptureSourceInfo | number, captureRect: Rect | string, property: TRTCScreenCaptureProperty | string, deprecatedCaptureRect?: Rect, captureMouse?: boolean, highlightWindow?: boolean): any;
1987
+ selectScreenCaptureTarget(source: TRTCScreenCaptureSourceInfo | number, captureRect: Rect | string, property: TRTCScreenCaptureProperty | string, deprecatedCaptureRect?: Rect, captureMouse?: boolean, highlightWindow?: boolean): void;
1988
1988
  /**
1989
1989
  * 启动屏幕分享,支持选择使用主路或辅路进行屏幕分享。
1990
1990
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "12.2.115-beta.21",
3
+ "version": "12.2.115-beta.22",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/index.js",
6
6
  "types": "./liteav/index.d.ts",