agora-electron-sdk 4.3.2 → 4.4.0-dev.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/gulpfile.js +3 -1
- package/js/AgoraSdk.js +4 -4
- package/js/Private/AgoraBase.js +367 -326
- package/js/Private/AgoraMediaBase.js +265 -76
- package/js/Private/AgoraMediaPlayerTypes.js +12 -30
- package/js/Private/IAgoraH265Transcoder.js +2 -5
- package/js/Private/IAgoraLog.js +2 -5
- package/js/Private/IAgoraMediaEngine.js +2 -5
- package/js/Private/IAgoraMediaPlayer.js +4 -10
- package/js/Private/IAgoraMediaRecorder.js +2 -5
- package/js/Private/IAgoraMediaStreamingSource.js +2 -5
- package/js/Private/IAgoraMusicContentCenter.js +21 -68
- package/js/Private/IAgoraRhythmPlayer.js +2 -5
- package/js/Private/IAgoraRtcEngine.js +76 -130
- package/js/Private/IAgoraRtcEngineEx.js +5 -28
- package/js/Private/IAgoraSpatialAudio.js +6 -15
- package/js/Private/IAudioDeviceManager.js +2 -5
- package/js/Private/impl/AgoraMediaBaseImpl.js +11 -14
- package/js/Private/impl/IAgoraH265TranscoderImpl.js +43 -46
- package/js/Private/impl/IAgoraMediaEngineImpl.js +155 -172
- package/js/Private/impl/IAgoraMediaPlayerImpl.js +534 -546
- package/js/Private/impl/IAgoraMediaRecorderImpl.js +26 -29
- package/js/Private/impl/IAgoraMusicContentCenterImpl.js +218 -251
- package/js/Private/impl/IAgoraRtcEngineExImpl.js +434 -436
- package/js/Private/impl/IAgoraRtcEngineImpl.js +2445 -2423
- package/js/Private/impl/IAgoraSpatialAudioImpl.js +167 -170
- package/js/Private/impl/IAudioDeviceManagerImpl.js +232 -235
- package/js/Private/internal/AgoraH265TranscoderInternal.js +33 -57
- package/js/Private/internal/AgoraMediaBaseInternal.js +9 -28
- package/js/Private/internal/AudioDeviceManagerInternal.js +24 -44
- package/js/Private/internal/IrisApiEngine.js +94 -145
- package/js/Private/internal/LocalSpatialAudioEngineInternal.js +3 -23
- package/js/Private/internal/MediaEngineInternal.js +69 -94
- package/js/Private/internal/MediaPlayerInternal.js +105 -125
- package/js/Private/internal/MediaRecorderInternal.js +37 -64
- package/js/Private/internal/MusicContentCenterInternal.js +92 -129
- package/js/Private/internal/RtcEngineExInternal.js +213 -243
- package/js/Private/ti/AgoraBase-ti.js +2 -2
- package/js/Private/ti/AgoraMediaBase-ti.js +2 -2
- package/js/Private/ti/AgoraMediaPlayerTypes-ti.js +1 -1
- package/js/Private/ti/IAgoraH265Transcoder-ti.js +2 -2
- package/js/Private/ti/IAgoraLog-ti.js +1 -1
- package/js/Private/ti/IAgoraMediaEngine-ti.js +1 -1
- package/js/Private/ti/IAgoraMediaPlayer-ti.js +2 -2
- package/js/Private/ti/IAgoraMediaPlayerSource-ti.js +2 -2
- package/js/Private/ti/IAgoraMediaRecorder-ti.js +1 -1
- package/js/Private/ti/IAgoraMediaStreamingSource-ti.js +1 -1
- package/js/Private/ti/IAgoraMusicContentCenter-ti.js +2 -2
- package/js/Private/ti/IAgoraRhythmPlayer-ti.js +1 -1
- package/js/Private/ti/IAgoraRtcEngine-ti.js +7 -7
- package/js/Private/ti/IAgoraRtcEngineEx-ti.js +1 -1
- package/js/Private/ti/IAgoraSpatialAudio-ti.js +1 -1
- package/js/Private/ti/IAudioDeviceManager-ti.js +1 -1
- package/js/Renderer/AgoraView.js +100 -145
- package/js/Renderer/IRenderer.js +43 -53
- package/js/Renderer/IRendererManager.js +106 -132
- package/js/Renderer/RendererCache.js +63 -96
- package/js/Renderer/RendererManager.js +35 -69
- package/js/Renderer/WebGLRenderer/index.js +77 -106
- package/js/Renderer/YUVCanvasRenderer/index.js +18 -40
- package/js/Utils.js +45 -64
- package/package.json +9 -7
- package/scripts/checkElectron.js +41 -0
- package/scripts/downloadPrebuild.js +56 -24
- package/scripts/synclib.js +6 -6
- package/ts/Private/AgoraBase.ts +269 -4
- package/ts/Private/AgoraMediaBase.ts +343 -1
- package/ts/Private/IAgoraMediaEngine.ts +3 -3
- package/ts/Private/IAgoraRtcEngine.ts +130 -119
- package/ts/Private/IAgoraRtcEngineEx.ts +14 -9
- package/ts/Private/impl/IAgoraRtcEngineExImpl.ts +30 -0
- package/ts/Private/impl/IAgoraRtcEngineImpl.ts +181 -61
- package/ts/Private/internal/IrisApiEngine.ts +3 -7
- package/ts/Private/internal/MediaEngineInternal.ts +0 -1
- package/ts/Private/internal/RtcEngineExInternal.ts +8 -4
- package/ts/Private/ti/IAgoraRtcEngine-ti.ts +5 -5
- package/ts/Renderer/IRenderer.ts +1 -2
- package/ts/Renderer/IRendererManager.ts +21 -12
- package/ts/Utils.ts +15 -0
- package/types/Private/AgoraBase.d.ts +264 -8
- package/types/Private/AgoraBase.d.ts.map +1 -1
- package/types/Private/AgoraMediaBase.d.ts +336 -1
- package/types/Private/AgoraMediaBase.d.ts.map +1 -1
- package/types/Private/IAgoraMediaEngine.d.ts +3 -3
- package/types/Private/IAgoraRtcEngine.d.ts +106 -116
- package/types/Private/IAgoraRtcEngine.d.ts.map +1 -1
- package/types/Private/IAgoraRtcEngineEx.d.ts +10 -10
- package/types/Private/IAgoraRtcEngineEx.d.ts.map +1 -1
- package/types/Private/impl/IAgoraRtcEngineExImpl.d.ts +3 -1
- package/types/Private/impl/IAgoraRtcEngineExImpl.d.ts.map +1 -1
- package/types/Private/impl/IAgoraRtcEngineImpl.d.ts +13 -5
- package/types/Private/impl/IAgoraRtcEngineImpl.d.ts.map +1 -1
- package/types/Private/internal/IrisApiEngine.d.ts.map +1 -1
- package/types/Private/internal/MediaEngineInternal.d.ts.map +1 -1
- package/types/Private/internal/RtcEngineExInternal.d.ts +1 -0
- package/types/Private/internal/RtcEngineExInternal.d.ts.map +1 -1
- package/types/Renderer/IRenderer.d.ts.map +1 -1
- package/types/Renderer/IRendererManager.d.ts.map +1 -1
- package/types/Utils.d.ts +4 -0
- package/types/Utils.d.ts.map +1 -1
|
@@ -1,44 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.YUVCanvasRenderer = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
26
|
-
}
|
|
27
|
-
YUVCanvasRenderer.prototype.bind = function (element) {
|
|
28
|
-
_super.prototype.bind.call(this, element);
|
|
4
|
+
const IRenderer_1 = require("../IRenderer");
|
|
5
|
+
const YUVBuffer = require('yuv-buffer');
|
|
6
|
+
const YUVCanvas = require('yuv-canvas');
|
|
7
|
+
class YUVCanvasRenderer extends IRenderer_1.IRenderer {
|
|
8
|
+
bind(element) {
|
|
9
|
+
super.bind(element);
|
|
29
10
|
this.frameSink = YUVCanvas.attach(this.canvas, {
|
|
30
11
|
webGL: false,
|
|
31
12
|
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.rotateCanvas({ width: width, height: height, rotation: rotation });
|
|
13
|
+
}
|
|
14
|
+
drawFrame({ width, height, yStride, uStride, vStride, yBuffer, uBuffer, vBuffer, rotation, }) {
|
|
15
|
+
this.rotateCanvas({ width, height, rotation });
|
|
36
16
|
this.updateRenderMode();
|
|
37
17
|
if (!this.frameSink)
|
|
38
18
|
return;
|
|
39
19
|
this.frameSink.drawFrame(YUVBuffer.frame(YUVBuffer.format({
|
|
40
|
-
width
|
|
41
|
-
height
|
|
20
|
+
width,
|
|
21
|
+
height,
|
|
42
22
|
chromaWidth: width / 2,
|
|
43
23
|
chromaHeight: height / 2,
|
|
44
24
|
cropLeft: yStride - width,
|
|
@@ -52,15 +32,13 @@ var YUVCanvasRenderer = /** @class */ (function (_super) {
|
|
|
52
32
|
bytes: vBuffer,
|
|
53
33
|
stride: vStride,
|
|
54
34
|
}));
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
_super.prototype.rotateCanvas.call(this, { width: width, height: height, rotation: rotation });
|
|
35
|
+
super.drawFrame();
|
|
36
|
+
}
|
|
37
|
+
rotateCanvas({ width, height, rotation }) {
|
|
38
|
+
super.rotateCanvas({ width, height, rotation });
|
|
60
39
|
if (!this.canvas)
|
|
61
40
|
return;
|
|
62
|
-
this.canvas.style.transform +=
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
}(IRenderer_1.IRenderer));
|
|
41
|
+
this.canvas.style.transform += ` rotateZ(${rotation}deg)`;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
66
44
|
exports.YUVCanvasRenderer = YUVCanvasRenderer;
|
package/js/Utils.js
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
-
if (ar || !(i in from)) {
|
|
5
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.AgoraEnv = exports.isSupportWebGL = exports.classMix = exports.objsKeysToLowerCase = exports.logDebug = exports.logInfo = exports.logError = exports.logWarn = exports.DEBUG_TAG = exports.TAG = void 0;
|
|
3
|
+
exports.AgoraEnv = exports.isSupportWebGL = exports.classMix = exports.objsKeysToLowerCase = exports.logDebug = exports.logInfo = exports.logError = exports.logWarn = exports.parseIntPtr2Number = exports.DEBUG_TAG = exports.TAG = void 0;
|
|
13
4
|
/**
|
|
14
5
|
* @ignore
|
|
15
6
|
*/
|
|
@@ -21,67 +12,67 @@ exports.DEBUG_TAG = '[Agora Debug]: ';
|
|
|
21
12
|
/**
|
|
22
13
|
* @ignore
|
|
23
14
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
function parseIntPtr2Number(value) {
|
|
16
|
+
try {
|
|
17
|
+
let bigIntVal = BigInt(value);
|
|
18
|
+
if (bigIntVal > 2n ** 63n - 1n) {
|
|
19
|
+
bigIntVal -= 2n ** 64n;
|
|
20
|
+
}
|
|
21
|
+
return Number(bigIntVal);
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
return value;
|
|
28
25
|
}
|
|
26
|
+
}
|
|
27
|
+
exports.parseIntPtr2Number = parseIntPtr2Number;
|
|
28
|
+
/**
|
|
29
|
+
* @ignore
|
|
30
|
+
*/
|
|
31
|
+
const logWarn = (msg, ...optParams) => {
|
|
29
32
|
if (!exports.AgoraEnv.enableLogging) {
|
|
30
33
|
return;
|
|
31
34
|
}
|
|
32
|
-
console.warn
|
|
35
|
+
console.warn(`${exports.TAG} ${msg}`, ...optParams);
|
|
33
36
|
};
|
|
34
37
|
exports.logWarn = logWarn;
|
|
35
38
|
/**
|
|
36
39
|
* @ignore
|
|
37
40
|
*/
|
|
38
|
-
|
|
39
|
-
var optParams = [];
|
|
40
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
41
|
-
optParams[_i - 1] = arguments[_i];
|
|
42
|
-
}
|
|
41
|
+
const logError = (msg, ...optParams) => {
|
|
43
42
|
if (!exports.AgoraEnv.enableLogging) {
|
|
44
43
|
return;
|
|
45
44
|
}
|
|
46
|
-
console.error
|
|
45
|
+
console.error(`${exports.TAG} ${msg}`, ...optParams);
|
|
47
46
|
};
|
|
48
47
|
exports.logError = logError;
|
|
49
48
|
/**
|
|
50
49
|
* @ignore
|
|
51
50
|
*/
|
|
52
|
-
|
|
53
|
-
var optParams = [];
|
|
54
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
55
|
-
optParams[_i - 1] = arguments[_i];
|
|
56
|
-
}
|
|
51
|
+
const logInfo = (msg, ...optParams) => {
|
|
57
52
|
if (!exports.AgoraEnv.enableLogging) {
|
|
58
53
|
return;
|
|
59
54
|
}
|
|
60
|
-
console.info
|
|
55
|
+
console.info(`${exports.TAG} ${msg}`, ...optParams);
|
|
61
56
|
};
|
|
62
57
|
exports.logInfo = logInfo;
|
|
63
58
|
/**
|
|
64
59
|
* @ignore
|
|
65
60
|
*/
|
|
66
|
-
|
|
67
|
-
var optParams = [];
|
|
68
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
69
|
-
optParams[_i - 1] = arguments[_i];
|
|
70
|
-
}
|
|
61
|
+
const logDebug = (msg, ...optParams) => {
|
|
71
62
|
if (!exports.AgoraEnv.enableLogging || !exports.AgoraEnv.enableDebugLogging) {
|
|
72
63
|
return;
|
|
73
64
|
}
|
|
74
|
-
console.debug
|
|
65
|
+
console.debug(`${exports.DEBUG_TAG} ${msg}`, ...optParams);
|
|
75
66
|
};
|
|
76
67
|
exports.logDebug = logDebug;
|
|
77
68
|
/**
|
|
78
69
|
* @ignore
|
|
79
70
|
*/
|
|
80
|
-
|
|
81
|
-
array.forEach(
|
|
82
|
-
for (
|
|
71
|
+
const objsKeysToLowerCase = (array) => {
|
|
72
|
+
array.forEach((obj) => {
|
|
73
|
+
for (const key in obj) {
|
|
83
74
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
84
|
-
|
|
75
|
+
const element = obj[key];
|
|
85
76
|
obj[key.toLocaleLowerCase()] = element;
|
|
86
77
|
}
|
|
87
78
|
}
|
|
@@ -91,22 +82,15 @@ exports.objsKeysToLowerCase = objsKeysToLowerCase;
|
|
|
91
82
|
/**
|
|
92
83
|
* @ignore
|
|
93
84
|
*/
|
|
94
|
-
function classMix() {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
var MixClass = /** @class */ (function () {
|
|
100
|
-
function MixClass() {
|
|
101
|
-
for (var _i = 0, mixins_2 = mixins; _i < mixins_2.length; _i++) {
|
|
102
|
-
var mixin = mixins_2[_i];
|
|
85
|
+
function classMix(...mixins) {
|
|
86
|
+
class MixClass {
|
|
87
|
+
constructor() {
|
|
88
|
+
for (let mixin of mixins) {
|
|
103
89
|
copyProperties(this, new mixin()); // 拷贝实例属性
|
|
104
90
|
}
|
|
105
91
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
for (var _a = 0, mixins_1 = mixins; _a < mixins_1.length; _a++) {
|
|
109
|
-
var mixin = mixins_1[_a];
|
|
92
|
+
}
|
|
93
|
+
for (let mixin of mixins) {
|
|
110
94
|
copyProperties(MixClass, mixin); // 拷贝静态属性
|
|
111
95
|
copyProperties(MixClass.prototype, mixin.prototype); // 拷贝原型属性
|
|
112
96
|
}
|
|
@@ -114,10 +98,9 @@ function classMix() {
|
|
|
114
98
|
}
|
|
115
99
|
exports.classMix = classMix;
|
|
116
100
|
function copyProperties(target, source) {
|
|
117
|
-
for (
|
|
118
|
-
var key = _a[_i];
|
|
101
|
+
for (let key of Reflect.ownKeys(source)) {
|
|
119
102
|
if (key !== 'constructor' && key !== 'prototype' && key !== 'name') {
|
|
120
|
-
|
|
103
|
+
let desc = Object.getOwnPropertyDescriptor(source, key);
|
|
121
104
|
Object.defineProperty(target, key, desc);
|
|
122
105
|
}
|
|
123
106
|
}
|
|
@@ -126,24 +109,22 @@ function copyProperties(target, source) {
|
|
|
126
109
|
* @ignore
|
|
127
110
|
*/
|
|
128
111
|
function isSupportWebGL() {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
var canvas = document.createElement('canvas');
|
|
112
|
+
let flag = false;
|
|
113
|
+
const canvas = document.createElement('canvas');
|
|
132
114
|
try {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
var context = canvas === null || canvas === void 0 ? void 0 : canvas.getContext(contextName);
|
|
115
|
+
const getContext = (contextNames = ['webgl2', 'webgl', 'experimental-webgl']) => {
|
|
116
|
+
for (let i = 0; i < contextNames.length; i++) {
|
|
117
|
+
const contextName = contextNames[i];
|
|
118
|
+
const context = canvas?.getContext(contextName);
|
|
138
119
|
if (context) {
|
|
139
120
|
return context;
|
|
140
121
|
}
|
|
141
122
|
}
|
|
142
123
|
return null;
|
|
143
124
|
};
|
|
144
|
-
|
|
125
|
+
let gl = getContext();
|
|
145
126
|
flag = !!gl;
|
|
146
|
-
|
|
127
|
+
gl?.getExtension('WEBGL_lose_context')?.loseContext();
|
|
147
128
|
gl = null;
|
|
148
129
|
(0, exports.logInfo)('Your browser support webGL');
|
|
149
130
|
}
|
|
@@ -154,7 +135,7 @@ function isSupportWebGL() {
|
|
|
154
135
|
return flag;
|
|
155
136
|
}
|
|
156
137
|
exports.isSupportWebGL = isSupportWebGL;
|
|
157
|
-
|
|
138
|
+
const AgoraNode = require('../build/Release/agora_node_ext');
|
|
158
139
|
/**
|
|
159
140
|
* @ignore
|
|
160
141
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agora-electron-sdk",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0-dev.1",
|
|
4
4
|
"description": "agora-electron-sdk",
|
|
5
5
|
"main": "js/AgoraSdk",
|
|
6
6
|
"types": "types/AgoraSdk.d.ts",
|
|
@@ -16,9 +16,11 @@
|
|
|
16
16
|
"!**/__tests__"
|
|
17
17
|
],
|
|
18
18
|
"scripts": {
|
|
19
|
+
"postinstall": "yarn checkElectron",
|
|
19
20
|
"totalBuild": "cross-env-shell gulp totalBuild \\\"--INIT_CWD=$INIT_CWD\\\"",
|
|
20
21
|
"build": "cross-env-shell gulp build \\\"--INIT_CWD=$INIT_CWD\\\"",
|
|
21
22
|
"clean": "cross-env-shell gulp clean \\\"--INIT_CWD=$INIT_CWD\\\"",
|
|
23
|
+
"checkElectron": "cross-env-shell gulp checkElectron \\\"--INIT_CWD=$INIT_CWD\\\"",
|
|
22
24
|
"syncLib": "cross-env-shell gulp syncLib \\\"--INIT_CWD=$INIT_CWD\\\"",
|
|
23
25
|
"buildJS": "cross-env-shell gulp buildJS \\\"--INIT_CWD=$INIT_CWD\\\"",
|
|
24
26
|
"zipBuild": "cross-env-shell gulp zipBuild \\\"--INIT_CWD=$INIT_CWD\\\"",
|
|
@@ -37,7 +39,8 @@
|
|
|
37
39
|
"install": "cross-env-shell gulp NPM_Install \\\"--INIT_CWD=$INIT_CWD\\\"",
|
|
38
40
|
"release": "release-it",
|
|
39
41
|
"example": "yarn --cwd example",
|
|
40
|
-
"
|
|
42
|
+
"example:prepare": "yarn example && cross-env-shell gulp checkElectron \\\"--INIT_CWD=$INIT_CWD/example\\\" \"--electron_path=$INIT_CWD/example/node_modules/electron/dist\"",
|
|
43
|
+
"bootstrap": "yarn config set agora-electron-sdk-pre-built 0 && yarn example && yarn install && yarn patch-package && yarn build:ts-interface && yarn totalBuild && yarn link && yarn example link agora-electron-sdk && yarn config delete agora-electron-sdk-pre-built && yarn example:prepare",
|
|
41
44
|
"build:ts-interface": "ts-interface-builder ts/Private/*.ts -o ts/Private/ti/"
|
|
42
45
|
},
|
|
43
46
|
"keywords": [
|
|
@@ -87,7 +90,6 @@
|
|
|
87
90
|
"engines": {
|
|
88
91
|
"node": ">= 14.0.0"
|
|
89
92
|
},
|
|
90
|
-
"packageManager": "^yarn@1.22.15",
|
|
91
93
|
"jest": {
|
|
92
94
|
"modulePathIgnorePatterns": [
|
|
93
95
|
"<rootDir>/example/node_modules",
|
|
@@ -136,9 +138,9 @@
|
|
|
136
138
|
"yuv-canvas": "1.2.6"
|
|
137
139
|
},
|
|
138
140
|
"agora_electron": {
|
|
139
|
-
"iris_sdk_win": "https://download.agora.io/sdk/release/iris_4.
|
|
140
|
-
"iris_sdk_mac": "https://download.agora.io/sdk/release/iris_4.
|
|
141
|
-
"native_sdk_win": "https://download.agora.io/sdk/release/
|
|
142
|
-
"native_sdk_mac": "https://download.agora.io/sdk/release/
|
|
141
|
+
"iris_sdk_win": "https://download.agora.io/sdk/release/iris_4.4.0-dev.4_DCG_Windows_Video_Standalone_20240624_0313_450.zip",
|
|
142
|
+
"iris_sdk_mac": "https://download.agora.io/sdk/release/iris_4.4.0-dev.4_DCG_Mac_Video_Standalone_20240624_0313_413.zip",
|
|
143
|
+
"native_sdk_win": "https://download.agora.io/sdk/release/AgoraRtcEngine_windows_Preview_4.4.0-dev.4.zip",
|
|
144
|
+
"native_sdk_mac": "https://download.agora.io/sdk/release/AgoraRtcEngine_macOS_Preview_4.4.0-dev.4.zip"
|
|
143
145
|
}
|
|
144
146
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
const download = require('download');
|
|
4
|
+
|
|
5
|
+
const { cleanDir } = require('./clean');
|
|
6
|
+
const getConfig = require('./getConfig');
|
|
7
|
+
const logger = require('./logger');
|
|
8
|
+
|
|
9
|
+
const config = getConfig();
|
|
10
|
+
const { electron_version, arch, platform } = config;
|
|
11
|
+
let { electron_path } = config;
|
|
12
|
+
const checkElectron = async (cb) => {
|
|
13
|
+
logger.info(`start sync electron`);
|
|
14
|
+
if (!electron_version || platform !== 'darwin') {
|
|
15
|
+
cb();
|
|
16
|
+
logger.info('electron_version is not set or os is not mac, skip sync');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (!electron_path) {
|
|
21
|
+
try {
|
|
22
|
+
electron_path = require.resolve('electron');
|
|
23
|
+
} catch (error) {
|
|
24
|
+
logger.info('Electron is not installed, skip sync');
|
|
25
|
+
cb();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
let tp = path.join(electron_path, `../dist`);
|
|
30
|
+
let downloadUrl = `https://download.agora.io/sdk/release/electron-v${electron_version}-${platform}-${arch}.zip`;
|
|
31
|
+
logger.info(`Downloading:${downloadUrl}`);
|
|
32
|
+
await cleanDir(tp);
|
|
33
|
+
await download(downloadUrl, tp, {
|
|
34
|
+
extract: true,
|
|
35
|
+
});
|
|
36
|
+
logger.info(`Finish download:${downloadUrl}`);
|
|
37
|
+
logger.info(`sync electron success`);
|
|
38
|
+
cb();
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
module.exports = checkElectron;
|
|
@@ -8,16 +8,12 @@ const getConfig = require('./getConfig');
|
|
|
8
8
|
const logger = require('./logger');
|
|
9
9
|
const { getOS } = require('./util');
|
|
10
10
|
|
|
11
|
-
const {
|
|
12
|
-
|
|
13
|
-
packageVersion,
|
|
14
|
-
arch,
|
|
15
|
-
no_symbol,
|
|
16
|
-
native_sdk_mac,
|
|
17
|
-
native_sdk_win,
|
|
18
|
-
} = getConfig();
|
|
11
|
+
const { platform, arch, no_symbol, native_sdk_mac, native_sdk_win } =
|
|
12
|
+
getConfig();
|
|
19
13
|
|
|
20
14
|
const workspaceDir = `${path.join(__dirname, '..')}`;
|
|
15
|
+
const packageVersion = '4.3.2';
|
|
16
|
+
const normalizePath = (filePath) => filePath.split(path.sep).join('/');
|
|
21
17
|
|
|
22
18
|
const getDownloadURL = () => {
|
|
23
19
|
let downloadUrl = `https://download.agora.io/sdk/release/Electron-${getOS()}-${packageVersion}-napi.zip`;
|
|
@@ -29,7 +25,7 @@ const getDownloadURL = () => {
|
|
|
29
25
|
|
|
30
26
|
const getNativeDownloadURL = () => {
|
|
31
27
|
let downloadUrl = '';
|
|
32
|
-
if (platform === 'win32'
|
|
28
|
+
if (platform === 'win32') {
|
|
33
29
|
downloadUrl = native_sdk_win;
|
|
34
30
|
} else if (platform === 'darwin') {
|
|
35
31
|
downloadUrl = native_sdk_mac;
|
|
@@ -38,15 +34,25 @@ const getNativeDownloadURL = () => {
|
|
|
38
34
|
};
|
|
39
35
|
|
|
40
36
|
const matchNativeFile = (path) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
let result = false;
|
|
38
|
+
switch (platform) {
|
|
39
|
+
case 'win32':
|
|
40
|
+
switch (arch) {
|
|
41
|
+
case 'ia32':
|
|
42
|
+
result = path.startsWith('sdk/x86/') && path.endsWith('.dll');
|
|
43
|
+
break;
|
|
44
|
+
case 'x64':
|
|
45
|
+
result = path.startsWith('sdk/x86_64/') && path.endsWith('.dll');
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
case 'darwin':
|
|
50
|
+
result =
|
|
51
|
+
path.startsWith('libs') &&
|
|
52
|
+
/^libs\/.*\.xcframework\/macos-arm64_x86_64\//.test(path);
|
|
53
|
+
break;
|
|
49
54
|
}
|
|
55
|
+
return result;
|
|
50
56
|
};
|
|
51
57
|
|
|
52
58
|
const macNoSymbolList = [
|
|
@@ -126,16 +132,42 @@ module.exports = async () => {
|
|
|
126
132
|
if (nativeDownloadURL) {
|
|
127
133
|
logger.info('Native SDK URL %s ', nativeDownloadURL);
|
|
128
134
|
logger.info('Downloading native SDK for Agora Electron SDK...');
|
|
129
|
-
|
|
135
|
+
const nativeLibDir = path.resolve(__dirname, `${buildDir}/Release`);
|
|
136
|
+
await download(nativeDownloadURL, nativeLibDir, {
|
|
130
137
|
strip: 1,
|
|
131
138
|
extract: true,
|
|
132
139
|
filter: (file) => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
140
|
+
file.path = normalizePath(file.path);
|
|
141
|
+
if (matchNativeFile(file.path)) {
|
|
142
|
+
if (file.type === 'file' && file.path.endsWith('/')) {
|
|
143
|
+
file.type = 'directory';
|
|
144
|
+
}
|
|
145
|
+
switch (platform) {
|
|
146
|
+
case 'win32':
|
|
147
|
+
switch (arch) {
|
|
148
|
+
case 'ia32':
|
|
149
|
+
file.path = file.path.replace(/^sdk\/x86\//, '');
|
|
150
|
+
break;
|
|
151
|
+
case 'x64':
|
|
152
|
+
file.path = file.path.replace(/^sdk\/x86_64\//, '');
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
break;
|
|
156
|
+
case 'darwin':
|
|
157
|
+
file.path = file.path.replace(
|
|
158
|
+
/^libs\/.*\.xcframework\/macos-arm64_x86_64\//,
|
|
159
|
+
''
|
|
160
|
+
);
|
|
161
|
+
if (fs.exists(`${nativeLibDir}/${file.path}`)) {
|
|
162
|
+
fs.remove(`${nativeLibDir}/${file.path}`);
|
|
163
|
+
}
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
logger.info(`move native file: ${file.path} → ${nativeLibDir}`);
|
|
167
|
+
return true;
|
|
168
|
+
} else {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
139
171
|
},
|
|
140
172
|
});
|
|
141
173
|
}
|
package/scripts/synclib.js
CHANGED
|
@@ -23,12 +23,12 @@ const downloadSDK = async ({
|
|
|
23
23
|
await download(sdkURL, destDir, {
|
|
24
24
|
strip: strip,
|
|
25
25
|
extract: true,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
//https://github.com/kevva/decompress/issues/68
|
|
27
|
+
map: (file) => {
|
|
28
|
+
if (file.type === 'file' && file.path.endsWith('/')) {
|
|
29
|
+
file.type = 'directory';
|
|
30
|
+
}
|
|
31
|
+
return file;
|
|
32
32
|
},
|
|
33
33
|
});
|
|
34
34
|
logger.info(`Finish download:${sdkURL}`);
|