trtc-electron-sdk 11.3.502-beta.5 → 11.3.502-beta.6
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/trtc.d.ts +7 -1
- package/liteav/trtc.js +22 -0
- package/liteav/trtc_define.d.ts +6 -0
- package/liteav/trtc_define.js +9 -0
- package/package.json +5 -1
- package/scripts/download.js +0 -3
- package/scripts/postinstall.js +46 -0
package/liteav/trtc.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { VodPlayer } from './vod_player';
|
|
4
|
-
import { AudioMusicParam, Rect, TRTCAppScene, TRTCAudioEffectParam, TRTCAudioQuality, TRTCBeautyStyle, TRTCDeviceState, TRTCDeviceType, TRTCLogLevel, TRTCRenderParams, TRTCRoleType, TRTCSwitchRoomParam, TRTCVideoBufferType, TRTCVideoFillMode, TRTCVideoPixelFormat, TRTCVideoRotation, TRTCVideoStreamType, TRTCWaterMarkSrcType, PluginInfo, TRTCAudioRecordingParams, TRTCScreenCaptureSourceInfo, TRTCScreenCaptureProperty, TRTCSpeedTestParams, TRTCRecordType, TRTCDeviceInfo, TRTCCameraCaptureParams, TRTCImageBuffer, TRTCInitConfig } from './trtc_define';
|
|
4
|
+
import { AudioMusicParam, Rect, TRTCAppScene, TRTCAudioEffectParam, TRTCAudioQuality, TRTCBeautyStyle, TRTCDeviceState, TRTCDeviceType, TRTCLogLevel, TRTCRenderParams, TRTCRoleType, TRTCSwitchRoomParam, TRTCVideoBufferType, TRTCVideoFillMode, TRTCVideoPixelFormat, TRTCVideoRotation, TRTCVideoStreamType, TRTCWaterMarkSrcType, PluginInfo, TRTCAudioRecordingParams, TRTCScreenCaptureSourceInfo, TRTCScreenCaptureProperty, TRTCSpeedTestParams, TRTCRecordType, TRTCDeviceInfo, TRTCCameraCaptureParams, TRTCImageBuffer, TRTCInitConfig, TRTCAudioParallelParams } from './trtc_define';
|
|
5
5
|
export * from './trtc_define';
|
|
6
6
|
export * from './trtc_code';
|
|
7
7
|
export * from './vod_player';
|
|
@@ -1208,6 +1208,12 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
1208
1208
|
* 如果录制任务在退出房间前尚未通过本接口停止,则退出房间后录音任务会自动被停止。
|
|
1209
1209
|
*/
|
|
1210
1210
|
stopLocalRecording(): void;
|
|
1211
|
+
/**
|
|
1212
|
+
* 设置远端音频流智能并发播放策略
|
|
1213
|
+
*
|
|
1214
|
+
* @param {TRTCAudioParallelParams} - 指定用户必定能并发播放。
|
|
1215
|
+
*/
|
|
1216
|
+
setRemoteAudioParallelParams(param: TRTCAudioParallelParams): void;
|
|
1211
1217
|
/**
|
|
1212
1218
|
* 开启本地音频的采集和上行
|
|
1213
1219
|
*
|
package/liteav/trtc.js
CHANGED
|
@@ -2367,6 +2367,28 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2367
2367
|
stopLocalRecording() {
|
|
2368
2368
|
this.rtcCloud.stopLocalRecording();
|
|
2369
2369
|
}
|
|
2370
|
+
/**
|
|
2371
|
+
* 设置远端音频流智能并发播放策略
|
|
2372
|
+
*
|
|
2373
|
+
* @param {TRTCAudioParallelParams} - 指定用户必定能并发播放。
|
|
2374
|
+
*/
|
|
2375
|
+
setRemoteAudioParallelParams(param) {
|
|
2376
|
+
if (param.maxCount < 0) {
|
|
2377
|
+
throw new Error("maxCount must be greater or equal 0");
|
|
2378
|
+
}
|
|
2379
|
+
if (Array.isArray(param.includeUsers) && param.includeUsers.length >= 1) {
|
|
2380
|
+
const includeUsersFilterArray = param.includeUsers.filter(item => {
|
|
2381
|
+
return typeof item === 'string';
|
|
2382
|
+
});
|
|
2383
|
+
this.rtcCloud.setRemoteAudioParallelParams({
|
|
2384
|
+
maxCount: param.maxCount,
|
|
2385
|
+
includeUsers: includeUsersFilterArray
|
|
2386
|
+
});
|
|
2387
|
+
}
|
|
2388
|
+
else {
|
|
2389
|
+
throw new Error('includeUsers must be Array<String> type and not empty');
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2370
2392
|
/////////////////////////////////////////////////////////////////////////////////
|
|
2371
2393
|
//
|
|
2372
2394
|
// (四)音频相关接口函数
|
package/liteav/trtc_define.d.ts
CHANGED
|
@@ -84,6 +84,12 @@ export declare enum TRTCRecordType {
|
|
|
84
84
|
/** 同时录制音频、视频 */
|
|
85
85
|
TRTCRecordTypeBoth = 2
|
|
86
86
|
}
|
|
87
|
+
export type TRTCAudioParallelParams = {
|
|
88
|
+
/** 最大并发播放数。默认值:0 */
|
|
89
|
+
maxCount: number;
|
|
90
|
+
/** 指定用户必定能并发播放 */
|
|
91
|
+
includeUsers: Array<string>;
|
|
92
|
+
};
|
|
87
93
|
export declare enum TRTCAppScene {
|
|
88
94
|
TRTCAppSceneVideoCall = 0,
|
|
89
95
|
TRTCAppSceneLIVE = 1,
|
package/liteav/trtc_define.js
CHANGED
|
@@ -338,6 +338,15 @@ var TRTCRecordType;
|
|
|
338
338
|
/** 同时录制音频、视频 */
|
|
339
339
|
TRTCRecordType[TRTCRecordType["TRTCRecordTypeBoth"] = 2] = "TRTCRecordTypeBoth";
|
|
340
340
|
})(TRTCRecordType = exports.TRTCRecordType || (exports.TRTCRecordType = {}));
|
|
341
|
+
/**
|
|
342
|
+
* 设置远端音频流智能并发播放策略
|
|
343
|
+
*
|
|
344
|
+
* @typedef {Object} TRTCAudioParallelParam
|
|
345
|
+
* @property {Number} maxCount - 最大并发播放数
|
|
346
|
+
* @property {Array<String>} includeUsers - 指定用户必定能并发播放
|
|
347
|
+
*
|
|
348
|
+
*/
|
|
349
|
+
const TRTCAudioParallelParams_HACK_JSDOC = null;
|
|
341
350
|
/////////////////////////////////////////////////////////////////////////////////
|
|
342
351
|
//
|
|
343
352
|
// 【(二)网络相关枚举值定义】
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trtc-electron-sdk",
|
|
3
|
-
"version": "11.3.502-beta.
|
|
3
|
+
"version": "11.3.502-beta.6",
|
|
4
4
|
"description": "trtc electron sdk",
|
|
5
5
|
"main": "./liteav/trtc.js",
|
|
6
6
|
"types": "./liteav/trtc.d.ts",
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
"yuv-canvas": "^1.2.6",
|
|
19
19
|
"hpagent": "^1.2.0"
|
|
20
20
|
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"electron": ">=4.0.0"
|
|
23
|
+
},
|
|
21
24
|
"devDependencies": {
|
|
22
25
|
"@babel/cli": "^7.11.6",
|
|
23
26
|
"@babel/core": "^7.11.6",
|
|
@@ -37,6 +40,7 @@
|
|
|
37
40
|
"scripts": {
|
|
38
41
|
"download": "node ./scripts/download.js",
|
|
39
42
|
"install": "npm run download",
|
|
43
|
+
"postinstall": "node ./scripts/postinstall.js",
|
|
40
44
|
"build": "npm run build:types && npm run build:js && npm run copy:types",
|
|
41
45
|
"build:types": "rimraf ./types && tsc -p dtsconfig.json",
|
|
42
46
|
"build:js": "rimraf ./liteav && tsc -p tsconfig.json",
|
package/scripts/download.js
CHANGED
|
@@ -142,9 +142,6 @@ const main = () => {
|
|
|
142
142
|
);
|
|
143
143
|
signale.success(`copy success! - mac ${anotherArch}`);
|
|
144
144
|
|
|
145
|
-
// Mac 下完成文件下载后,执行该命令,同步文件到 Electron 目录下
|
|
146
|
-
exec(`rsync -a ../../node_modules/trtc-electron-sdk/build/mac-framework/${archType}/ ../../node_modules/electron/dist/Electron.app/Contents/Frameworks`);
|
|
147
|
-
|
|
148
145
|
rimraf.sync(outputDir);
|
|
149
146
|
})
|
|
150
147
|
.catch(err => {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const { exec } = require('child_process');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const { arch, platform } = process;
|
|
5
|
+
|
|
6
|
+
let retryCount = 0;
|
|
7
|
+
const retryInterval = 5000; // ms
|
|
8
|
+
const maxRetryCount = 60;
|
|
9
|
+
|
|
10
|
+
function rsync() {
|
|
11
|
+
if (platform === 'darwin') {
|
|
12
|
+
const sourcePath = path.join(__dirname, `../../trtc-electron-sdk/build/mac-framework/${arch}/`);
|
|
13
|
+
const targetPath = path.join(__dirname, '../../electron/dist/Electron.app/Contents/Frameworks');
|
|
14
|
+
|
|
15
|
+
if (targetPath.indexOf("node_modules") === -1) {
|
|
16
|
+
// SDK 本身安装,不用同步动态库,直接退出
|
|
17
|
+
console.warn(`trtc-electron-sdk self install do not need 'rsync'`);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
retryCount++;
|
|
22
|
+
if (fs.existsSync(targetPath)) {
|
|
23
|
+
const command = `rsync -a ${sourcePath} ${targetPath}`;
|
|
24
|
+
console.log(command);
|
|
25
|
+
exec(command);
|
|
26
|
+
} else {
|
|
27
|
+
if (retryCount <= maxRetryCount) {
|
|
28
|
+
setTimeout(rsync, retryInterval);
|
|
29
|
+
} else {
|
|
30
|
+
const errorMessage = `
|
|
31
|
+
'trtc-electron-sdk' 安装失败,请先确认 'Electron' 已安装,再执行 'npm install trtc-electron-sdk' 命令重新安装一次。
|
|
32
|
+
Failed to install trtc-electron-sdk correctly, please make sure that 'Electron' has been installed, then run 'npm install trtc-electron-sdk' command to try again.
|
|
33
|
+
|
|
34
|
+
more detail:
|
|
35
|
+
trtc-electron-sdk postinstall cwd: ${process.cwd()}
|
|
36
|
+
__dirname: ${__dirname}
|
|
37
|
+
sourcePath: ${sourcePath}
|
|
38
|
+
targetPath: ${targetPath}
|
|
39
|
+
`;
|
|
40
|
+
console.error(errorMessage);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
rsync();
|