Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Upgrade native sdk 3.6.2 #651

Merged
merged 4 commits into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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/
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,6 @@ This wrapper library is the output of the open-source repository [Iris-Rtc-Web](

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

LichKing-2234 marked this conversation as resolved.
Show resolved Hide resolved
## Interact with RtcEngine/AgoraRtcEngineKit on Android/iOS
LichKing-2234 marked this conversation as resolved.
Show resolved Hide resolved

`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 +129,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
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
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