Skip to content

Commit 9014e6e

Browse files
authored
feat: Upgrade native sdk 3.6.2 (AgoraIO-Extensions#651)
* feat: Upgrade native sdk 3.6.2
1 parent 1a08141 commit 9014e6e

File tree

167 files changed

+17125
-13302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+17125
-13302
lines changed

.github/workflows/build.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ jobs:
4848
java-version: '11'
4949
- uses: subosito/flutter-action@v1
5050
with:
51-
flutter-version: '2.10.0'
51+
flutter-version: '2.10.3'
5252
- name: run flutter android integration tests
5353
uses: reactivecircus/android-emulator-runner@v2.21.0
5454
with:
5555
api-level: 31
5656
arch: x86_64
5757
profile: Nexus 6
58-
script: bash ci/run_flutter_integration_test.sh
58+
script: bash ci/run_flutter_integration_test_android.sh
5959

6060
integration_test_ios:
6161
name: Run Flutter iOS Integration Tests
@@ -68,11 +68,11 @@ jobs:
6868
- uses: actions/checkout@v1
6969
- uses: subosito/flutter-action@v1
7070
with:
71-
flutter-version: '2.10.0'
71+
flutter-version: '2.10.3'
7272
- uses: futureware-tech/simulator-action@v1
7373
with:
7474
model: 'iPhone 13 Pro Max'
75-
- run: bash ci/run_flutter_integration_test.sh
75+
- run: bash ci/run_flutter_integration_test_ios.sh
7676

7777
integration_test_macos:
7878
name: Run Flutter macOS Integration Tests
@@ -85,7 +85,7 @@ jobs:
8585
- uses: actions/checkout@v1
8686
- uses: subosito/flutter-action@v1
8787
with:
88-
flutter-version: '2.10.0'
88+
flutter-version: '2.10.3'
8989
- run: flutter config --enable-macos-desktop
9090
- run: bash ci/run_flutter_macos_integration_test.sh
9191

@@ -100,7 +100,7 @@ jobs:
100100
- uses: actions/checkout@v1
101101
- uses: subosito/flutter-action@v1
102102
with:
103-
flutter-version: '2.10.0'
103+
flutter-version: '2.10.3'
104104
- run: flutter config --enable-windows-desktop
105105
- run: bash ci/run_flutter_macos_integration_test.sh
106106

@@ -116,7 +116,7 @@ jobs:
116116
java-version: '11'
117117
- uses: subosito/flutter-action@v1
118118
with:
119-
flutter-version: '2.10.0'
119+
flutter-version: '2.10.3'
120120
- run: flutter pub get
121121
- run: bash ci/run_android_test.sh
122122

@@ -129,7 +129,7 @@ jobs:
129129
- uses: actions/checkout@v1
130130
- uses: subosito/flutter-action@v1
131131
with:
132-
flutter-version: '2.10.0'
132+
flutter-version: '2.10.3'
133133
- run: flutter pub get
134134
- run: bash ci/run_ios_test.sh
135135

@@ -144,7 +144,7 @@ jobs:
144144
java-version: '11'
145145
- uses: subosito/flutter-action@v1
146146
with:
147-
flutter-version: '2.10.0'
147+
flutter-version: '2.10.3'
148148
- run: flutter pub get
149149
- name: Run flutter build apk
150150
run: flutter build apk
@@ -159,7 +159,7 @@ jobs:
159159
- uses: actions/checkout@v1
160160
- uses: subosito/flutter-action@v1
161161
with:
162-
flutter-version: '2.10.0'
162+
flutter-version: '2.10.3'
163163
- run: flutter pub get
164164
- name: Run flutter build ios --no-codesign
165165
run: flutter build ios --no-codesign

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,9 @@ example/ios/Podfile.lock.classpath
5252
**/ios/Flutter/flutter_export_environment.sh
5353
**/ios/ServiceDefinitions.json
5454
**/ios/Runner/GeneratedPluginRegistrant.*
55+
**/macos/Runner/GeneratedPluginRegistrant.*
5556
android/gradle/wrapper/gradle-wrapper.properties
57+
58+
macos/AgoraRtcWrapper.framework
59+
macos/AgoraRtcWrapper.podspec
60+
macos/libs

.gitmodules

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[submodule "web"]
22
path = web
3+
branch = main
34
url = https://github.com/AgoraIO-Community/Iris-Rtc-Web.git
45
[submodule "integration_test_app/iris_integration_test/third_party/googletest"]
56
path = integration_test_app/iris_integration_test/third_party/googletest

.pubignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
integration_test_app/
1+
integration_test_app/
2+
tools/

README.md

+16-18
Original file line numberDiff line numberDiff line change
@@ -89,29 +89,12 @@ You can get more info from the [CMakeLists.text](windows/CMakeLists.txt) file, s
8989

9090
We use the [js](https://pub.dev/packages/js) library to call JavaScript from the dart layer.
9191

92-
We have a wrapper library named [AgoraRtcWrapper.bundle.js](example/web/AgoraRtcWrapper.bundle.js) for the Web SDK, so you should add it to your `index.html`, you can refer to [example/web/index.html](example/web/index.html).
93-
94-
```html
95-
<script src="AgoraRtcWrapper.bundle.js" type="application/javascript"></script>
96-
```
92+
We have a wrapper library named [AgoraRtcWrapper.bundle.js](assets/AgoraRtcWrapper.bundle.js) for the Web SDK.
9793

9894
This wrapper library is the output of the open-source repository [Iris-Rtc-Web](https://github.com/AgoraIO-Community/Iris-Rtc-Web). The repository attempt to mapping the API from Web SDK as Native SDK, we make it open-source to help developer positioning and troubleshooting.
9995

10096
We have imported it as a Git submodule, you can find it in the [web](web) folder.
10197

102-
## Interact with RtcEngine/AgoraRtcEngineKit on Android/iOS
103-
104-
`agora_rtc_engine` has not implemented all the features of agora native (Android/iOS) sdk, due to performance reasons, such
105-
as [Custom Audio Source and Renderer](https://docs.agora.io/en/Video/custom_audio_android?platform=Android), [Custom Video Source and Renderer](https://docs.agora.io/en/Video/custom_video_android?platform=Android), [Raw Audio Data](https://docs.agora.io/en/Video/raw_data_audio_android?platform=Android), etc.
106-
107-
`agora_rtc_engine` provides [RtcEnginePlugin](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/android/src/main/java/io/agora/rtc/base/RtcEnginePlugin.kt)/[RtcEnginePlugin](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/ios/Classes/Base/RtcEnginePlugin.h), allowing you to to interact with the [RtcEngine](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/lib/src/rtc_engine.dart) created on the Flutter side in the Android/iOS code, you can implement your own plugin by inheriting [RtcEnginePlugin](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/android/src/main/java/io/agora/rtc/base/RtcEnginePlugin.kt)/[RtcEnginePlugin](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/ios/Classes/Base/RtcEnginePlugin.h), and get the [RtcEngine](https://docs.agora.io/en/Video/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_rtc_engine.html)/[AgoraRtcEngineKit](https://docs.agora.io/en/Video/API%20Reference/oc/Classes/AgoraRtcEngineKit.html) in the `onRtcEngineCreated` callback.
108-
109-
Please note that you should not call the [RtcEngine.destroy](https://docs.agora.io/en/Video/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_rtc_engine.html#afb808cdc9025a77af7dd2bce98311bfe)/[AgoraRtcEngineKit.destroy](https://docs.agora.io/en/Video/API%20Reference/oc/Classes/AgoraRtcEngineKit.html#//api/name/destroy) function on Android/iOS code, because it will affect the [RtcEngine](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/lib/src/rtc_engine.dart) on the Flutter side. To see how to use `RtcEnginePlugin`, please check the custom audio source example:
110-
111-
Android: [CustomAudioPlugin.kt](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/example/android/app/src/main/kotlin/io/agora/agora_rtc_engine_example/custom_audio_source/CustomAudioPlugin.kt)
112-
113-
iOS: [CustmoAudioSourcePlugin.swift](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/example/ios/Runner/CustomAudioSource/CustmoAudioSourcePlugin.swift)
114-
11598
## Error handling
11699

117100
Please check **Pinned issues** and search in [Issues](https://github.com/AgoraIO/Agora-Flutter-SDK/issues) first.
@@ -142,6 +125,21 @@ You should set `AppGroup` on macOS and set as parameter before calling `getScree
142125

143126
You can refer to [screen_sharing.dart](example/lib/examples/advanced/screen_sharing/screen_sharing.dart) and [Apple doc](https://developer.apple.com/library/archive/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW21).
144127

128+
## Experimental Features
129+
130+
### Interact with RtcEngine/AgoraRtcEngineKit on Android/iOS
131+
132+
`agora_rtc_engine` has not implemented all the features of agora native (Android/iOS) sdk, due to performance reasons, such
133+
as [Custom Audio Source and Renderer](https://docs.agora.io/en/Video/custom_audio_android?platform=Android), [Custom Video Source and Renderer](https://docs.agora.io/en/Video/custom_video_android?platform=Android), [Raw Audio Data](https://docs.agora.io/en/Video/raw_data_audio_android?platform=Android), etc.
134+
135+
`agora_rtc_engine` provides [RtcEnginePlugin](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/android/src/main/java/io/agora/rtc/base/RtcEnginePlugin.kt)/[RtcEnginePlugin](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/ios/Classes/Base/RtcEnginePlugin.h), allowing you to to interact with the [RtcEngine](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/lib/src/rtc_engine.dart) created on the Flutter side in the Android/iOS code, you can implement your own plugin by inheriting [RtcEnginePlugin](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/android/src/main/java/io/agora/rtc/base/RtcEnginePlugin.kt)/[RtcEnginePlugin](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/ios/Classes/Base/RtcEnginePlugin.h), and get the [RtcEngine](https://docs.agora.io/en/Video/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_rtc_engine.html)/[AgoraRtcEngineKit](https://docs.agora.io/en/Video/API%20Reference/oc/Classes/AgoraRtcEngineKit.html) in the `onRtcEngineCreated` callback.
136+
137+
Please note that you should not call the [RtcEngine.destroy](https://docs.agora.io/en/Video/API%20Reference/java/classio_1_1agora_1_1rtc_1_1_rtc_engine.html#afb808cdc9025a77af7dd2bce98311bfe)/[AgoraRtcEngineKit.destroy](https://docs.agora.io/en/Video/API%20Reference/oc/Classes/AgoraRtcEngineKit.html#//api/name/destroy) function on Android/iOS code, because it will affect the [RtcEngine](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/lib/src/rtc_engine.dart) on the Flutter side. To see how to use `RtcEnginePlugin`, please check the custom audio source example:
138+
139+
Android: [CustomAudioPlugin.kt](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/example/android/app/src/main/kotlin/io/agora/agora_rtc_engine_example/custom_audio_source/CustomAudioPlugin.kt)
140+
141+
iOS: [CustmoAudioSourcePlugin.swift](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/example/ios/Runner/CustomAudioSource/CustmoAudioSourcePlugin.swift)
142+
145143
## API Reference Resources
146144

147145
* [Flutter](https://docs.agora.io/en/Video/API%20Reference/flutter/index.html)

README.zh.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Agora 视频 SDK 需要 `摄像头` 和 `麦克风` 权限来开始视频通话
8080

8181
#### macOS
8282

83-
您可以从 [agora_rtc_engine.podspec](macOS/agora_rtc_engine.podspec) 文件中获取更多信息, 比如在 macOS 上的依赖库。
83+
您可以从 [agora_rtc_engine.podspec](macos/agora_rtc_engine.podspec) 文件中获取更多信息, 比如在 macOS 上的依赖库。
8484

8585
#### Windows
8686

@@ -90,13 +90,7 @@ Agora 视频 SDK 需要 `摄像头` 和 `麦克风` 权限来开始视频通话
9090

9191
我们使用 [js](https://pub.dev/packages/js) 库实现 dart 对 JavaScript 的调用。
9292

93-
我们针对 Web SDK 有一个 [AgoraRtcWrapper.bundle.js](example/web/AgoraRtcWrapper.bundle.js)
94-
包装库,所以需要在您的 `index.html` 中添加引用,可以参考 [example/web/index.html](example/web/index.html)
95-
96-
```html
97-
98-
<script src="AgoraRtcWrapper.bundle.js" type="application/javascript"></script>
99-
```
93+
我们针对 Web SDK 有一个 [AgoraRtcWrapper.bundle.js](assets/AgoraRtcWrapper.bundle.js) 包装库。
10094

10195
此包装库是 [Iris-Rtc-Web](https://github.com/AgoraIO-Community/Iris-Rtc-Web) 开源库的编译产物,它尝试将 Web SDK 接口映射成
10296
Native SDK 接口,我们将其开源以便开发者定位和排查问题。

analysis_options.yaml

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ analyzer:
44
# Ignore generated files
55
- "**/*.g.dart"
66
- lib/src/generated/*.dart
7-
- integration_test_app/**
8-
- test/**
97

108
linter:
119
rules:
12-
public_member_api_docs: false
10+
- public_member_api_docs

android/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66
.DS_Store
77
/build
88
/captures
9+
libs/
10+
.plugin_dev

android/build.gradle

+14-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ rootProject.allprojects {
2323
repositories {
2424
mavenCentral()
2525
google()
26-
maven { url 'https://www.jitpack.io' }
2726
}
2827
}
2928

@@ -32,25 +31,33 @@ apply plugin: 'kotlin-android'
3231

3332
android {
3433
compileSdkVersion safeExtGet('compileSdkVersion', 31)
35-
buildToolsVersion safeExtGet('buildToolsVersion', '31.0.0')
3634

3735
defaultConfig {
3836
minSdkVersion safeExtGet('minSdkVersion', 16)
39-
targetSdkVersion safeExtGet('targetSdkVersion', 31)
4037

4138
consumerProguardFiles 'consumer-rules.pro'
4239
}
4340

4441
sourceSets {
4542
main.java.srcDirs += 'src/main/kotlin'
46-
}
4743

48-
lintOptions {
49-
disable 'InvalidPackage'
44+
if (isDev(project)) {
45+
main.jniLibs.srcDirs += 'libs'
46+
}
5047
}
5148
}
5249

5350
dependencies {
54-
api 'com.github.agorabuilder:iris-rtc:3.5.2'
51+
if (isDev(project)) {
52+
api fileTree(dir: "libs", include: ["*.jar", "*.aar"])
53+
} else {
54+
api 'io.agora.rtc:iris-rtc:3.6.2'
55+
}
56+
5557
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${safeExtGet('kotlin_version', "$agora_rtc_engine_kt_version")}"
5658
}
59+
60+
static boolean isDev(Project project) {
61+
def devFile = project.file('.plugin_dev')
62+
return devFile.exists()
63+
}

android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraPlatformView.kt

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import android.content.Context
44
import android.view.View
55
import android.widget.FrameLayout
66
import io.agora.iris.rtc.IrisRtcEngine
7-
import io.agora.iris.rtc.base.ApiTypeEngine
87
import io.flutter.plugin.common.BinaryMessenger
98
import io.flutter.plugin.common.ErrorLogResult
109
import io.flutter.plugin.common.MethodCall
@@ -17,7 +16,7 @@ private class PlatformViewApiTypeCallApiMethodCallHandler(
1716
) : CallApiMethodCallHandler(irisRtcEngine) {
1817
override fun callApi(apiType: Int, params: String?, sb: StringBuffer): Int {
1918
platformView.updateView()
20-
return irisRtcEngine.callApi(ApiTypeEngine.fromInt(apiType), params, platformView.getIrisRenderView(), sb)
19+
return irisRtcEngine.callApi(apiType, params, platformView.getIrisRenderView(), sb)
2120
}
2221
}
2322

android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraRtcChannelPlugin.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import android.os.Looper
55
import android.util.Log
66
import androidx.annotation.NonNull
77
import io.agora.iris.rtc.IrisRtcEngine
8-
import io.agora.iris.rtc.base.ApiTypeChannel
98
import io.flutter.embedding.engine.plugins.FlutterPlugin
109
import io.flutter.plugin.common.BinaryMessenger
1110
import io.flutter.plugin.common.EventChannel
@@ -18,11 +17,11 @@ private class ApiTypeChannelCallApiMethodCallHandler(
1817
irisRtcEngine: IrisRtcEngine
1918
) : CallApiMethodCallHandler(irisRtcEngine) {
2019
override fun callApi(apiType: Int, params: String?, sb: StringBuffer): Int {
21-
return irisRtcEngine.channel.callApi(ApiTypeChannel.fromInt(apiType), params, sb)
20+
return irisRtcEngine.channel.callApi(apiType, params, sb)
2221
}
2322

2423
override fun callApiWithBuffer(apiType: Int, params: String?, buffer: ByteArray?, sb: StringBuffer): Int {
25-
return irisRtcEngine.channel.callApi(ApiTypeChannel.fromInt(apiType), params, buffer, sb)
24+
return irisRtcEngine.channel.callApi(apiType, params, buffer, sb)
2625
}
2726
}
2827

android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraRtcEnginePlugin.kt

+5-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import android.util.Log
77
import androidx.annotation.NonNull
88
import io.agora.iris.base.IrisEventHandler
99
import io.agora.iris.rtc.IrisRtcEngine
10-
import io.agora.iris.rtc.base.ApiTypeEngine
1110
import io.agora.rtc.RtcEngine
1211
import io.agora.rtc.base.RtcEngineRegistry
1312
import io.flutter.BuildConfig
@@ -39,12 +38,11 @@ open class CallApiMethodCallHandler(
3938
) : MethodCallHandler {
4039

4140
protected open fun callApi(apiType: Int, params: String?, sb: StringBuffer): Int {
42-
val type = ApiTypeEngine.fromInt(apiType)
43-
val ret = irisRtcEngine.callApi(type, params, sb)
44-
if (type == ApiTypeEngine.kEngineInitialize) {
41+
val ret = irisRtcEngine.callApi(apiType, params, sb)
42+
if (apiType == 0) {
4543
RtcEngineRegistry.instance.onRtcEngineCreated(irisRtcEngine.rtcEngine as RtcEngine?)
4644
}
47-
if (type == ApiTypeEngine.kEngineRelease) {
45+
if (apiType == 1) {
4846
RtcEngineRegistry.instance.onRtcEngineDestroyed()
4947
}
5048

@@ -56,13 +54,13 @@ open class CallApiMethodCallHandler(
5654
params: String?,
5755
buffer: ByteArray?,
5856
sb: StringBuffer): Int {
59-
return irisRtcEngine.callApi(ApiTypeEngine.fromInt(apiType), params, buffer, sb)
57+
return irisRtcEngine.callApi(apiType, params, buffer, sb)
6058
}
6159

6260
protected open fun callApiError(ret: Int): String {
6361
val description = StringBuffer()
6462
irisRtcEngine.callApi(
65-
ApiTypeEngine.kEngineGetErrorDescription,
63+
132,
6664
"{\"code\":" + abs(ret) + "}",
6765
description
6866
)

assets/AgoraRtcWrapper.bundle.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*! *****************************************************************************
2+
Copyright (c) Microsoft Corporation. All rights reserved.
3+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4+
this file except in compliance with the License. You may obtain a copy of the
5+
License at http://www.apache.org/licenses/LICENSE-2.0
6+
7+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10+
MERCHANTABLITY OR NON-INFRINGEMENT.
11+
12+
See the Apache Version 2.0 License for specific language governing permissions
13+
and limitations under the License.
14+
***************************************************************************** */
15+
16+
/*! formdata-polyfill. MIT License. Jimmy W?rting <https://jimmy.warting.se/opensource> */
17+
18+
/*!@license
19+
* UAParser.js v0.7.28
20+
* Lightweight JavaScript-based User-Agent string parser
21+
* https://github.com/faisalman/ua-parser-js
22+
*
23+
* Copyright © 2012-2021 Faisal Salman <f@faisalman.com>
24+
* Licensed under MIT License
25+
*/
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -x
5+
6+
flutter packages get
7+
8+
bash integration_test_app/iris_integration_test/build-android.sh
9+
10+
pushd integration_test_app
11+
12+
flutter packages get
13+
flutter test integration_test --dart-define=TEST_APP_ID="${TEST_APP_ID}"
14+
15+
popd
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -x
5+
6+
flutter packages get
7+
8+
bash integration_test_app/iris_integration_test/build-ios.sh
9+
10+
pushd integration_test_app
11+
12+
flutter packages get
13+
flutter test integration_test --dart-define=TEST_APP_ID="${TEST_APP_ID}"
14+
15+
popd

0 commit comments

Comments
 (0)