Skip to content

instrumentisto/medea-flutter-webrtc

 
 

Repository files navigation

Medea Flutter-WebRTC

pub libwebrtc OpenAL

Changelog

WebRTC plugin for Flutter, designed for and used in Medea Jason WebRTC client, built on top of prebuilt libwebrtc binaries.

Initially, represented a fork of the Flutter-WebRTC plugin, but at the moment, there is almost nothing left from the initial upstream version due to a complete rewrite.

Supported platforms

How it works

Diagram

Usage

Add medea_flutter_webrtc as a dependency to your pubspec.yaml file.

Ensure that the following permissions are present in your AndroidManifest.xml file, located in <project_root>/android/app/src/main/AndroidManifest.xml:

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

If you need to use a Bluetooth device (like headphones), then also add:

<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />

The Flutter project template usually adds them, so they may already be there.

Also, you will need to set your build settings to Java 8, because the official WebRTC JAR on Android uses static methods in EglBase interface. Just add this to your app level build.gradle:

android {
    //...
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

If necessary, in the same build.gradle you need to increase minSdkVersion of defaultConfig up to 21 (currently, the default Flutter generator sets it to 16).

IMPORTANT: When you compile the release .apk, you need to add the following operations: Setup Proguard Rules.

Add the following entry to your Info.plist file, located in <project_root>/ios/Runner/Info.plist:

<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) Camera Usage!</string>
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) Microphone Usage!</string>

These entries allow your app to access camera and microphone.

Example

For more details, please see the medea_flutter_webrtc_example example.

License

Copyright © 2021-2024 Instrumentisto Team https://github.com/instrumentisto

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

The original upstream source code is licensed under MIT license with modifications following Apache License 2.0.

About

WebRTC plugin for Flutter, designed for and used in Medea Jason WebRTC client, built on top of prebuilt libwebrtc binaries.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dart 39.9%
  • Rust 29.9%
  • C++ 12.8%
  • Kotlin 8.1%
  • Swift 6.0%
  • CMake 1.2%
  • Other 2.1%