/Agora-Flutter-SDK

Flutter wrapper around the Agora RTC SDKs for Android and iOS

Primary LanguageDartMIT LicenseMIT

Agora RTC SDK for Flutter

Pub.dev likes Pub.dev points
latest version Platform License RTE Dev Slack Link

中文

This Flutter plugin is a wrapper for Agora Video SDK

Agora.io provides building blocks for you to add real-time voice and video communications through a simple and powerful SDK. You can integrate the Agora SDK to enable real-time communications in your own application quickly.

Usage

To use this plugin, please add agora_rtc_engine as a dependency to your pubspec.yaml file.

Getting Started

  • Get some basic and advanced examples from the example folder.

Privacy Permission

Agora Video SDK requires Camera and Microphone permission to start a video call.

Android

See the required device permissions from the AndroidManifest.xml file.

<manifest>
  ...
  <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.RECORD_AUDIO" />
  <uses-permission android:name="android.permission.CAMERA" />
  <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.BLUETOOTH" />
  <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.WAKE_LOCK" />
  <uses-permission android:name="android.permission.READ_PRIVILEGED_PHONE_STATE"
    tools:ignore="ProtectedPermissions" />
  ...
</manifest>

iOS & macOS

Open the Info.plist and add:

  • Privacy - Microphone Usage Description,and add some description into the Value column.
  • Privacy - Camera Usage Description, and add some description into the Value column.

Flutter2 support

Null Safety

Null safety is supported from 4.0.1 version. This version is not backwards compatible, your project needs to be migrated to null safety. For more information, please refer to Migrating to null safety.

Multiple Platforms

Linux

Not support yet.

macOS

You can get more info from the agora_rtc_engine.podspec file, such as dependency Libraries on macOS.

Windows

You can get more info from the CMakeLists.text file, such as dependency Libraries on Windows.

Web

We use the js library to call JavaScript from the dart layer.

We have a wrapper library named AgoraRtcWrapper.bundle.js for the Web SDK.

This wrapper library is the output of the open-source repository 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 folder.

Error handling

Please check Pinned issues and search in Issues first.

Android

Android 9.0 Background Capture

iOS

Select your TARGET in Xcode, and click the Signing & Capabilities tab, then enable Background Modes and check Audio, AirPlay, and Picture in Picture.

Currently supported for Android and iOS.

Screen Sharing

Only supported on Web, macOS and Windows so far. Not yet supported for Android and iOS.

Important

You should set AppGroup on macOS and set as parameter before calling getScreenShareHelper.

You can refer to screen_sharing.dart and Apple doc.

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, Custom Video Source and Renderer, Raw Audio Data, etc.

agora_rtc_engine provides RtcEnginePlugin/RtcEnginePlugin, allowing you to to interact with the RtcEngine created on the Flutter side in the Android/iOS code, you can implement your own plugin by inheriting RtcEnginePlugin/RtcEnginePlugin, and get the RtcEngine/AgoraRtcEngineKit in the onRtcEngineCreated callback.

Please note that you should not call the RtcEngine.destroy/AgoraRtcEngineKit.destroy function on Android/iOS code, because it will affect the RtcEngine on the Flutter side. To see how to use RtcEnginePlugin, please check the custom audio source example:

Android: CustomCaptureAudioPlugin.kt

iOS: CustomCaptureAudioPlugin.swift

API Reference Resources

Feedback

If you have any problems or suggestions regarding the sample projects, feel free to file an issue.

How to contribute

To help work on this sdk, please refer to CONTRIBUTING.md.

Related resources

  • Check our FAQ to see if your issue has been recorded.
  • Dive into Agora SDK Samples to see more tutorials.
  • Take a look at Agora Use Case for more complicated real use case.
  • Repositories managed by developer communities can be found at Agora Community.
  • If you encounter problems during integration, feel free to ask questions in Stack Overflow.

License

The sample projects are under the MIT license.