trtc-electron-sdk 12.2.703-beta.0 → 12.2.703-beta.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.
@@ -0,0 +1,350 @@
1
+ import { V2LiveRotation, V2LiveFillMode, V2LiveAudioQuality, V2LiveVideoEncoderParam, V2LiveMirrorType, V2LiveMode, V2LivePusherEvent } from '../live_define';
2
+ import { TRTCDeviceInfo, TRTCDeviceType } from '../../trtc_define';
3
+ /**
4
+ * 腾讯云直播推流器
5
+ *
6
+ * @example
7
+ *
8
+ * // 创建/销毁 V2LivePusher 对象,以及回调事件监听。
9
+ *
10
+ * import { V2LivePusher } from 'trtc-electron-sdk';
11
+ * const livePusher = V2LivePusher.createV2LivePusher(V2LiveMode.V2LiveModeRTMP);
12
+ *
13
+ * subscribeEvents = (livePusher) => {
14
+ * livePusher.on('onError', (errcode, errmsg) => {
15
+ * console.info('livePusher_demo: onError :' + errcode + " msg" + errmsg);
16
+ * });
17
+ * };
18
+ *
19
+ * V2LivePusher.releaseV2LivePusher(livePusher);
20
+ *
21
+ */
22
+ export declare class V2LivePusher {
23
+ private livePusher;
24
+ private deviceManager;
25
+ private pusherVideoRender;
26
+ private cameraTestVideoRender;
27
+ private pixelFormat;
28
+ private eventEmitter;
29
+ private logger;
30
+ /**
31
+ * 创建 V2LivePusher 实例
32
+ *
33
+ * @param {V2LiveMode} mode - 推流模式,参考 V2LiveMode 的定义。
34
+ * @return {V2LivePusher} - 推流器实例
35
+ */
36
+ static createV2LivePusher(mode: V2LiveMode): V2LivePusher;
37
+ /**
38
+ * 析构 V2LivePusher 对象
39
+ *
40
+ * @param {V2LivePusher} v2livepusher - 推流器实例
41
+ */
42
+ static releaseV2LivePusher(livePusher: V2LivePusher): void;
43
+ private constructor();
44
+ destroy(): void;
45
+ /**
46
+ * 监听 LivePusher 对象事件。
47
+ *
48
+ * @param {V2LivePusherEvent} event - 事件名称。
49
+ * @param {Function} listener - 事件回调函数。
50
+ */
51
+ on(event: V2LivePusherEvent | symbol, listener: (...args: any[]) => void): void;
52
+ /**
53
+ * 取消监听 LivePusher 对象事件。
54
+ *
55
+ * @param {V2LivePusherEvent} event - 事件名称。
56
+ * @param {Function} listener - 事件回调函数。
57
+ */
58
+ off(event: V2LivePusherEvent | symbol, listener: (...args: any[]) => void): void;
59
+ /**
60
+ * 设置本地摄像头预览 View, 本地摄像头采集到的画面,最终会显示到传入的 View 上。
61
+ *
62
+ * @param {HTMLElement | null} view - 本地摄像头预览 View。
63
+ */
64
+ setRenderView(view: HTMLElement | null): void;
65
+ /**
66
+ * 设置本地摄像头预览镜像
67
+ * @param {V2LiveMirrorType} mirrorType - 摄像头镜像类型, 默认值为 V2LiveMirrorTypeAuto。
68
+ * V2LiveMirrorTypeEnable 前置摄像头 和 后置摄像头,都切换为镜像模式。
69
+ * V2LiveMirrorTypeDisable 前置摄像头 和 后置摄像头,都切换为非镜像模式。
70
+ *
71
+ * @return {Number} - 参考 V2LiveCode 的定义
72
+ */
73
+ setRenderMirror(mirrorType: V2LiveMirrorType): number;
74
+ /**
75
+ * 设置视频编码镜像,默认不开启。
76
+ * 编码镜像只影响观众端看到的视频效果
77
+ *
78
+ * @param {Boolean} mirror - 是否镜像。
79
+ * @return {Number} - 参考 V2LiveCode 的定义
80
+ */
81
+ setEncoderMirror(mirror: boolean): number;
82
+ /**
83
+ * 设置本地摄像头预览画面的旋转角度, 默认不旋转。
84
+ * 只旋转本地预览画面,不影响推流出去的画面
85
+ *
86
+ * @param {V2LiveRotation} rotation - 预览画面的旋转角度, 参考 V2LiveRotation 的定义。
87
+ * @return {Number} - 参考 V2LiveCode 的定义
88
+ */
89
+ setRenderRotation(rotation: V2LiveRotation): number;
90
+ /**
91
+ * 设置本地摄像头预览画面的填充模式
92
+ *
93
+ * @param {V2LiveFillMode} mode - 画面填充模式,参考 V2LiveFillMode 的定义。
94
+ * @return {Number} - 参考 V2LiveCode 的定义
95
+ */
96
+ setRenderFillMode(mode: V2LiveFillMode): number;
97
+ /**
98
+ * 打开本地摄像头
99
+ *
100
+ * @param {String} cameraId - 摄像头ID,可通过 getCameraDevicesList 获取。
101
+ * @return {Number} - 参考 V2LiveCode 的定义
102
+ */
103
+ startCamera(cameraId: string): number;
104
+ /**
105
+ * 关闭本地摄像头
106
+ *
107
+ * @return {Number} - 参考 V2LiveCode 的定义
108
+ */
109
+ stopCamera(): number;
110
+ /**
111
+ * 打开麦克风
112
+ *
113
+ * @return {Number} - 参考 V2LiveCode 的定义
114
+ */
115
+ startMicrophone(): number;
116
+ /**
117
+ * 关闭麦克风
118
+ *
119
+ * @return {Number} - 参考 V2LiveCode 的定义
120
+ */
121
+ stopMicrophone(): number;
122
+ /**
123
+ * 暂停推流器的音频流
124
+ *
125
+ * @return {Number} - 参考 V2LiveCode 的定义
126
+ */
127
+ pauseAudio(): number;
128
+ /**
129
+ * 恢复推流器的音频流
130
+ *
131
+ * @return {Number} - 参考 V2LiveCode 的定义
132
+ */
133
+ resumeAudio(): number;
134
+ /**
135
+ * 暂停推流器的视频流
136
+ *
137
+ * @return {Number} - 参考 V2LiveCode 的定义
138
+ */
139
+ pauseVideo(): number;
140
+ /**
141
+ * 恢复推流器的视频流
142
+ *
143
+ * @return {Number} - 参考 V2LiveCode 的定义
144
+ */
145
+ resumeVideo(): number;
146
+ /**
147
+ * 开始音视频数据推流
148
+ *
149
+ * @param {String} url - 推流的目标地址,支持任意推流服务端。
150
+ * @return {Number} - 参考 V2LiveCode 的定义
151
+ */
152
+ startPush(url: string): number;
153
+ /**
154
+ * 停止推送音视频数据
155
+ *
156
+ * @return {Number} - 参考 V2LiveCode 的定义
157
+ */
158
+ stopPush(): number;
159
+ /**
160
+ * 当前推流器是否正在推流中
161
+ *
162
+ * @return {Number} - 参考 V2LiveCode 的定义
163
+ */
164
+ isPushing(): number;
165
+ /**
166
+ * 设置推流音频质量
167
+ *
168
+ * @param {V2LiveAudioQuality} quality - 音频质量,参考 V2LiveAudioQuality 的定义。
169
+ * @return {Number} - 参考 V2LiveCode 的定义
170
+ */
171
+ setAudioQuality(quality: V2LiveAudioQuality): number;
172
+ /**
173
+ * 设置推流视频编码参数
174
+ *
175
+ * @param {V2LiveVideoEncoderParam} param - 视频编码参数,参考 V2LiveVideoEncoderParam 的定义。
176
+ * @return {Number} - 参考 V2LiveCode 的定义
177
+ */
178
+ setVideoQuality(param: V2LiveVideoEncoderParam): number;
179
+ /**
180
+ * 启用采集音量大小提示
181
+ *
182
+ * @param {Number} intervalMs - 决定了 onMicrophoneVolumeUpdate 回调的触发间隔,单位为ms,最小间隔为100ms,如果小于等于0则会关闭回调,建议设置为300ms;【默认值】:0,不开启。
183
+ * @return {Number} - 参考 V2LiveCode 的定义
184
+ */
185
+ enableVolumeEvaluation(intervalMs: number): number;
186
+ /**
187
+ * 获取摄像头设备列表
188
+ *
189
+ * @example
190
+ * var cameralist = livePusher.getCameraDevicesList();
191
+ * for (i=0;i<cameralist.length;i++) {
192
+ * var camera = cameralist[i];
193
+ * console.info("camera deviceName: " + camera.deviceName + " deviceId:" + camera.deviceId);
194
+ * }
195
+ * @return {Array<TRTCDeviceInfo>} 摄像头管理器列表
196
+ */
197
+ getCameraDevicesList(): Array<TRTCDeviceInfo>;
198
+ /**
199
+ * 设置要使用的摄像头
200
+ *
201
+ * @param {String} deviceId - 从 getCameraDevicesList 中得到的设备 ID
202
+ */
203
+ setCurrentCameraDevice(deviceId: string): void;
204
+ /**
205
+ * 获取当前使用的摄像头
206
+ *
207
+ * @return {TRTCDeviceInfo} 设备信息,能获取设备 ID 和设备名称
208
+ */
209
+ getCurrentCameraDevice(): TRTCDeviceInfo;
210
+ /**
211
+ * 开始摄像头测试
212
+ *
213
+ * @param {HTMLElement} view - 摄像头测试的显示区域
214
+ */
215
+ startCameraDeviceTest(view: HTMLElement): void;
216
+ /**
217
+ * 停止摄像头测试
218
+ */
219
+ stopCameraDeviceTest(): void;
220
+ /**
221
+ * 获取麦克风设备列表
222
+ *
223
+ * @example
224
+ * var miclist = livePusher.getMicDevicesList();
225
+ * for (i=0;i<miclist.length;i++) {
226
+ * var mic = miclist[i];
227
+ * console.info("mic deviceName: " + mic.deviceName + " deviceId:" + mic.deviceId);
228
+ * }
229
+ * @return {Array<TRTCDeviceInfo>} 麦克风管理器列表
230
+ */
231
+ getMicDevicesList(): Array<TRTCDeviceInfo>;
232
+ /**
233
+ * 获取当前选择的麦克风
234
+ *
235
+ * @return {TRTCDeviceInfo} 设备信息,能获取设备 ID 和设备名称
236
+ */
237
+ getCurrentMicDevice(): TRTCDeviceInfo;
238
+ /**
239
+ * 设置要使用的麦克风
240
+ *
241
+ * 选择指定的麦克风作为录音设备,不调用该接口时,默认选择索引为0的麦克风
242
+ *
243
+ * @param {String} micId - 从 getMicDevicesList 中得到的设备 ID
244
+ */
245
+ setCurrentMicDevice(micId: string): void;
246
+ /**
247
+ * 获取系统当前麦克风设备音量
248
+ *
249
+ * 注意:查询的是系统硬件音量大小。
250
+ * @return {Number} 音量值,范围是0 - 100
251
+ */
252
+ getCurrentMicDeviceVolume(): number;
253
+ /**
254
+ * 设置系统当前麦克风设备的音量
255
+ *
256
+ * 注意:该接口的功能是调节系统采集音量,如果用户直接调节系统设置的采集音量时,该接口的设置结果会被用户的操作所覆盖。
257
+ * @param {Number} volume - 麦克风音量值,范围0 - 100
258
+ */
259
+ setCurrentMicDeviceVolume(volume: number): void;
260
+ /**
261
+ * 设置系统当前麦克风设备的静音状态
262
+ *
263
+ * @param {Boolean} mute 设置为 true 时,麦克风设备静音;设置为 false时,麦克风设备取消静音
264
+ */
265
+ setCurrentMicDeviceMute(mute: boolean): void;
266
+ /**
267
+ * 获取系统当前麦克风设备是否静音
268
+ *
269
+ * @return {Boolean} 静音状态
270
+ */
271
+ getCurrentMicDeviceMute(): boolean;
272
+ /**
273
+ * 获取扬声器设备列表
274
+ *
275
+ * @example
276
+ * var speakerlist = livePusher.getSpeakerDevicesList();
277
+ * for (i=0;i<speakerlist.length;i++) {
278
+ * var speaker = speakerlist[i];
279
+ * console.info("mic deviceName: " + speaker.deviceName + " deviceId:" + speaker.deviceId);
280
+ * }
281
+ * @return {Array<TRTCDeviceInfo>} 扬声器管理器列表
282
+ */
283
+ getSpeakerDevicesList(): Array<TRTCDeviceInfo>;
284
+ /**
285
+ * 获取当前的扬声器设备
286
+ *
287
+ * @return {TRTCDeviceInfo} 设备信息,能获取设备 ID 和设备名称
288
+ */
289
+ getCurrentSpeakerDevice(): TRTCDeviceInfo;
290
+ /**
291
+ * 设置要使用的扬声器
292
+ *
293
+ * @param {String} speakerId - 从 getSpeakerDevicesList 中得到的设备 ID
294
+ */
295
+ setCurrentSpeakerDevice(speakerId: string): void;
296
+ /**
297
+ * 获取系统当前扬声器设备音量
298
+ *
299
+ * @return {Number} 扬声器音量,范围0 - 100
300
+ */
301
+ getCurrentSpeakerVolume(): number;
302
+ /**
303
+ * 设置系统当前扬声器设备音量
304
+ *
305
+ * 注意:该接口的功能是调节系统播放音量,如果用户直接调节系统设置的播放音量时,该接口的设置结果会被用户的操作所覆盖。
306
+ *
307
+ * @param {Number} volume - 设置的扬声器音量,范围0 - 100
308
+ */
309
+ setCurrentSpeakerVolume(volume: number): void;
310
+ /**
311
+ * 设置系统当前扬声器设备的静音状态
312
+ *
313
+ * @param {Boolean} mute 设置为 true 时,扬声器设备静音;设置为 false时,扬声器设备取消静音
314
+ */
315
+ setCurrentSpeakerDeviceMute(mute: boolean): void;
316
+ /**
317
+ * 获取系统当前扬声器设备是否静音
318
+ *
319
+ * @return {Boolean} 静音状态
320
+ */
321
+ getCurrentSpeakerDeviceMute(): boolean;
322
+ /**
323
+ * 设置 SDK 使用的音频设备自动跟随系统默认设备
324
+ *
325
+ * 仅支持设置麦克风和扬声器类型,摄像头暂不支持跟随系统默认设备
326
+ *
327
+ * @param {TRTCDeviceType} deviceType - 设备类型,只支持麦克风和扬声器,摄像头不支持
328
+ * @param {Boolean} enable - 是否跟随系统默认的音频设备
329
+ * - true: 跟随。当系统默认音频设备发生改变时,SDK 立即切换音频设备。
330
+ * - false: 不跟随。只有当 SDK 使用的音频设备被移除后或插入新的音频设备为系统默认设备时,SDK 才切换至系统默认的音频设备。
331
+ */
332
+ enableFollowingDefaultAudioDevice(deviceType: TRTCDeviceType, enable: boolean): void;
333
+ private enableCustomVideoRender;
334
+ private _initPusherRender;
335
+ private _destroyPusherRender;
336
+ private _setVideoRenderBuffer;
337
+ private _addVideoRenderCallback;
338
+ private _removeVideoRenderCallback;
339
+ private _pusherVideoRenderCallback;
340
+ private _cameraTestVideoRenderCallback;
341
+ private initObserver;
342
+ fire(event: string, ...args: any): void;
343
+ private handleOnError;
344
+ private handleOnWarning;
345
+ private handleOnCaptureFirstAudioFrame;
346
+ private handleOnCaptureFirstVideoFrame;
347
+ private handleOnMicrophoneVolumeUpdate;
348
+ private handleOnPushStatusUpdate;
349
+ private handleOnStatisticsUpdate;
350
+ }