trtc-electron-sdk 12.5.705-alpha.0 → 12.5.705-alpha.1
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/extensions/MediaMixingManager/index.d.ts +31 -62
- package/liteav/extensions/MediaMixingManager/index.js +23 -126
- package/liteav/trtc.js +9 -1
- package/package.json +1 -1
- package/liteav/extensions/MediaMixingManager/types.d.ts +0 -67
- package/liteav/extensions/MediaMixingManager/types.js +0 -21
|
@@ -1,8 +1,26 @@
|
|
|
1
|
-
import { TRTCCameraCaptureParams, Rect
|
|
2
|
-
import { TRTCMediaSource, TRTCMediaMixingEncParam, ITRTCMediaMixingManager, TRTCPhoneMirrorParam } from './types';
|
|
1
|
+
import { TRTCVideoRotation, TRTCVideoFillMode, TRTCVideoMirrorType, TRTCVideoEncParam, TRTCCameraCaptureParams, Rect } from '../../trtc_define';
|
|
3
2
|
import { TRTCDeviceManager } from '../DeviceManager';
|
|
4
|
-
export { TRTCMediaMixingErrorCode, TRTCMediaSourceType, TRTCMediaSource, TRTCMediaMixingEncParam, TRTCPhoneMirrorParam } from './types';
|
|
5
3
|
declare const NodeTRTCEngine: any;
|
|
4
|
+
export declare enum TRTCMediaSourceType {
|
|
5
|
+
kCamera = 0,
|
|
6
|
+
kScreen = 1,
|
|
7
|
+
kImage = 2
|
|
8
|
+
}
|
|
9
|
+
export declare type TRTCMediaSource = {
|
|
10
|
+
sourceType: TRTCMediaSourceType;
|
|
11
|
+
sourceId: string;
|
|
12
|
+
zOrder: number;
|
|
13
|
+
enableGreenScreen?: boolean;
|
|
14
|
+
rect: Rect;
|
|
15
|
+
isSelected?: boolean;
|
|
16
|
+
rotation?: TRTCVideoRotation;
|
|
17
|
+
fillMode?: TRTCVideoFillMode;
|
|
18
|
+
mirrorType?: TRTCVideoMirrorType;
|
|
19
|
+
};
|
|
20
|
+
export declare type TRTCMediaMixingEncParam = {
|
|
21
|
+
videoEncoderParams: TRTCVideoEncParam;
|
|
22
|
+
canvasColor: number;
|
|
23
|
+
};
|
|
6
24
|
/**
|
|
7
25
|
* @namespace TRTCMediaMixingEvent
|
|
8
26
|
* @description 目前只支持 `Windows` 操作系统
|
|
@@ -37,64 +55,19 @@ export declare enum TRTCMediaMixingEvent {
|
|
|
37
55
|
* @event TRTCMediaMixingEvent#onRightButtonClicked
|
|
38
56
|
* @param {TRTCMediaInfo} mediaSource 鼠标右键点击的媒体源
|
|
39
57
|
*/
|
|
40
|
-
onRightButtonClicked = "onRightButtonClicked"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*/
|
|
49
|
-
onError = "onError",
|
|
50
|
-
/**
|
|
51
|
-
* @description 设备插入事件
|
|
52
|
-
*
|
|
53
|
-
* @event TRTCMediaMixingEvent#onSourcePlugged
|
|
54
|
-
* @param {TRTCPhoneMirrorParam} source 投屏手机状态信息
|
|
55
|
-
* @param {String} detail 投屏手机状态变化详情
|
|
56
|
-
*/
|
|
57
|
-
onSourcePlugged = "onSourcePlugged",
|
|
58
|
-
/**
|
|
59
|
-
* @description 设备链接事件
|
|
60
|
-
*
|
|
61
|
-
* @event TRTCMediaMixingEvent#onSourceConnected
|
|
62
|
-
* @param {TRTCPhoneMirrorParam} source 投屏手机状态信息
|
|
63
|
-
* @param {String} detail 投屏手机状态变化详情
|
|
64
|
-
*/
|
|
65
|
-
onSourceConnected = "onSourceConnected",
|
|
66
|
-
/**
|
|
67
|
-
* @description 设备断开链接事件
|
|
68
|
-
*
|
|
69
|
-
* @event TRTCMediaMixingEvent#onSourceDisconnected
|
|
70
|
-
* @param {TRTCPhoneMirrorParam} source 投屏手机状态信息
|
|
71
|
-
* @param {String} detail 投屏手机状态变化详情
|
|
72
|
-
*/
|
|
73
|
-
onSourceDisconnected = "onSourceDisconnected",
|
|
74
|
-
/**
|
|
75
|
-
* @description 设备拔出事件
|
|
76
|
-
*
|
|
77
|
-
* @event TRTCMediaMixingEvent#onSourceUnplugged
|
|
78
|
-
* @param {TRTCPhoneMirrorParam} source 投屏手机状态信息
|
|
79
|
-
* @param {String} detail 投屏手机状态变化详情
|
|
80
|
-
*/
|
|
81
|
-
onSourceUnplugged = "onSourceUnplugged",
|
|
82
|
-
/**
|
|
83
|
-
* @description 媒体源画面大小发生变化
|
|
84
|
-
*
|
|
85
|
-
* 当输入媒体源的画面大小发生变化时,会通过该接口返回该输入源最新的尺寸,您可以根据该尺寸来动态调整画面的比例。
|
|
86
|
-
* @event TRTCMediaMixingEvent#onMediaSourceSizeChanged
|
|
87
|
-
* @param {TRTCMediaSource} mediasource 媒体源信息
|
|
88
|
-
* @param {Object} size 媒体源最新的画面大小
|
|
89
|
-
* @param {Number} size.width 媒体源最新宽度
|
|
90
|
-
* @param {Number} size.height 媒体源最新高度
|
|
91
|
-
*/
|
|
92
|
-
onMediaSourceSizeChanged = "onMediaSourceSizeChanged"
|
|
58
|
+
onRightButtonClicked = "onRightButtonClicked"
|
|
59
|
+
}
|
|
60
|
+
export declare enum TRTCMediaMixingErrorCode {
|
|
61
|
+
Success = 0,
|
|
62
|
+
Error = -1,
|
|
63
|
+
InvalidParams = -2,
|
|
64
|
+
NotFoundSource = -3,
|
|
65
|
+
ImageSourceLoadFailed = -4
|
|
93
66
|
}
|
|
94
67
|
/**
|
|
95
68
|
* 本地混流管理器
|
|
96
69
|
*/
|
|
97
|
-
export declare class TRTCMediaMixingManager
|
|
70
|
+
export declare class TRTCMediaMixingManager {
|
|
98
71
|
private logPrefix;
|
|
99
72
|
private nodeMediaMixingPlugin;
|
|
100
73
|
private nodeTRTCCloud;
|
|
@@ -111,6 +84,7 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
|
|
|
111
84
|
nodeTRTCCloud: typeof NodeTRTCEngine.NodeRemoteTRTCCloud;
|
|
112
85
|
});
|
|
113
86
|
destroy(): void;
|
|
87
|
+
private eventHandler;
|
|
114
88
|
/**
|
|
115
89
|
* 设置混流视频预览参数
|
|
116
90
|
*
|
|
@@ -181,8 +155,6 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
|
|
|
181
155
|
* @param params {TRTCCameraCaptureParams} - 摄像头采集参数
|
|
182
156
|
*/
|
|
183
157
|
setCameraCaptureParam(cameraID: string, params: TRTCCameraCaptureParams): void;
|
|
184
|
-
setPhoneMirrorParam(phoneMirrorSourceId: string, param: TRTCPhoneMirrorParam): void;
|
|
185
|
-
setScreenCaptureProperty(screenOrWindowID: string, property: TRTCScreenCaptureProperty): void;
|
|
186
158
|
/**
|
|
187
159
|
* 开始推流
|
|
188
160
|
* @returns {Promise<void>}
|
|
@@ -245,9 +217,6 @@ export declare class TRTCMediaMixingManager implements ITRTCMediaMixingManager {
|
|
|
245
217
|
private findMediaSourceIndex;
|
|
246
218
|
private findSelectedMediaSource;
|
|
247
219
|
private unselectMediaSource;
|
|
248
|
-
private handleCppCallbackEvent;
|
|
249
|
-
private onMediaSourceSizeChanged;
|
|
250
|
-
private onPhoneMirrorSourceChanged;
|
|
251
220
|
startCameraDeviceTest(windowID: number | Uint8Array, rect?: Rect): Promise<number>;
|
|
252
221
|
stopCameraDeviceTest(): Promise<number>;
|
|
253
222
|
setCameraTestRenderMirror(mirror: boolean): void;
|
|
@@ -12,15 +12,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.TRTCMediaMixingManager = exports.
|
|
15
|
+
exports.TRTCMediaMixingManager = exports.TRTCMediaMixingErrorCode = exports.TRTCMediaMixingEvent = exports.TRTCMediaSourceType = void 0;
|
|
16
16
|
const events_1 = require("events");
|
|
17
17
|
const trtc_define_1 = require("../../trtc_define");
|
|
18
18
|
const utils_1 = require("../../utils");
|
|
19
19
|
const logger_1 = __importDefault(require("../../logger"));
|
|
20
20
|
const index_1 = __importDefault(require("../../MediaMixingDesigner/index"));
|
|
21
|
-
var types_1 = require("./types");
|
|
22
|
-
Object.defineProperty(exports, "TRTCMediaMixingErrorCode", { enumerable: true, get: function () { return types_1.TRTCMediaMixingErrorCode; } });
|
|
23
|
-
Object.defineProperty(exports, "TRTCMediaSourceType", { enumerable: true, get: function () { return types_1.TRTCMediaSourceType; } });
|
|
24
21
|
const NodeTRTCEngine = require('../../../build/Release/trtc_electron_sdk.node');
|
|
25
22
|
/**
|
|
26
23
|
* 媒体源类型
|
|
@@ -33,9 +30,13 @@ const TRTCMediaSourceType_HACK_JSDOC = {
|
|
|
33
30
|
kScreen: 1,
|
|
34
31
|
/** 图片 */
|
|
35
32
|
kImage: 2,
|
|
36
|
-
/** 手机投屏 */
|
|
37
|
-
kPhoneMirror: 4,
|
|
38
33
|
};
|
|
34
|
+
var TRTCMediaSourceType;
|
|
35
|
+
(function (TRTCMediaSourceType) {
|
|
36
|
+
TRTCMediaSourceType[TRTCMediaSourceType["kCamera"] = 0] = "kCamera";
|
|
37
|
+
TRTCMediaSourceType[TRTCMediaSourceType["kScreen"] = 1] = "kScreen";
|
|
38
|
+
TRTCMediaSourceType[TRTCMediaSourceType["kImage"] = 2] = "kImage";
|
|
39
|
+
})(TRTCMediaSourceType = exports.TRTCMediaSourceType || (exports.TRTCMediaSourceType = {}));
|
|
39
40
|
/**
|
|
40
41
|
* 媒体源数据
|
|
41
42
|
*
|
|
@@ -48,7 +49,6 @@ const TRTCMediaSourceType_HACK_JSDOC = {
|
|
|
48
49
|
* @property {TRTCVideoRotation} rotation 媒体源选中角度,可选属性
|
|
49
50
|
* @property {TRTCVideoFillMode} fillMode 媒体源显示模式,可选属性,默认 `TRTCVideoFillMode_Fit`
|
|
50
51
|
* @property {TRTCVideoMirrorType} mirrorType 媒体源是否镜像,可选属性,默认不镜像
|
|
51
|
-
* @property {TRTCPhoneMirrorConnectionParam} connectionParam 手机投屏类型媒体源,连接参数
|
|
52
52
|
*/
|
|
53
53
|
const TRTCMediaSource_HACK_JSDOC = null;
|
|
54
54
|
/**
|
|
@@ -57,7 +57,6 @@ const TRTCMediaSource_HACK_JSDOC = null;
|
|
|
57
57
|
* @typedef {Object} TRTCMediaMixingEncParam
|
|
58
58
|
* @property {TRTCVideoEncParam} videoEncoderParams 本地混流编码参数
|
|
59
59
|
* @property {Number} canvasColor 混流视频背景色,默认值:0x0 代表黑色。格式为十六进制数字,比如:`0x61B9F1` 代表 RGB 颜色(97、158、241)。
|
|
60
|
-
* @property {Number} selectedBorderColor 选中媒体源的高亮边框颜色,默认黄色:0xFFFF00。
|
|
61
60
|
*/
|
|
62
61
|
const TRTCMediaMixingEncParam_HACK_JSDOC = null;
|
|
63
62
|
/**
|
|
@@ -96,59 +95,15 @@ var TRTCMediaMixingEvent;
|
|
|
96
95
|
* @param {TRTCMediaInfo} mediaSource 鼠标右键点击的媒体源
|
|
97
96
|
*/
|
|
98
97
|
TRTCMediaMixingEvent["onRightButtonClicked"] = "onRightButtonClicked";
|
|
99
|
-
/**
|
|
100
|
-
* @description 错误事件
|
|
101
|
-
*
|
|
102
|
-
* @event TRTCMediaMixingEvent#onError
|
|
103
|
-
* @param {TRTCMediaMixingErrorCode} errCode 错误码
|
|
104
|
-
* @param {String} 错误信息
|
|
105
|
-
*
|
|
106
|
-
*/
|
|
107
|
-
TRTCMediaMixingEvent["onError"] = "onError";
|
|
108
|
-
/**
|
|
109
|
-
* @description 设备插入事件
|
|
110
|
-
*
|
|
111
|
-
* @event TRTCMediaMixingEvent#onSourcePlugged
|
|
112
|
-
* @param {TRTCPhoneMirrorParam} source 投屏手机状态信息
|
|
113
|
-
* @param {String} detail 投屏手机状态变化详情
|
|
114
|
-
*/
|
|
115
|
-
TRTCMediaMixingEvent["onSourcePlugged"] = "onSourcePlugged";
|
|
116
|
-
/**
|
|
117
|
-
* @description 设备链接事件
|
|
118
|
-
*
|
|
119
|
-
* @event TRTCMediaMixingEvent#onSourceConnected
|
|
120
|
-
* @param {TRTCPhoneMirrorParam} source 投屏手机状态信息
|
|
121
|
-
* @param {String} detail 投屏手机状态变化详情
|
|
122
|
-
*/
|
|
123
|
-
TRTCMediaMixingEvent["onSourceConnected"] = "onSourceConnected";
|
|
124
|
-
/**
|
|
125
|
-
* @description 设备断开链接事件
|
|
126
|
-
*
|
|
127
|
-
* @event TRTCMediaMixingEvent#onSourceDisconnected
|
|
128
|
-
* @param {TRTCPhoneMirrorParam} source 投屏手机状态信息
|
|
129
|
-
* @param {String} detail 投屏手机状态变化详情
|
|
130
|
-
*/
|
|
131
|
-
TRTCMediaMixingEvent["onSourceDisconnected"] = "onSourceDisconnected";
|
|
132
|
-
/**
|
|
133
|
-
* @description 设备拔出事件
|
|
134
|
-
*
|
|
135
|
-
* @event TRTCMediaMixingEvent#onSourceUnplugged
|
|
136
|
-
* @param {TRTCPhoneMirrorParam} source 投屏手机状态信息
|
|
137
|
-
* @param {String} detail 投屏手机状态变化详情
|
|
138
|
-
*/
|
|
139
|
-
TRTCMediaMixingEvent["onSourceUnplugged"] = "onSourceUnplugged";
|
|
140
|
-
/**
|
|
141
|
-
* @description 媒体源画面大小发生变化
|
|
142
|
-
*
|
|
143
|
-
* 当输入媒体源的画面大小发生变化时,会通过该接口返回该输入源最新的尺寸,您可以根据该尺寸来动态调整画面的比例。
|
|
144
|
-
* @event TRTCMediaMixingEvent#onMediaSourceSizeChanged
|
|
145
|
-
* @param {TRTCMediaSource} mediasource 媒体源信息
|
|
146
|
-
* @param {Object} size 媒体源最新的画面大小
|
|
147
|
-
* @param {Number} size.width 媒体源最新宽度
|
|
148
|
-
* @param {Number} size.height 媒体源最新高度
|
|
149
|
-
*/
|
|
150
|
-
TRTCMediaMixingEvent["onMediaSourceSizeChanged"] = "onMediaSourceSizeChanged";
|
|
151
98
|
})(TRTCMediaMixingEvent = exports.TRTCMediaMixingEvent || (exports.TRTCMediaMixingEvent = {}));
|
|
99
|
+
var TRTCMediaMixingErrorCode;
|
|
100
|
+
(function (TRTCMediaMixingErrorCode) {
|
|
101
|
+
TRTCMediaMixingErrorCode[TRTCMediaMixingErrorCode["Success"] = 0] = "Success";
|
|
102
|
+
TRTCMediaMixingErrorCode[TRTCMediaMixingErrorCode["Error"] = -1] = "Error";
|
|
103
|
+
TRTCMediaMixingErrorCode[TRTCMediaMixingErrorCode["InvalidParams"] = -2] = "InvalidParams";
|
|
104
|
+
TRTCMediaMixingErrorCode[TRTCMediaMixingErrorCode["NotFoundSource"] = -3] = "NotFoundSource";
|
|
105
|
+
TRTCMediaMixingErrorCode[TRTCMediaMixingErrorCode["ImageSourceLoadFailed"] = -4] = "ImageSourceLoadFailed";
|
|
106
|
+
})(TRTCMediaMixingErrorCode = exports.TRTCMediaMixingErrorCode || (exports.TRTCMediaMixingErrorCode = {}));
|
|
152
107
|
/**
|
|
153
108
|
* 本地混流管理器
|
|
154
109
|
*/
|
|
@@ -161,9 +116,9 @@ class TRTCMediaMixingManager {
|
|
|
161
116
|
this.resizeObserver = null;
|
|
162
117
|
this.sourceList = [];
|
|
163
118
|
this.eventEmitter = new events_1.EventEmitter();
|
|
164
|
-
this.
|
|
119
|
+
this.eventHandler = this.eventHandler.bind(this);
|
|
165
120
|
this.nodeMediaMixingPlugin = new NodeTRTCEngine.NodeRemoteMultiSourcePlugin();
|
|
166
|
-
this.nodeMediaMixingPlugin.setRemoteMultiSourcePluginCallback(this.
|
|
121
|
+
this.nodeMediaMixingPlugin.setRemoteMultiSourcePluginCallback(this.eventHandler);
|
|
167
122
|
this.deviceManager = options.deviceManager;
|
|
168
123
|
this.nodeTRTCCloud = options.nodeTRTCCloud;
|
|
169
124
|
this.setMediaServerPath('');
|
|
@@ -200,6 +155,12 @@ class TRTCMediaMixingManager {
|
|
|
200
155
|
this.nodeMediaMixingPlugin = null;
|
|
201
156
|
this.eventEmitter = null;
|
|
202
157
|
}
|
|
158
|
+
eventHandler(args) {
|
|
159
|
+
logger_1.default.log(`${this.logPrefix} event:`, args);
|
|
160
|
+
// const key = args[0] as string;
|
|
161
|
+
// const data = args[1] as { [key: string]: never };
|
|
162
|
+
// To do: 待完善
|
|
163
|
+
}
|
|
203
164
|
/**
|
|
204
165
|
* 设置混流视频预览参数
|
|
205
166
|
*
|
|
@@ -365,12 +326,6 @@ class TRTCMediaMixingManager {
|
|
|
365
326
|
setCameraCaptureParam(cameraID, params) {
|
|
366
327
|
this.nodeMediaMixingPlugin.setCameraCaptureParam(cameraID, params);
|
|
367
328
|
}
|
|
368
|
-
setPhoneMirrorParam(phoneMirrorSourceId, param) {
|
|
369
|
-
this.nodeMediaMixingPlugin.setPhoneMirrorParam(phoneMirrorSourceId, param);
|
|
370
|
-
}
|
|
371
|
-
setScreenCaptureProperty(screenOrWindowID, property) {
|
|
372
|
-
this.nodeMediaMixingPlugin.setScreenCaptureProperty(screenOrWindowID, property);
|
|
373
|
-
}
|
|
374
329
|
/**
|
|
375
330
|
* 开始推流
|
|
376
331
|
* @returns {Promise<void>}
|
|
@@ -603,64 +558,6 @@ class TRTCMediaMixingManager {
|
|
|
603
558
|
});
|
|
604
559
|
});
|
|
605
560
|
}
|
|
606
|
-
handleCppCallbackEvent(args) {
|
|
607
|
-
logger_1.default.log(`${this.logPrefix} event:`, args);
|
|
608
|
-
const key = args[0];
|
|
609
|
-
const data = args[1];
|
|
610
|
-
// To do: 待完善
|
|
611
|
-
switch (key) {
|
|
612
|
-
case TRTCMediaMixingEvent.onMediaSourceSizeChanged:
|
|
613
|
-
this.onMediaSourceSizeChanged(data);
|
|
614
|
-
break;
|
|
615
|
-
case "onPhoneMirrorSourceChanged":
|
|
616
|
-
this.onPhoneMirrorSourceChanged(data);
|
|
617
|
-
break;
|
|
618
|
-
default:
|
|
619
|
-
break;
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
onMediaSourceSizeChanged(data) {
|
|
623
|
-
var _a;
|
|
624
|
-
const index = this.findMediaSourceIndex(data);
|
|
625
|
-
if (index !== -1) {
|
|
626
|
-
let mediaSource = this.sourceList[index];
|
|
627
|
-
mediaSource = (0, utils_1.safelyParse)(JSON.stringify(mediaSource));
|
|
628
|
-
const size = {
|
|
629
|
-
width: data.width,
|
|
630
|
-
height: data.height,
|
|
631
|
-
};
|
|
632
|
-
(_a = this.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit(TRTCMediaMixingEvent.onMediaSourceSizeChanged, mediaSource, size);
|
|
633
|
-
}
|
|
634
|
-
else {
|
|
635
|
-
logger_1.default.warn(`${this.logPrefix}onMediaSourceSizeChanged media source not existed:`, data);
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
onPhoneMirrorSourceChanged(data) {
|
|
639
|
-
var _a, _b, _c, _d;
|
|
640
|
-
const { phoneMirrorSource, state } = data;
|
|
641
|
-
if (state !== undefined && state !== null) {
|
|
642
|
-
switch (state) {
|
|
643
|
-
case 0:
|
|
644
|
-
(_a = this.eventEmitter) === null || _a === void 0 ? void 0 : _a.emit(TRTCMediaMixingEvent.onSourcePlugged, phoneMirrorSource, 'Plugged');
|
|
645
|
-
break;
|
|
646
|
-
case 1:
|
|
647
|
-
(_b = this.eventEmitter) === null || _b === void 0 ? void 0 : _b.emit(TRTCMediaMixingEvent.onSourceConnected, phoneMirrorSource, 'Connected');
|
|
648
|
-
break;
|
|
649
|
-
case 2:
|
|
650
|
-
(_c = this.eventEmitter) === null || _c === void 0 ? void 0 : _c.emit(TRTCMediaMixingEvent.onSourceDisconnected, phoneMirrorSource, 'Disconnected');
|
|
651
|
-
break;
|
|
652
|
-
case 3:
|
|
653
|
-
(_d = this.eventEmitter) === null || _d === void 0 ? void 0 : _d.emit(TRTCMediaMixingEvent.onSourceUnplugged, phoneMirrorSource, 'Unplugged');
|
|
654
|
-
break;
|
|
655
|
-
default:
|
|
656
|
-
logger_1.default.warn(`${this.logPrefix}onPhoneMirrorSourceChanged invalid data:`, data);
|
|
657
|
-
break;
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
else {
|
|
661
|
-
logger_1.default.warn(`${this.logPrefix}onPhoneMirrorSourceChanged invalid data:`, data);
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
561
|
// ****** 这一部分接口暴露不合理,暂时不对暴露在 API 文档上 **************/
|
|
665
562
|
startCameraDeviceTest(windowID, rect) {
|
|
666
563
|
var _a;
|
package/liteav/trtc.js
CHANGED
|
@@ -225,7 +225,6 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
225
225
|
this.videoRenderFPS = 60;
|
|
226
226
|
this.onFPSChanged = this.onFPSChanged.bind(this);
|
|
227
227
|
VideoRenderFPSMonitor_1.videoRenderFPSMonitor.on('videoRenderFPS', this.onFPSChanged);
|
|
228
|
-
this.callExperimentalAPI("{\"api\":\"setCurrentEnvironment\",\"params\" :{\"electron\":true}}");
|
|
229
228
|
this._localVideoRenderCallback = this._localVideoRenderCallback.bind(this);
|
|
230
229
|
this._remoteVideoRenderCallback = this._remoteVideoRenderCallback.bind(this);
|
|
231
230
|
this.localVideoRenderController = new LocalVideoRenderController_1.default(this);
|
|
@@ -259,6 +258,15 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
259
258
|
}
|
|
260
259
|
TRTCCloud.subInstances.push(this);
|
|
261
260
|
}
|
|
261
|
+
this.callExperimentalAPI("{\"api\":\"setCurrentEnvironment\",\"params\" :{\"electron\":true}}");
|
|
262
|
+
if (this._isMacPlatform()) {
|
|
263
|
+
this.callExperimentalAPI(JSON.stringify({
|
|
264
|
+
api: "setDirectCallback",
|
|
265
|
+
params: {
|
|
266
|
+
"direct_callback": true,
|
|
267
|
+
}
|
|
268
|
+
}));
|
|
269
|
+
}
|
|
262
270
|
}
|
|
263
271
|
/**
|
|
264
272
|
* 创建 TRTCCloud 主实例对象(单例模式)
|
package/package.json
CHANGED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { TRTCVideoRotation, TRTCVideoFillMode, TRTCVideoMirrorType, TRTCVideoEncParam, TRTCCameraCaptureParams, Rect, TRTCScreenCaptureProperty } from '../../trtc_define';
|
|
2
|
-
export declare enum TRTCMediaMixingErrorCode {
|
|
3
|
-
Success = 0,
|
|
4
|
-
Error = -1,
|
|
5
|
-
InvalidParams = -2,
|
|
6
|
-
NotFoundSource = -3,
|
|
7
|
-
ImageSourceLoadFailed = -4,
|
|
8
|
-
CameraNotAuthorized = -5,
|
|
9
|
-
CameraIsOccupied = -6,
|
|
10
|
-
CameraDisconnected = -7
|
|
11
|
-
}
|
|
12
|
-
export declare enum TRTCMediaSourceType {
|
|
13
|
-
kCamera = 0,
|
|
14
|
-
kScreen = 1,
|
|
15
|
-
kImage = 2,
|
|
16
|
-
kPhoneMirror = 4
|
|
17
|
-
}
|
|
18
|
-
export declare type TRTCPhoneMirrorParam = {
|
|
19
|
-
platformType: number;
|
|
20
|
-
connectType: number;
|
|
21
|
-
deviceId: string;
|
|
22
|
-
deviceName: string;
|
|
23
|
-
placeholderImagePath: string;
|
|
24
|
-
frameRate: number;
|
|
25
|
-
bitrateKbps: number;
|
|
26
|
-
};
|
|
27
|
-
export declare type TRTCMediaSource = {
|
|
28
|
-
sourceType: TRTCMediaSourceType;
|
|
29
|
-
sourceId: string;
|
|
30
|
-
zOrder: number;
|
|
31
|
-
enableGreenScreen?: boolean;
|
|
32
|
-
rect: Rect;
|
|
33
|
-
isSelected?: boolean;
|
|
34
|
-
rotation?: TRTCVideoRotation;
|
|
35
|
-
fillMode?: TRTCVideoFillMode;
|
|
36
|
-
mirrorType?: TRTCVideoMirrorType;
|
|
37
|
-
};
|
|
38
|
-
export declare type TRTCMediaMixingEncParam = {
|
|
39
|
-
videoEncoderParams: TRTCVideoEncParam;
|
|
40
|
-
canvasColor: number;
|
|
41
|
-
selectedBorderColor?: number | 0xFFFF00;
|
|
42
|
-
};
|
|
43
|
-
export interface ITRTCMediaMixingManager {
|
|
44
|
-
addMediaSource(mediaSource: TRTCMediaSource): Promise<Rect>;
|
|
45
|
-
removeMediaSource(mediaSource: TRTCMediaSource): Promise<void>;
|
|
46
|
-
updateMediaSource(mediaSource: TRTCMediaSource): Promise<void>;
|
|
47
|
-
setCameraCaptureParam(cameraID: string, param: TRTCCameraCaptureParams): void;
|
|
48
|
-
setPhoneMirrorParam(phoneMirrorSourceId: string, param: TRTCPhoneMirrorParam): void;
|
|
49
|
-
setScreenCaptureProperty(screenWindowID: string, property: TRTCScreenCaptureProperty): void;
|
|
50
|
-
startPublish(): Promise<void>;
|
|
51
|
-
stopPublish(): Promise<void>;
|
|
52
|
-
updatePublishParams(params: TRTCMediaMixingEncParam): Promise<void>;
|
|
53
|
-
setDisplayParams(windowID: number | Uint8Array, regionOrView: HTMLElement | Rect | null): void;
|
|
54
|
-
destroy(): void;
|
|
55
|
-
on(event: string, func: (...args: any[]) => void): void;
|
|
56
|
-
off(event: string, func: (...args: any[]) => void): void;
|
|
57
|
-
}
|
|
58
|
-
export interface ITRTCMediaMixingEvent {
|
|
59
|
-
onSourceSelected(mediaSource: TRTCMediaSource | null): void;
|
|
60
|
-
onSourceMoved(mediaSource: TRTCMediaSource, rect: Rect): void;
|
|
61
|
-
onSourceResized(mediaSource: TRTCMediaSource, rect: Rect): void;
|
|
62
|
-
onRightButtonClicked(mediaSource: TRTCMediaSource | null): void;
|
|
63
|
-
onSourcePlugged(source: TRTCMediaSource | TRTCPhoneMirrorParam, detail: string): void;
|
|
64
|
-
onSourceConnected(source: TRTCMediaSource | TRTCPhoneMirrorParam, detail: string): void;
|
|
65
|
-
onSourceDisconnected(source: TRTCMediaSource | TRTCPhoneMirrorParam, detail: string): void;
|
|
66
|
-
onSourceUnplugged(source: TRTCMediaSource | TRTCPhoneMirrorParam, detail: string): void;
|
|
67
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TRTCMediaSourceType = exports.TRTCMediaMixingErrorCode = void 0;
|
|
4
|
-
var TRTCMediaMixingErrorCode;
|
|
5
|
-
(function (TRTCMediaMixingErrorCode) {
|
|
6
|
-
TRTCMediaMixingErrorCode[TRTCMediaMixingErrorCode["Success"] = 0] = "Success";
|
|
7
|
-
TRTCMediaMixingErrorCode[TRTCMediaMixingErrorCode["Error"] = -1] = "Error";
|
|
8
|
-
TRTCMediaMixingErrorCode[TRTCMediaMixingErrorCode["InvalidParams"] = -2] = "InvalidParams";
|
|
9
|
-
TRTCMediaMixingErrorCode[TRTCMediaMixingErrorCode["NotFoundSource"] = -3] = "NotFoundSource";
|
|
10
|
-
TRTCMediaMixingErrorCode[TRTCMediaMixingErrorCode["ImageSourceLoadFailed"] = -4] = "ImageSourceLoadFailed";
|
|
11
|
-
TRTCMediaMixingErrorCode[TRTCMediaMixingErrorCode["CameraNotAuthorized"] = -5] = "CameraNotAuthorized";
|
|
12
|
-
TRTCMediaMixingErrorCode[TRTCMediaMixingErrorCode["CameraIsOccupied"] = -6] = "CameraIsOccupied";
|
|
13
|
-
TRTCMediaMixingErrorCode[TRTCMediaMixingErrorCode["CameraDisconnected"] = -7] = "CameraDisconnected";
|
|
14
|
-
})(TRTCMediaMixingErrorCode = exports.TRTCMediaMixingErrorCode || (exports.TRTCMediaMixingErrorCode = {}));
|
|
15
|
-
var TRTCMediaSourceType;
|
|
16
|
-
(function (TRTCMediaSourceType) {
|
|
17
|
-
TRTCMediaSourceType[TRTCMediaSourceType["kCamera"] = 0] = "kCamera";
|
|
18
|
-
TRTCMediaSourceType[TRTCMediaSourceType["kScreen"] = 1] = "kScreen";
|
|
19
|
-
TRTCMediaSourceType[TRTCMediaSourceType["kImage"] = 2] = "kImage";
|
|
20
|
-
TRTCMediaSourceType[TRTCMediaSourceType["kPhoneMirror"] = 4] = "kPhoneMirror";
|
|
21
|
-
})(TRTCMediaSourceType = exports.TRTCMediaSourceType || (exports.TRTCMediaSourceType = {}));
|