trtc-electron-sdk 11.9.606-beta.9 → 12.0.606
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 +70 -0
- package/liteav/trtc.d.ts +7 -7
- package/liteav/trtc.js +5 -5
- package/liteav/trtc_define.d.ts +4 -16
- package/liteav/trtc_define.js +23 -7
- package/liteav/vod_player.d.ts +0 -1
- package/liteav/vod_player.js +0 -3
- package/package.json +8 -2
- package/scripts/utils.js +17 -20
package/README.md
CHANGED
|
@@ -47,6 +47,12 @@ Properties detail:
|
|
|
47
47
|
npm install trtc-electron-sdk
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
## ⚠️ Notice
|
|
51
|
+
You can build Electron application for Windows and macOS on macOS.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
On Windows you can only build Electron application for Windows.Can't build Electron application for macOS, for detail:https://www.electron.build/multi-platform-build.
|
|
55
|
+
|
|
50
56
|
## 👋 Usage
|
|
51
57
|
```js
|
|
52
58
|
import TRTCCloud from 'trtc-electron-sdk';
|
|
@@ -56,6 +62,70 @@ const rtcCloud = TRTCCloud.getTRTCShareInstance();
|
|
|
56
62
|
const version = rtcCloud.getSDKVersion();
|
|
57
63
|
```
|
|
58
64
|
|
|
65
|
+
## 📦 Build
|
|
66
|
+
Taking webpack and electron-builder as example.
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
// webpack config
|
|
70
|
+
module.exports = {
|
|
71
|
+
...
|
|
72
|
+
|
|
73
|
+
module: {
|
|
74
|
+
rules: [
|
|
75
|
+
{
|
|
76
|
+
test: /\.node$/,
|
|
77
|
+
loader: "native-ext-loader",
|
|
78
|
+
options: {
|
|
79
|
+
emit: true,
|
|
80
|
+
rewritePath:
|
|
81
|
+
process.env.NODE_ENV === "production"
|
|
82
|
+
? process.platform === "win32"
|
|
83
|
+
? ".\\"
|
|
84
|
+
: "../"
|
|
85
|
+
: "node_modules/trtc-electron-sdk/build/Release",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
...
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
...
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// electron-builder config
|
|
96
|
+
{
|
|
97
|
+
...
|
|
98
|
+
|
|
99
|
+
"build": {
|
|
100
|
+
"win": {
|
|
101
|
+
"extraFiles": [
|
|
102
|
+
{
|
|
103
|
+
"from": "node_modules/trtc-electron-sdk/build/Release/",
|
|
104
|
+
"to": "./"
|
|
105
|
+
},
|
|
106
|
+
...
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"mac": {
|
|
110
|
+
"extraFiles": [
|
|
111
|
+
{
|
|
112
|
+
"from": "node_modules/trtc-electron-sdk/build/Release/${arch}/trtc_electron_sdk.node",
|
|
113
|
+
"to": "./"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"from": "node_modules/trtc-electron-sdk/build/mac-framework/${arch}/",
|
|
117
|
+
"to": "./Frameworks"
|
|
118
|
+
},
|
|
119
|
+
...
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
...
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
|
|
59
129
|
## 🔗 Links
|
|
60
130
|
- [Official Site](https://trtc.io/products/rtc)
|
|
61
131
|
- [API Document](https://web.sdk.qcloud.com/trtc/electron/doc/en-us/trtc_electron_sdk/index.html
|
package/liteav/trtc.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import { TRTCConfig } from './Renderer/util';
|
|
4
|
-
import { AudioMusicParam, Rect, TRTCAppScene, TRTCAudioEffectParam, TRTCAudioQuality, TRTCBeautyStyle, TRTCDeviceState, TRTCDeviceType, TRTCLogLevel, TRTCRenderParams, TRTCRoleType, TRTCSpeedTestResult, TRTCStatistics, TRTCSwitchRoomParam, TRTCVideoBufferType, TRTCVideoFillMode, TRTCAudioFrame, TRTCVideoPixelFormat, TRTCVideoRotation, TRTCVideoStreamType, TRTCVolumeInfo, TRTCWaterMarkSrcType, TRTCQualityInfo, TRTCPluginType, TRTCPluginInfo, TRTCVideoProcessPluginOptions, TRTCMediaEncryptDecryptPluginOptions, TRTCAudioRecordingParams, TRTCScreenCaptureSourceInfo, TRTCScreenCaptureProperty, TRTCSpeedTestParams, TRTCRecordType, TRTCDeviceInfo, TRTCCameraCaptureParams, TRTCImageBuffer, TRTCInitConfig, TRTCAudioParallelParams, TRTCVoiceReverbType, TRTCMusicPlayObserver, TRTCAudioFrameCallback } from './trtc_define';
|
|
4
|
+
import { AudioMusicParam, Rect, TRTCAppScene, TRTCAudioEffectParam, TRTCAudioQuality, TRTCBeautyStyle, TRTCDeviceState, TRTCDeviceType, TRTCLogLevel, TRTCRenderParams, TRTCRoleType, TRTCSpeedTestResult, TRTCStatistics, TRTCSwitchRoomParam, TRTCVideoBufferType, TRTCVideoFillMode, TRTCAudioFrame, TRTCVideoPixelFormat, TRTCVideoRotation, TRTCVideoStreamType, TRTCVolumeInfo, TRTCWaterMarkSrcType, TRTCQualityInfo, TRTCPluginType, TRTCPluginInfo, TRTCVideoProcessPluginOptions, TRTCMediaEncryptDecryptPluginOptions, TRTCAudioRecordingParams, TRTCScreenCaptureSourceInfo, TRTCScreenCaptureProperty, TRTCSpeedTestParams, TRTCRecordType, TRTCDeviceInfo, TRTCCameraCaptureParams, TRTCImageBuffer, TRTCInitConfig, TRTCAudioParallelParams, TRTCVoiceReverbType, TRTCMusicPlayObserver, TRTCAudioFrameCallback, TRTCAudioProcessPluginOptions } from './trtc_define';
|
|
5
5
|
export * from './trtc_define';
|
|
6
6
|
export * from './trtc_code';
|
|
7
7
|
export * from './vod_player';
|
|
@@ -632,12 +632,11 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
632
632
|
*/
|
|
633
633
|
handleOnLocalRecordComplete(errCode: number, storagePath: string): void;
|
|
634
634
|
/**
|
|
635
|
-
*
|
|
635
|
+
* 系统音频采集回调,SDK在采集失败时会抛出该事件回调,用于通知错误信息
|
|
636
636
|
*
|
|
637
637
|
* @event TRTCCallback#onSystemAudioLoopbackError
|
|
638
638
|
*
|
|
639
639
|
* @param {Number} errCode - 错误码含义
|
|
640
|
-
* - 0 :代表启动成功;
|
|
641
640
|
* - ERR_AUDIO_PLUGIN_START_FAIL(-1330) :开启系统声音录制失败,例如音频驱动插件不可用
|
|
642
641
|
* - ERR_AUDIO_PLUGIN_INSTALL_NOT_AUTHORIZED (-1331) :未授权安装音频驱动插件
|
|
643
642
|
* - ERR_AUDIO_PLUGIN_INSTALL_FAILED (-1332) :安装音频驱动插件失败
|
|
@@ -1027,6 +1026,7 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
1027
1026
|
* @param {Number} params.videoFps - 视频采集帧率
|
|
1028
1027
|
* @param {Number} params.videoBitrate - 视频上行码率
|
|
1029
1028
|
* @param {Number} params.minVideoBitrate - 视频最小码率
|
|
1029
|
+
* @param {Boolean} params.enableAdjustRes - 是否允许动态调整分辨率,默认值:关闭。
|
|
1030
1030
|
*/
|
|
1031
1031
|
setVideoEncoderParam(params: any): void;
|
|
1032
1032
|
/**
|
|
@@ -1631,8 +1631,8 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
1631
1631
|
* true, // enable capture mouse
|
|
1632
1632
|
* true, // enable highlight
|
|
1633
1633
|
* true, // enable high performance
|
|
1634
|
-
*
|
|
1635
|
-
*
|
|
1634
|
+
* 0xFF66FF, // highlight color.
|
|
1635
|
+
* 8, // highlight width
|
|
1636
1636
|
* false // disable capture child window
|
|
1637
1637
|
* );
|
|
1638
1638
|
*
|
|
@@ -2427,9 +2427,9 @@ declare class TRTCCloud extends EventEmitter {
|
|
|
2427
2427
|
* 调用 [addPlugin]{@link TRTCCloud#addPlugin} 接口添加插件前,需要先调用本接口设置配置参数,否则插件不会启动、运行。
|
|
2428
2428
|
*
|
|
2429
2429
|
* @param type {TRTCPluginType} - 插件类型
|
|
2430
|
-
* @param config {
|
|
2430
|
+
* @param config {TRTCVideoProcessPluginOptions | TRTCMediaEncryptDecryptPluginOptions | TRTCAudioProcessPluginOptions} - 插件配置参数
|
|
2431
2431
|
*/
|
|
2432
|
-
setPluginParams(type: TRTCPluginType, options: TRTCVideoProcessPluginOptions | TRTCMediaEncryptDecryptPluginOptions): void;
|
|
2432
|
+
setPluginParams(type: TRTCPluginType, options: TRTCVideoProcessPluginOptions | TRTCMediaEncryptDecryptPluginOptions | TRTCAudioProcessPluginOptions): void;
|
|
2433
2433
|
private _setVideoProcessPluginParams;
|
|
2434
2434
|
private _setMediaEncryptDecryptPluginParams;
|
|
2435
2435
|
private _setAudioProcessPluginParams;
|
package/liteav/trtc.js
CHANGED
|
@@ -1312,12 +1312,11 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
1312
1312
|
//
|
|
1313
1313
|
/////////////////////////////////////////////////////////////////////////////////
|
|
1314
1314
|
/**
|
|
1315
|
-
*
|
|
1315
|
+
* 系统音频采集回调,SDK在采集失败时会抛出该事件回调,用于通知错误信息
|
|
1316
1316
|
*
|
|
1317
1317
|
* @event TRTCCallback#onSystemAudioLoopbackError
|
|
1318
1318
|
*
|
|
1319
1319
|
* @param {Number} errCode - 错误码含义
|
|
1320
|
-
* - 0 :代表启动成功;
|
|
1321
1320
|
* - ERR_AUDIO_PLUGIN_START_FAIL(-1330) :开启系统声音录制失败,例如音频驱动插件不可用
|
|
1322
1321
|
* - ERR_AUDIO_PLUGIN_INSTALL_NOT_AUTHORIZED (-1331) :未授权安装音频驱动插件
|
|
1323
1322
|
* - ERR_AUDIO_PLUGIN_INSTALL_FAILED (-1332) :安装音频驱动插件失败
|
|
@@ -2121,6 +2120,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
2121
2120
|
* @param {Number} params.videoFps - 视频采集帧率
|
|
2122
2121
|
* @param {Number} params.videoBitrate - 视频上行码率
|
|
2123
2122
|
* @param {Number} params.minVideoBitrate - 视频最小码率
|
|
2123
|
+
* @param {Boolean} params.enableAdjustRes - 是否允许动态调整分辨率,默认值:关闭。
|
|
2124
2124
|
*/
|
|
2125
2125
|
setVideoEncoderParam(params) {
|
|
2126
2126
|
if (params instanceof trtc_define_1.TRTCVideoEncParam) {
|
|
@@ -3023,8 +3023,8 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
3023
3023
|
* true, // enable capture mouse
|
|
3024
3024
|
* true, // enable highlight
|
|
3025
3025
|
* true, // enable high performance
|
|
3026
|
-
*
|
|
3027
|
-
*
|
|
3026
|
+
* 0xFF66FF, // highlight color.
|
|
3027
|
+
* 8, // highlight width
|
|
3028
3028
|
* false // disable capture child window
|
|
3029
3029
|
* );
|
|
3030
3030
|
*
|
|
@@ -4243,7 +4243,7 @@ class TRTCCloud extends events_1.EventEmitter {
|
|
|
4243
4243
|
* 调用 [addPlugin]{@link TRTCCloud#addPlugin} 接口添加插件前,需要先调用本接口设置配置参数,否则插件不会启动、运行。
|
|
4244
4244
|
*
|
|
4245
4245
|
* @param type {TRTCPluginType} - 插件类型
|
|
4246
|
-
* @param config {
|
|
4246
|
+
* @param config {TRTCVideoProcessPluginOptions | TRTCMediaEncryptDecryptPluginOptions | TRTCAudioProcessPluginOptions} - 插件配置参数
|
|
4247
4247
|
*/
|
|
4248
4248
|
setPluginParams(type, options) {
|
|
4249
4249
|
this.logger.log(`setPluginParams params:`, type, options);
|
package/liteav/trtc_define.d.ts
CHANGED
|
@@ -174,7 +174,7 @@ export declare class TRTCScreenCaptureSourceInfo {
|
|
|
174
174
|
* @param {Boolean} enableCaptureMouse - 是否采集目标内容的同时采集鼠标,默认为 true
|
|
175
175
|
* @param {Boolean} enableHighLight - 是否高亮正在共享的窗口(在被分享目标周围绘制一个边框),默认为 true。
|
|
176
176
|
* @param {Boolean} enableHighPerformance - 是否开启高性能模式(只会在分享屏幕时会生效),默认为 true。【特殊说明】开启后屏幕采集性能最佳,但会丧失抗遮挡能力,如果您同时开启 enableHighLight + enableHighPerformance,远端用户可以看到高亮的边框。
|
|
177
|
-
* @param {Number} highLightColor - 指定高亮边框的颜色,RGB 格式,传入 0 时代表采用默认颜色,默认颜色为
|
|
177
|
+
* @param {Number} highLightColor - 指定高亮边框的颜色,RGB 格式,传入 0 时代表采用默认颜色,默认颜色为 0xFFE640。
|
|
178
178
|
* @param {Number} highLightWidth - 指定高亮边框的宽度,传入0时采用默认描边宽度,默认宽度为 5 像素,您可以设置的最大值为 50。
|
|
179
179
|
* @param {Boolean} enableCaptureChildWindow - 窗口采集时是否采集子窗口(需要子窗口与被采集窗口具有 Owner 或 Popup 属性),默认为 false。
|
|
180
180
|
*/
|
|
@@ -364,12 +364,9 @@ export declare class TRTCParams {
|
|
|
364
364
|
* 【特别说明】<br>
|
|
365
365
|
* - 当您把分辨率设置的比较高时,minVideoBitrate 不适合设置的太低,否则会出现画面模糊和大范围的马赛克宏块。
|
|
366
366
|
* 比如把分辨率设置为 720p,把码率设置为 200kbps,那么编码出的画面将会出现大范围区域性马赛克。
|
|
367
|
-
* @param {Boolean} enableAdjustRes -
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
* - 视频通话模式,若更关注流畅性,建议选择 YES,此时若遇到带宽有限的弱网,SDK 会自动降低分辨率以保障更好的流畅度(仅针对 TRTCVideoStreamTypeBig 生效)。
|
|
371
|
-
* - 默认值:NO。<br>
|
|
372
|
-
* 【特别说明】若有录制需求,选择 YES 时,请确保通话过程中,调整分辨率不会影响您的录制效果。<br>
|
|
367
|
+
* @param {Boolean} enableAdjustRes - 【字段含义】是否允许动态调整分辨率(开启后会对云端录制产生影响)<br>
|
|
368
|
+
* 【推荐取值】该功能适用于不需要云端录制的场景,开启后 SDK 会根据当前网络情况,智能选择出一个合适的分辨率,避免出现“大分辨率+小码率”的低效编码模式。<br>
|
|
369
|
+
* 【特别说明】默认值:关闭。如有云端录制的需求,请不要开启此功能,因为如果视频分辨率发生变化后,云端录制出的 MP4 在普通的播放器上无法正常播放。<br>
|
|
373
370
|
*/
|
|
374
371
|
export declare class TRTCVideoEncParam {
|
|
375
372
|
videoResolution: TRTCVideoResolution;
|
|
@@ -612,22 +609,13 @@ export interface PluginInfo {
|
|
|
612
609
|
setParameter: (param: string) => number;
|
|
613
610
|
}
|
|
614
611
|
export declare type TRTCPluginInfo = PluginInfo;
|
|
615
|
-
/**
|
|
616
|
-
* 视频处理插件选项
|
|
617
|
-
*/
|
|
618
612
|
export declare type TRTCVideoProcessPluginOptions = {
|
|
619
613
|
enable?: boolean;
|
|
620
614
|
pixelFormat?: TRTCVideoPixelFormat;
|
|
621
615
|
};
|
|
622
|
-
/**
|
|
623
|
-
* 音视频加解密插件选项
|
|
624
|
-
*/
|
|
625
616
|
export declare type TRTCMediaEncryptDecryptPluginOptions = {
|
|
626
617
|
enable?: boolean;
|
|
627
618
|
};
|
|
628
|
-
/**
|
|
629
|
-
* 音频自定义处理插件选项
|
|
630
|
-
*/
|
|
631
619
|
export declare type TRTCAudioProcessPluginOptions = {
|
|
632
620
|
enable?: boolean;
|
|
633
621
|
};
|
package/liteav/trtc_define.js
CHANGED
|
@@ -600,7 +600,7 @@ exports.TRTCScreenCaptureSourceInfo = TRTCScreenCaptureSourceInfo;
|
|
|
600
600
|
* @param {Boolean} enableCaptureMouse - 是否采集目标内容的同时采集鼠标,默认为 true
|
|
601
601
|
* @param {Boolean} enableHighLight - 是否高亮正在共享的窗口(在被分享目标周围绘制一个边框),默认为 true。
|
|
602
602
|
* @param {Boolean} enableHighPerformance - 是否开启高性能模式(只会在分享屏幕时会生效),默认为 true。【特殊说明】开启后屏幕采集性能最佳,但会丧失抗遮挡能力,如果您同时开启 enableHighLight + enableHighPerformance,远端用户可以看到高亮的边框。
|
|
603
|
-
* @param {Number} highLightColor - 指定高亮边框的颜色,RGB 格式,传入 0 时代表采用默认颜色,默认颜色为
|
|
603
|
+
* @param {Number} highLightColor - 指定高亮边框的颜色,RGB 格式,传入 0 时代表采用默认颜色,默认颜色为 0xFFE640。
|
|
604
604
|
* @param {Number} highLightWidth - 指定高亮边框的宽度,传入0时采用默认描边宽度,默认宽度为 5 像素,您可以设置的最大值为 50。
|
|
605
605
|
* @param {Boolean} enableCaptureChildWindow - 窗口采集时是否采集子窗口(需要子窗口与被采集窗口具有 Owner 或 Popup 属性),默认为 false。
|
|
606
606
|
*/
|
|
@@ -909,12 +909,9 @@ exports.TRTCParams = TRTCParams;
|
|
|
909
909
|
* 【特别说明】<br>
|
|
910
910
|
* - 当您把分辨率设置的比较高时,minVideoBitrate 不适合设置的太低,否则会出现画面模糊和大范围的马赛克宏块。
|
|
911
911
|
* 比如把分辨率设置为 720p,把码率设置为 200kbps,那么编码出的画面将会出现大范围区域性马赛克。
|
|
912
|
-
* @param {Boolean} enableAdjustRes -
|
|
913
|
-
*
|
|
914
|
-
*
|
|
915
|
-
* - 视频通话模式,若更关注流畅性,建议选择 YES,此时若遇到带宽有限的弱网,SDK 会自动降低分辨率以保障更好的流畅度(仅针对 TRTCVideoStreamTypeBig 生效)。
|
|
916
|
-
* - 默认值:NO。<br>
|
|
917
|
-
* 【特别说明】若有录制需求,选择 YES 时,请确保通话过程中,调整分辨率不会影响您的录制效果。<br>
|
|
912
|
+
* @param {Boolean} enableAdjustRes - 【字段含义】是否允许动态调整分辨率(开启后会对云端录制产生影响)<br>
|
|
913
|
+
* 【推荐取值】该功能适用于不需要云端录制的场景,开启后 SDK 会根据当前网络情况,智能选择出一个合适的分辨率,避免出现“大分辨率+小码率”的低效编码模式。<br>
|
|
914
|
+
* 【特别说明】默认值:关闭。如有云端录制的需求,请不要开启此功能,因为如果视频分辨率发生变化后,云端录制出的 MP4 在普通的播放器上无法正常播放。<br>
|
|
918
915
|
*/
|
|
919
916
|
class TRTCVideoEncParam {
|
|
920
917
|
constructor(videoResolution = TRTCVideoResolution.TRTCVideoResolution_640_360, resMode = TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape, videoFps = 15, videoBitrate = 550, minVideoBitrate = 0, enableAdjustRes = false) {
|
|
@@ -1317,6 +1314,25 @@ var TRTCPluginType;
|
|
|
1317
1314
|
* @property {Function} setParameter - 设置该插件的参数,返回值:0 成功,其他值表示失败,入参必须是序列化的 JSON 串,会透传到 C++ 插件层
|
|
1318
1315
|
*/
|
|
1319
1316
|
const TRTCPluginInfo_HACK_JSDOC = null;
|
|
1317
|
+
/**
|
|
1318
|
+
* 视频处理插件选项
|
|
1319
|
+
* @typedef {Object} TRTCVideoProcessPluginOptions
|
|
1320
|
+
* @property {Boolean} enable - 是否开启
|
|
1321
|
+
* @property {TRTCVideoPixelFormat} pixelFormat - 视频格式
|
|
1322
|
+
*/
|
|
1323
|
+
const TRTCVideoProcessPluginOptions_HACK_JSDOC = null;
|
|
1324
|
+
/**
|
|
1325
|
+
* 音视频加解密插件选项
|
|
1326
|
+
* @typedef {Object} TRTCMediaEncryptDecryptPluginOptions
|
|
1327
|
+
* @property {Boolean} enable - 是否开启
|
|
1328
|
+
*/
|
|
1329
|
+
const TRTCMediaEncryptDecryptPluginOptions_HACK_JSDOC = null;
|
|
1330
|
+
/**
|
|
1331
|
+
* 音频自定义处理插件选项
|
|
1332
|
+
* @typedef {Object} TRTCAudioProcessPluginOptions
|
|
1333
|
+
* @property {Boolean} enable - 是否开启
|
|
1334
|
+
*/
|
|
1335
|
+
const TRTCAudioProcessPluginOptions_HACK_JSDOC = null;
|
|
1320
1336
|
/**
|
|
1321
1337
|
* 云端混流(转码)配置
|
|
1322
1338
|
*
|
package/liteav/vod_player.d.ts
CHANGED
package/liteav/vod_player.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trtc-electron-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.606",
|
|
4
4
|
"description": "trtc electron sdk",
|
|
5
5
|
"main": "./liteav/trtc.js",
|
|
6
6
|
"types": "./liteav/trtc.d.ts",
|
|
@@ -63,7 +63,13 @@
|
|
|
63
63
|
"type": "git",
|
|
64
64
|
"url": "git@git.code.oa.com:TRDCWeb/trtc-electron-sdk.git"
|
|
65
65
|
},
|
|
66
|
-
"keywords": [
|
|
66
|
+
"keywords": [
|
|
67
|
+
"RTC",
|
|
68
|
+
"TRTC",
|
|
69
|
+
"Electron",
|
|
70
|
+
"Windows",
|
|
71
|
+
"Mac"
|
|
72
|
+
],
|
|
67
73
|
"author": "",
|
|
68
74
|
"license": "ISC",
|
|
69
75
|
"files": [
|
package/scripts/utils.js
CHANGED
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const semver = require("semver");
|
|
5
5
|
const pkg = require("../package.json");
|
|
6
|
-
const path = require("path");
|
|
7
|
-
|
|
8
6
|
const { Platform } = require("./constant");
|
|
9
|
-
const { platform, arch } = require("os");
|
|
10
7
|
|
|
11
8
|
module.exports.readCliArgv = function () {
|
|
12
9
|
const cliArgv = process.argv;
|
|
@@ -49,16 +46,18 @@ module.exports.readArgvFromNpmEnv = function () {
|
|
|
49
46
|
|
|
50
47
|
module.exports.readArgvFromPkgJson = function () {
|
|
51
48
|
let INIT_CWD = process.env["INIT_CWD"];
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
if (!INIT_CWD) return {};
|
|
50
|
+
let rootDirIndex = 0;
|
|
51
|
+
let PkgJsonDir = "";
|
|
52
|
+
if (process.platform === "win32") {
|
|
53
|
+
INIT_CWD = INIT_CWD.split("\\");
|
|
54
|
+
rootDirIndex = INIT_CWD.findIndex((item) => item === "node_modules");
|
|
55
|
+
PkgJsonDir =
|
|
56
|
+
INIT_CWD.splice(0, rootDirIndex).join("\\\\") + "\\\\package.json";
|
|
57
|
+
} else {
|
|
58
|
+
INIT_CWD = INIT_CWD.split("/");
|
|
59
|
+
rootDirIndex = INIT_CWD.findIndex((item) => item === "node_modules");
|
|
60
|
+
PkgJsonDir = INIT_CWD.splice(0, rootDirIndex).join("/") + "/package.json";
|
|
62
61
|
}
|
|
63
62
|
const { trtc_electron } = require(PkgJsonDir);
|
|
64
63
|
console.log(
|
|
@@ -85,28 +84,26 @@ module.exports.readArgvFromPkgJson = function () {
|
|
|
85
84
|
};
|
|
86
85
|
|
|
87
86
|
module.exports.detectConfigArgv = function (configArgv) {
|
|
88
|
-
const localArch = process.arch;
|
|
89
|
-
const localPlatform = process.platform;
|
|
90
87
|
if (Object.prototype.toString.call(configArgv) === "[object Object]") {
|
|
91
88
|
const { platform, arch } = configArgv;
|
|
92
89
|
if (platform === "darwin") {
|
|
93
90
|
if (arch !== "x64" && arch !== "arm64") {
|
|
94
|
-
configArgv.arch =
|
|
91
|
+
configArgv.arch = "x64";
|
|
95
92
|
}
|
|
96
93
|
} else if (platform === "win32") {
|
|
97
94
|
if (arch !== "ia32" && arch !== "x64") {
|
|
98
|
-
configArgv.arch =
|
|
95
|
+
configArgv.arch = "x64";
|
|
99
96
|
}
|
|
100
97
|
} else if (platform === "linux") {
|
|
101
98
|
if (arch !== "x64" && arch !== "arm64") {
|
|
102
|
-
configArgv.arch =
|
|
99
|
+
configArgv.arch = "x64";
|
|
103
100
|
}
|
|
104
101
|
}
|
|
105
102
|
return configArgv;
|
|
106
103
|
} else {
|
|
107
104
|
return {
|
|
108
|
-
platform:
|
|
109
|
-
arch:
|
|
105
|
+
platform: process.arch,
|
|
106
|
+
arch: process.platform,
|
|
110
107
|
};
|
|
111
108
|
}
|
|
112
109
|
};
|