Skip to content

Commit

Permalink
feat: Upgrade native sdk 3.6.2 (#651)
Browse files Browse the repository at this point in the history
* feat: Upgrade native sdk 3.6.2
  • Loading branch information
littleGnAl committed Apr 15, 2022
1 parent 1a08141 commit 9014e6e
Show file tree
Hide file tree
Showing 167 changed files with 17,125 additions and 13,302 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ jobs:
java-version: '11'
- uses: subosito/flutter-action@v1
with:
flutter-version: '2.10.0'
flutter-version: '2.10.3'
- name: run flutter android integration tests
uses: reactivecircus/android-emulator-runner@v2.21.0
with:
api-level: 31
arch: x86_64
profile: Nexus 6
script: bash ci/run_flutter_integration_test.sh
script: bash ci/run_flutter_integration_test_android.sh

integration_test_ios:
name: Run Flutter iOS Integration Tests
Expand All @@ -68,11 +68,11 @@ jobs:
- uses: actions/checkout@v1
- uses: subosito/flutter-action@v1
with:
flutter-version: '2.10.0'
flutter-version: '2.10.3'
- uses: futureware-tech/simulator-action@v1
with:
model: 'iPhone 13 Pro Max'
- run: bash ci/run_flutter_integration_test.sh
- run: bash ci/run_flutter_integration_test_ios.sh

integration_test_macos:
name: Run Flutter macOS Integration Tests
Expand All @@ -85,7 +85,7 @@ jobs:
- uses: actions/checkout@v1
- uses: subosito/flutter-action@v1
with:
flutter-version: '2.10.0'
flutter-version: '2.10.3'
- run: flutter config --enable-macos-desktop
- run: bash ci/run_flutter_macos_integration_test.sh

Expand All @@ -100,7 +100,7 @@ jobs:
- uses: actions/checkout@v1
- uses: subosito/flutter-action@v1
with:
flutter-version: '2.10.0'
flutter-version: '2.10.3'
- run: flutter config --enable-windows-desktop
- run: bash ci/run_flutter_macos_integration_test.sh

Expand All @@ -116,7 +116,7 @@ jobs:
java-version: '11'
- uses: subosito/flutter-action@v1
with:
flutter-version: '2.10.0'
flutter-version: '2.10.3'
- run: flutter pub get
- run: bash ci/run_android_test.sh

Expand All @@ -129,7 +129,7 @@ jobs:
- uses: actions/checkout@v1
- uses: subosito/flutter-action@v1
with:
flutter-version: '2.10.0'
flutter-version: '2.10.3'
- run: flutter pub get
- run: bash ci/run_ios_test.sh

Expand All @@ -144,7 +144,7 @@ jobs:
java-version: '11'
- uses: subosito/flutter-action@v1
with:
flutter-version: '2.10.0'
flutter-version: '2.10.3'
- run: flutter pub get
- name: Run flutter build apk
run: flutter build apk
Expand All @@ -159,7 +159,7 @@ jobs:
- uses: actions/checkout@v1
- uses: subosito/flutter-action@v1
with:
flutter-version: '2.10.0'
flutter-version: '2.10.3'
- run: flutter pub get
- name: Run flutter build ios --no-codesign
run: flutter build ios --no-codesign
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,9 @@ example/ios/Podfile.lock.classpath
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*
**/macos/Runner/GeneratedPluginRegistrant.*
android/gradle/wrapper/gradle-wrapper.properties

macos/AgoraRtcWrapper.framework
macos/AgoraRtcWrapper.podspec
macos/libs
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[submodule "web"]
path = web
branch = main
url = https://github.com/AgoraIO-Community/Iris-Rtc-Web.git
[submodule "integration_test_app/iris_integration_test/third_party/googletest"]
path = integration_test_app/iris_integration_test/third_party/googletest
Expand Down
3 changes: 2 additions & 1 deletion .pubignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
integration_test_app/
integration_test_app/
tools/
34 changes: 16 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,12 @@ You can get more info from the [CMakeLists.text](windows/CMakeLists.txt) file, s

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

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).

```html
<script src="AgoraRtcWrapper.bundle.js" type="application/javascript"></script>
```
We have a wrapper library named [AgoraRtcWrapper.bundle.js](assets/AgoraRtcWrapper.bundle.js) for the Web SDK.

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.

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

## Interact with RtcEngine/AgoraRtcEngineKit on Android/iOS

`agora_rtc_engine` has not implemented all the features of agora native (Android/iOS) sdk, due to performance reasons, such
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.

`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.

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:

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)

iOS: [CustmoAudioSourcePlugin.swift](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/example/ios/Runner/CustomAudioSource/CustmoAudioSourcePlugin.swift)

## Error handling

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

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).

## Experimental Features

### Interact with RtcEngine/AgoraRtcEngineKit on Android/iOS

`agora_rtc_engine` has not implemented all the features of agora native (Android/iOS) sdk, due to performance reasons, such
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.

`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.

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:

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)

iOS: [CustmoAudioSourcePlugin.swift](https://github.com/AgoraIO/Agora-Flutter-SDK/blob/master/example/ios/Runner/CustomAudioSource/CustmoAudioSourcePlugin.swift)

## API Reference Resources

* [Flutter](https://docs.agora.io/en/Video/API%20Reference/flutter/index.html)
Expand Down
10 changes: 2 additions & 8 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Agora 视频 SDK 需要 `摄像头` 和 `麦克风` 权限来开始视频通话

#### macOS

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

#### Windows

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

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

我们针对 Web SDK 有一个 [AgoraRtcWrapper.bundle.js](example/web/AgoraRtcWrapper.bundle.js)
包装库,所以需要在您的 `index.html` 中添加引用,可以参考 [example/web/index.html](example/web/index.html)

```html

<script src="AgoraRtcWrapper.bundle.js" type="application/javascript"></script>
```
我们针对 Web SDK 有一个 [AgoraRtcWrapper.bundle.js](assets/AgoraRtcWrapper.bundle.js) 包装库。

此包装库是 [Iris-Rtc-Web](https://github.com/AgoraIO-Community/Iris-Rtc-Web) 开源库的编译产物,它尝试将 Web SDK 接口映射成
Native SDK 接口,我们将其开源以便开发者定位和排查问题。
Expand Down
4 changes: 1 addition & 3 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ analyzer:
# Ignore generated files
- "**/*.g.dart"
- lib/src/generated/*.dart
- integration_test_app/**
- test/**

linter:
rules:
public_member_api_docs: false
- public_member_api_docs
2 changes: 2 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
.DS_Store
/build
/captures
libs/
.plugin_dev
21 changes: 14 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ rootProject.allprojects {
repositories {
mavenCentral()
google()
maven { url 'https://www.jitpack.io' }
}
}

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

android {
compileSdkVersion safeExtGet('compileSdkVersion', 31)
buildToolsVersion safeExtGet('buildToolsVersion', '31.0.0')

defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 31)

consumerProguardFiles 'consumer-rules.pro'
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

lintOptions {
disable 'InvalidPackage'
if (isDev(project)) {
main.jniLibs.srcDirs += 'libs'
}
}
}

dependencies {
api 'com.github.agorabuilder:iris-rtc:3.5.2'
if (isDev(project)) {
api fileTree(dir: "libs", include: ["*.jar", "*.aar"])
} else {
api 'io.agora.rtc:iris-rtc:3.6.2'
}

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${safeExtGet('kotlin_version', "$agora_rtc_engine_kt_version")}"
}

static boolean isDev(Project project) {
def devFile = project.file('.plugin_dev')
return devFile.exists()
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.content.Context
import android.view.View
import android.widget.FrameLayout
import io.agora.iris.rtc.IrisRtcEngine
import io.agora.iris.rtc.base.ApiTypeEngine
import io.flutter.plugin.common.BinaryMessenger
import io.flutter.plugin.common.ErrorLogResult
import io.flutter.plugin.common.MethodCall
Expand All @@ -17,7 +16,7 @@ private class PlatformViewApiTypeCallApiMethodCallHandler(
) : CallApiMethodCallHandler(irisRtcEngine) {
override fun callApi(apiType: Int, params: String?, sb: StringBuffer): Int {
platformView.updateView()
return irisRtcEngine.callApi(ApiTypeEngine.fromInt(apiType), params, platformView.getIrisRenderView(), sb)
return irisRtcEngine.callApi(apiType, params, platformView.getIrisRenderView(), sb)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.os.Looper
import android.util.Log
import androidx.annotation.NonNull
import io.agora.iris.rtc.IrisRtcEngine
import io.agora.iris.rtc.base.ApiTypeChannel
import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.plugin.common.BinaryMessenger
import io.flutter.plugin.common.EventChannel
Expand All @@ -18,11 +17,11 @@ private class ApiTypeChannelCallApiMethodCallHandler(
irisRtcEngine: IrisRtcEngine
) : CallApiMethodCallHandler(irisRtcEngine) {
override fun callApi(apiType: Int, params: String?, sb: StringBuffer): Int {
return irisRtcEngine.channel.callApi(ApiTypeChannel.fromInt(apiType), params, sb)
return irisRtcEngine.channel.callApi(apiType, params, sb)
}

override fun callApiWithBuffer(apiType: Int, params: String?, buffer: ByteArray?, sb: StringBuffer): Int {
return irisRtcEngine.channel.callApi(ApiTypeChannel.fromInt(apiType), params, buffer, sb)
return irisRtcEngine.channel.callApi(apiType, params, buffer, sb)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.util.Log
import androidx.annotation.NonNull
import io.agora.iris.base.IrisEventHandler
import io.agora.iris.rtc.IrisRtcEngine
import io.agora.iris.rtc.base.ApiTypeEngine
import io.agora.rtc.RtcEngine
import io.agora.rtc.base.RtcEngineRegistry
import io.flutter.BuildConfig
Expand Down Expand Up @@ -39,12 +38,11 @@ open class CallApiMethodCallHandler(
) : MethodCallHandler {

protected open fun callApi(apiType: Int, params: String?, sb: StringBuffer): Int {
val type = ApiTypeEngine.fromInt(apiType)
val ret = irisRtcEngine.callApi(type, params, sb)
if (type == ApiTypeEngine.kEngineInitialize) {
val ret = irisRtcEngine.callApi(apiType, params, sb)
if (apiType == 0) {
RtcEngineRegistry.instance.onRtcEngineCreated(irisRtcEngine.rtcEngine as RtcEngine?)
}
if (type == ApiTypeEngine.kEngineRelease) {
if (apiType == 1) {
RtcEngineRegistry.instance.onRtcEngineDestroyed()
}

Expand All @@ -56,13 +54,13 @@ open class CallApiMethodCallHandler(
params: String?,
buffer: ByteArray?,
sb: StringBuffer): Int {
return irisRtcEngine.callApi(ApiTypeEngine.fromInt(apiType), params, buffer, sb)
return irisRtcEngine.callApi(apiType, params, buffer, sb)
}

protected open fun callApiError(ret: Int): String {
val description = StringBuffer()
irisRtcEngine.callApi(
ApiTypeEngine.kEngineGetErrorDescription,
132,
"{\"code\":" + abs(ret) + "}",
description
)
Expand Down
2 changes: 2 additions & 0 deletions assets/AgoraRtcWrapper.bundle.js

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions assets/AgoraRtcWrapper.bundle.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0

THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.

See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */

/*! formdata-polyfill. MIT License. Jimmy W?rting <https://jimmy.warting.se/opensource> */

/*!@license
* UAParser.js v0.7.28
* Lightweight JavaScript-based User-Agent string parser
* https://github.com/faisalman/ua-parser-js
*
* Copyright © 2012-2021 Faisal Salman <f@faisalman.com>
* Licensed under MIT License
*/
15 changes: 15 additions & 0 deletions ci/run_flutter_integration_test_android.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -e
set -x

flutter packages get

bash integration_test_app/iris_integration_test/build-android.sh

pushd integration_test_app

flutter packages get
flutter test integration_test --dart-define=TEST_APP_ID="${TEST_APP_ID}"

popd
15 changes: 15 additions & 0 deletions ci/run_flutter_integration_test_ios.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -e
set -x

flutter packages get

bash integration_test_app/iris_integration_test/build-ios.sh

pushd integration_test_app

flutter packages get
flutter test integration_test --dart-define=TEST_APP_ID="${TEST_APP_ID}"

popd
Loading

0 comments on commit 9014e6e

Please sign in to comment.