Skip to content

Commit 29dea9c

Browse files
feat: support native 4.2.3 (#1081)
* chore: update terra to 4.2.3 * [AUTO] Generate code by terra (#1067) Co-authored-by: LichKing-2234 <[email protected]> * [WIP] * fix: `GetVideoFrame ret is` log too much * [AUTO] Generate code by terra (#1074) Co-authored-by: LichKing-2234 <[email protected]> * build: remove `--verbose` * build: ignore some dependencies * [WIP] * chore: lock version * [WIP] * [WIP] * [WIP] * [WIP] * [WIP] * [WIP] * [WIP] * [WIP] * [WIP] * [WIP] * [WIP] * [WIP] * [WIP] * [WIP] * chore: release 4.2.3-dev.3 * chore(example): update example to install [email protected] * [WIP] * [WIP] * [WIP] * fix: d3d11_texture_2d NMS-15857 * [Test] * [Test] * [WIP] * [WIP] * [WIP] * fix: only can open after preload * fix: addListener more than once NMS-15883 * fix: setState miss data issue * [WIP] * chore: update to 4.2.3-build.1 * [AUTO] Generate comments by iris-doc (#1076) Co-authored-by: Nero-Hu <[email protected]> * ci: update terra * [AUTO] Generate code by terra (#1079) Co-authored-by: LichKing-2234 <[email protected]> * [AUTO] Generate comments by iris-doc (#1080) Co-authored-by: Nero-Hu <[email protected]> * chore: wip --------- Co-authored-by: LichKing-2234 <[email protected]> Co-authored-by: Nero-Hu <[email protected]>
1 parent dc2d63f commit 29dea9c

38 files changed

+549
-196
lines changed

.github/workflows/build.yml

+77-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on:
2222
types: [ published ]
2323

2424
jobs:
25-
build:
25+
build-jenkins:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- name: Build
@@ -32,3 +32,79 @@ jobs:
3232
curl -X POST -sS -D- -o/dev/null ${{secrets.JENKINS_BUILD_URL}} \
3333
-H 'Content-Type: application/json' \
3434
-d "{\"branch\": \"${{github.ref_name}}\", \"type\": \"${type}\"}"
35+
36+
build-windows:
37+
if: ${{ inputs.type == 'demo' }}
38+
strategy:
39+
matrix:
40+
arch: [ ia32, x64 ]
41+
runs-on: windows-latest
42+
env:
43+
npm_config_arch: ${{ matrix.arch }}
44+
npm_config_agora_electron_arch: ${{ matrix.arch }}
45+
npm_config_agora_electron_sdk_arch: ${{ matrix.arch }}
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v3
49+
50+
- name: Setup
51+
uses: ./.github/actions/setup
52+
53+
- name: Build SDK
54+
run: |
55+
yarn totalBuild
56+
yarn zipBuild
57+
yarn link
58+
59+
- name: Build Example
60+
run: |
61+
yarn install
62+
yarn link agora-electron-sdk
63+
yarn dist:win --${{ matrix.arch }}
64+
yarn unlink agora-electron-sdk
65+
working-directory: example
66+
67+
- uses: actions/upload-artifact@v3
68+
with:
69+
name: AgoraRtcNgExample-win-${{ matrix.arch }}
70+
path: |
71+
example/dist/Agora-Electron-API-Example-*-win.zip
72+
73+
74+
build-mac:
75+
if: ${{ inputs.type == 'demo' }}
76+
runs-on: macos-latest
77+
steps:
78+
- uses: actions/checkout@v3
79+
80+
- name: Setup
81+
uses: ./.github/actions/setup
82+
83+
- name: Build SDK
84+
run: |
85+
yarn totalBuild
86+
yarn zipBuild
87+
yarn link
88+
89+
- name: Build Example
90+
run: |
91+
yarn install
92+
yarn link agora-electron-sdk
93+
yarn dist:mac
94+
yarn unlink agora-electron-sdk
95+
env:
96+
USE_HARD_LINKS: false
97+
working-directory: example
98+
99+
- uses: actions/upload-artifact@v3
100+
with:
101+
name: AgoraRtcNgExample-mac
102+
path: |
103+
example/dist/Agora-Electron-API-Example-*-mac.zip
104+
105+
notification:
106+
runs-on: ubuntu-latest
107+
needs: [ build-windows, build-mac ]
108+
steps:
109+
- run: |
110+
curl -X POST "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${{ secrets.WECHAT_KEY }}" -d '{"msgtype":"text","text":{"content":"Electron Example:\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}}'

.github/workflows/terra.yml

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: Generate codes
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
terra-ref:
7+
description: The terra repo ref
8+
required: true
9+
default: "main"
510

611
jobs:
712
generate-codes:
@@ -19,6 +24,7 @@ jobs:
1924
LLVM_DOWNLOAD_URL: |
2025
https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz
2126
with:
27+
terra-ref: ${{ inputs.terra-ref }}
2228
target-path: ${{ github.workspace }}
2329
config: ci/config/terra_config.yaml
2430
output-dir: ts/Private

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11

22

3+
## [4.2.3-dev.3](https://github.com/AgoraIO-Extensions/Electron-SDK/compare/v4.2.2...v4.2.3-dev.3) (2023-09-22)
4+
5+
6+
### Bug Fixes
7+
8+
* `GetVideoFrame ret is` log too much ([43e6519](https://github.com/AgoraIO-Extensions/Electron-SDK/commit/43e6519c630acf3e4233a891bf5b4f7d938813b3))
9+
310
## [4.2.2](https://github.com/AgoraIO-Extensions/Electron-SDK/compare/v4.2.1...v4.2.2) (2023-08-01)
411

512

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ $ npm install #or yarn
126126
$ npm install --agora_electron_sdk_pre_built=false
127127

128128
# build 32 bit architecture on Windows
129-
$ npm install --verbose --agora_electron_sdk_pre_built=false --agora_electron_sdk_arch=ia32
129+
$ npm install --agora_electron_sdk_pre_built=false --agora_electron_sdk_arch=ia32
130130

131131
# build 64 bit architecture on Windows
132-
$ npm install --verbose --agora_electron_sdk_pre_built=false --agora_electron_sdk_arch=x64
132+
$ npm install --agora_electron_sdk_pre_built=false --agora_electron_sdk_arch=x64
133133
```
134134

135135
## 🤝 Contributing [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/AgoraIO-Extensions/Electron-SDK/pulls)

ci/config/terra_config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include: shared:rtc_4.2.2/shared_configs.yaml
1+
include: shared:rtc_4.2.3/shared_configs.yaml
22

33
language: ts
44

ci/electron-sdk-build-mac-release.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ npm config set ELECTRON_MIRROR http://npm.taobao.org/mirrors/electron/
88
rm -rf node_modules
99
rm -rf sdk
1010
rm -rf tmp
11-
# npm install --verbose
11+
# npm install
1212
#
1313
# Example 2
1414
npm config set agora_electron_sdk_pre_built false
15-
npm install --verbose
16-
npm run totalBuild --verbose
15+
npm install
16+
npm run totalBuild
1717
npm run zipBuild
1818
npm config delete agora_electron_sdk_pre_built
1919
#

ci/electron-sdk-build-windows-release.bat

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ call npm config list
66
call npm config set agora_electron_sdk_pre_built false
77
if %1 == ia32 (
88
echo sdk_ia32
9-
call npm install --verbose --agora_electron_sdk_arch=ia32
10-
call npm run totalBuild --verbose --agora_electron_sdk_arch=ia32
9+
call npm install --agora_electron_sdk_arch=ia32
10+
call npm run totalBuild --agora_electron_sdk_arch=ia32
1111
)
1212
if %1 == x64 (
1313
echo sdk_x64
14-
call npm install --verbose --agora_electron_sdk_arch=x64
15-
call npm run totalBuild --verbose --agora_electron_sdk_arch=x64
14+
call npm install --agora_electron_sdk_arch=x64
15+
call npm run totalBuild --agora_electron_sdk_arch=x64
1616
)
1717
call npm config delete agora_electron_sdk_pre_built
1818

ci/packager-mac.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ packExample() {
4141
export USE_HARD_LINKS=false
4242
yarn dist:mac
4343

44-
pushd dist/mac
45-
zip -ry $(pwd)/../../../${outterZipName} Agora-Electron-API-Example.app
46-
popd
44+
cp -f dist/Agora-Electron-API-Example-*.zip ../${outterZipName}
4745
popd
4846
}
4947

example/package.json

+22-17
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,35 @@
77
"start": "electron-webpack dev",
88
"compile": "electron-webpack",
99
"rebuild": "electron-rebuild -f -o ref-napi",
10-
"dist": "yarn compile && electron-builder",
11-
"dist:mac": "yarn dist --dir -c.compression=store -c.mac.identity=null",
12-
"dist:win32": "yarn compile && electron-builder --publish never --win --ia32",
13-
"dist:win64": "yarn compile && electron-builder --publish never --win --x64",
14-
"switchEnv:win32": "cd .. && @powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./ci/packager-win.ps1 1 switchEnv",
15-
"switchEnv:win64": "cd .. && @powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./ci/packager-win.ps1 2 switchEnv"
10+
"dist": "npm run compile && electron-builder",
11+
"dist:mac": "npm run dist -- --mac",
12+
"dist:win": "npm run dist -- --win",
13+
"dist:win32": "npm run dist:win -- --ia32",
14+
"dist:win64": "npm run dist:win -- --x64"
1615
},
1716
"build": {
18-
"asar": false,
17+
"appId": "agora.io.ElectronApiExample",
18+
"asar": true,
19+
"asarUnpack": [
20+
"node_modules/agora-electron-sdk"
21+
],
1922
"buildDependenciesFromSource": true,
23+
"compression": "normal",
2024
"productName": "Agora-Electron-API-Example",
21-
"appId": "agora.io.ElectronApiExample",
25+
"publish": [],
2226
"files": [
2327
"!*.log"
2428
],
2529
"mac": {
26-
"target": [
27-
"dir"
28-
],
29-
"type": "distribution",
30-
"hardenedRuntime": true,
3130
"entitlements": "assets/entitlements.mac.plist",
3231
"entitlementsInherit": "assets/entitlements.mac.plist",
33-
"gatekeeperAssess": false
32+
"gatekeeperAssess": false,
33+
"hardenedRuntime": true,
34+
"identity": null,
35+
"target": [
36+
"zip"
37+
],
38+
"type": "distribution"
3439
},
3540
"dmg": {
3641
"contents": [
@@ -52,10 +57,10 @@
5257
]
5358
},
5459
"linux": {
60+
"category": "Development",
5561
"target": [
5662
"AppImage"
57-
],
58-
"category": "Development"
63+
]
5964
},
6065
"directories": {
6166
"buildResources": "assets"
@@ -65,7 +70,7 @@
6570
]
6671
},
6772
"dependencies": {
68-
"agora-electron-sdk": "4.2.2",
73+
"agora-electron-sdk": "4.2.3-dev.3",
6974
"antd": "^4.20.3",
7075
"download": "^8.0.0",
7176
"ffi-napi": "^4.0.3",

example/src/renderer/components/BaseComponent.tsx

+10-8
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ export abstract class BaseComponent<
108108
'elapsed',
109109
elapsed
110110
);
111-
const { remoteUsers } = this.state;
112-
if (remoteUsers === undefined) return;
113-
this.setState({
114-
remoteUsers: [...remoteUsers!, remoteUid],
111+
this.setState((preState) => {
112+
return {
113+
remoteUsers: [...(preState.remoteUsers ?? []), remoteUid],
114+
};
115115
});
116116
}
117117

@@ -129,10 +129,12 @@ export abstract class BaseComponent<
129129
'reason',
130130
reason
131131
);
132-
const { remoteUsers } = this.state;
133-
if (remoteUsers === undefined) return;
134-
this.setState({
135-
remoteUsers: remoteUsers!.filter((value) => value !== remoteUid),
132+
this.setState((preState) => {
133+
return {
134+
remoteUsers: (preState.remoteUsers ?? []).filter(
135+
(value) => value !== remoteUid
136+
),
137+
};
136138
});
137139
}
138140

example/src/renderer/components/RtcSurfaceView/index.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,15 @@ export class RtcSurfaceView extends Component<Props, State> {
116116

117117
render() {
118118
const { canvas } = this.props;
119-
const { isMirror, uniqueId } = this.state;
119+
const { uniqueId } = this.state;
120120

121121
return (
122122
<div
123123
className={styles['window-item']}
124124
onClick={() => {
125-
this.setState({ isMirror: !isMirror }, this.updateRender);
125+
this.setState((preState) => {
126+
return { isMirror: !preState.isMirror };
127+
}, this.updateRender);
126128
}}
127129
>
128130
<div

example/src/renderer/examples/advanced/ContentInspect/ContentInspect.tsx

+12-5
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,24 @@ export default class ContentInspect
173173
this.error('interval is invalid');
174174
return;
175175
}
176-
this.setState({
177-
modules: [...modules, { type, interval }],
176+
this.setState((preState) => {
177+
return {
178+
modules: [
179+
...preState.modules,
180+
{ type: preState.type, interval: preState.interval },
181+
],
182+
};
178183
});
179184
}}
180185
/>
181186
<AgoraButton
182187
title={'Remove'}
183188
onPress={() => {
184-
modules.pop();
185-
this.setState({
186-
modules: modules,
189+
this.setState((preState) => {
190+
preState.modules.pop();
191+
return {
192+
modules: preState.modules,
193+
};
187194
});
188195
}}
189196
/>

example/src/renderer/examples/advanced/DeviceManager/DeviceManager.tsx

+13-6
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,10 @@ export default class DeviceManager
342342
})}
343343
value={playbackDeviceId}
344344
onValueChange={(value, index) => {
345-
this.setState({
346-
playbackDeviceId: playbackDevices?.at(index)?.deviceId,
345+
this.setState((preState) => {
346+
return {
347+
playbackDeviceId: preState.playbackDevices?.at(index)?.deviceId,
348+
};
347349
});
348350
}}
349351
/>
@@ -358,8 +360,11 @@ export default class DeviceManager
358360
})}
359361
value={recordingDeviceId}
360362
onValueChange={(value, index) => {
361-
this.setState({
362-
recordingDeviceId: recordingDevices?.at(index)?.deviceId,
363+
this.setState((preState) => {
364+
return {
365+
recordingDeviceId:
366+
preState.recordingDevices?.at(index)?.deviceId,
367+
};
363368
});
364369
}}
365370
/>
@@ -374,8 +379,10 @@ export default class DeviceManager
374379
})}
375380
value={videoDeviceId}
376381
onValueChange={(value, index) => {
377-
this.setState({
378-
videoDeviceId: videoDevices?.at(index)?.deviceId,
382+
this.setState((preState) => {
383+
return {
384+
videoDeviceId: preState.videoDevices?.at(index)?.deviceId,
385+
};
379386
});
380387
}}
381388
/>

0 commit comments

Comments
 (0)