๐Ÿš€ Flutter WebRTC Fixed v0.12.0

pub package GitHub stars License Flutter WebRTC

๐ŸŽฏ Production-Ready WebRTC Plugin for Flutter

Cross-platform real-time communication with enhanced stability and performance


โœจ What's New

๐ŸŽ‰ This is a fixed and improved version of the original flutter_webrtc package with:

  • ๐Ÿ”ง Enhanced Stability - Additional bug fixes and optimizations
  • ๐Ÿš€ Production Ready - Tested and optimized for production use
  • ๐Ÿ“ฑ Cross-Platform - iOS, Android, Web, macOS, Windows, Linux support
  • ๐Ÿ› ๏ธ Easy Integration - Simple API with comprehensive documentation

Sponsored with ๐Ÿ’–   by
Stream Chat
Enterprise Grade APIs for Feeds, Chat, & Video. Try the Flutter Video tutorial ๐Ÿ’ฌ


LiveKit
LiveKit - Open source WebRTC infrastructure

๐Ÿ“ฆ Installation

Add this to your package's pubspec.yaml file:

dependencies:
  flutter_webrtc_fixed_v0_12_0: ^0.12.0

Then run:

flutter pub get

๐Ÿ”— Alternative Installation Methods

๐Ÿ“ฅ From GitHub Repository
dependencies:
  flutter_webrtc_fixed_v0_12_0:
    git:
      url: https://github.com/boughdiri-dorsaf/flutter_webrtc_fixed_v0.12.0.git
      ref: main
๐Ÿ“ From Local Path
dependencies:
  flutter_webrtc_fixed_v0_12_0:
    path: ./flutter_webrtc_fixed_v0_12_0

๐Ÿš€ Features

๐ŸŒŸ Core Capabilities

๐ŸŽฏ Feature ๐Ÿค– Android ๐ŸŽ iOS ๐ŸŒ Web ๐Ÿ’ป macOS ๐ŸชŸ Windows ๐Ÿง Linux ๐Ÿ“ฑ Embedded
๐ŸŽฅ Audio/Video โœ… โœ… โœ… โœ… โœ… โœ… โœ…
๐Ÿ“ก Data Channel โœ… โœ… โœ… โœ… โœ… โœ… โœ…
๐Ÿ“บ Screen Capture โœ… โœ…* โœ… โœ… โœ… โœ… โœ…
๐Ÿ”„ Unified-Plan โœ… โœ… โœ… โœ… โœ… โœ… โœ…
๐Ÿ“Š Simulcast โœ… โœ… โœ… โœ… โœ… โœ… โœ…
๐ŸŽฌ MediaRecorder โš ๏ธ โš ๏ธ โœ… โŒ โŒ โŒ โŒ
๐Ÿ” End-to-End Encryption โœ… โœ… โœ… โœ… โœ… โœ… โœ…
๐Ÿ”Œ Insertable Streams โŒ โŒ โŒ โŒ โŒ โŒ โŒ

iOS Screen Sharing requires additional setup - See Guide

๐ŸŽจ Key Highlights

  • ๐ŸŽฏ Cross-Platform Support - Works seamlessly across all major platforms
  • ๐Ÿ”ง Production Ready - Battle-tested in real-world applications
  • ๐Ÿš€ High Performance - Optimized for low latency and high quality
  • ๐Ÿ›ก๏ธ Secure - Built-in encryption and security features
  • ๐Ÿ“ฑ Mobile First - Designed with mobile devices in mind
  • ๐ŸŒ Web Compatible - Full support for Flutter Web with WASM compatibility
  • ๐Ÿ“ฆ Swift Package Manager - Native iOS/macOS support via SPM
  • โšก Modern Web - WASM-compatible for better performance

Additional platform/OS support from the other community

๐Ÿ› ๏ธ Setup

๐Ÿ“ฑ iOS Setup

๐Ÿ”ง Required Permissions

Add the following entries 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>

This allows your app to access camera and microphone.

โš ๏ธ Important iOS Configuration

The WebRTC.xframework compiled after the m104 release no longer supports iOS arm devices. Add this to your ios/Podfile:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      # Workaround for https://github.com/flutter/flutter/issues/64502
      config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES' # <= this line
    end
  end
end

๐Ÿค– Android Setup

๐Ÿ”ง Required Permissions

Add these permissions to your AndroidManifest.xml file:

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
๐ŸŽง Bluetooth Support (Optional)

For Bluetooth device support, add these permissions:

<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" />
โš™๏ธ Java 8 Configuration

Add this to your app-level build.gradle:

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

๐Ÿ”ง Usage

๐Ÿš€ Quick Start

๐Ÿ“ก Basic WebRTC Setup
import 'package:flutter_webrtc_fixed_v0_12_0/flutter_webrtc_fixed_v0_12_0.dart';

// Create RTCPeerConnection
final configuration = {
  'iceServers': [
    {'urls': 'stun:stun.l.google.com:19302'},
  ]
};

RTCPeerConnection pc = await createPeerConnection(configuration);

// Add local stream
MediaStream localStream = await navigator.mediaDevices.getUserMedia({
  'audio': true,
  'video': true
});

localStream.getTracks().forEach((track) {
  pc.addTrack(track, localStream);
});
๐Ÿ“ฑ Complete Example App

Check out the complete example app that demonstrates:

  • Video capture and rendering
  • Peer connection management
  • Audio/video controls
  • Cross-platform compatibility

To run the example:

cd example
flutter pub get
flutter run
๐ŸŽฅ Video Rendering
RTCVideoRenderer localRenderer = RTCVideoRenderer();
RTCVideoRenderer remoteRenderer = RTCVideoRenderer();

@override
void initState() {
  super.initState();
  localRenderer.initialize();
  remoteRenderer.initialize();
}

@override
void dispose() {
  localRenderer.dispose();
  remoteRenderer.dispose();
  super.dispose();
}

// Set video stream
localRenderer.srcObject = localStream;
remoteRenderer.srcObject = remoteStream;

๐ŸŒ Web & WASM Support

โšก WASM Compatibility

This package includes WASM-compatible implementations for better web performance:

  • Modern Web Standards: Uses latest web APIs
  • Better Performance: WASM provides faster execution
  • Future-Proof: Ready for upcoming web technologies
  • Automatic Fallback: Gracefully falls back to standard web implementation
๐Ÿ“ฆ Swift Package Manager Support

Native iOS/macOS support via Swift Package Manager:

// Add to your Package.swift
dependencies: [
    .package(url: "https://github.com/boughdiri-dorsaf/flutter_webrtc_fixed_v0.12.0.git", from: "0.12.0")
]

Benefits:

  • Native Integration: Direct Swift/Objective-C integration
  • Better Performance: Optimized for iOS/macOS
  • Modern Tooling: Works with Xcode's modern build system
  • Dependency Management: Clean dependency resolution

๐Ÿ“‹ API Reference

๐Ÿ—๏ธ Core Classes

Class Description
RTCPeerConnection WebRTC peer connection management
MediaStream Audio/video stream handling
RTCVideoRenderer Video rendering widget
RTCDataChannel Data channel for messaging

๐Ÿ”ง Key Methods

Method Description
createPeerConnection(configuration) Create peer connection
getUserMedia(constraints) Get media stream
addTrack(track, stream) Add media track
createOffer() / createAnswer() Create SDP offer/answer
setLocalDescription(description) Set local SDP
setRemoteDescription(description) Set remote SDP

๐Ÿšจ Troubleshooting

๐Ÿ” Common Issues

๐Ÿ“ท Camera Permission Issues
  • Ensure camera permissions are properly set in platform-specific files
  • Check Info.plist (iOS) and AndroidManifest.xml (Android)
  • Verify runtime permission requests
๐ŸŽค Audio Issues
  • Check microphone permissions and audio settings
  • Verify audio device selection
  • Test with different audio configurations
๐ŸŒ Network Issues
  • Verify STUN/TURN server configuration
  • Check firewall and NAT settings
  • Test with different network conditions
๐ŸŽ iOS Build Issues
  • Ensure ONLY_ACTIVE_ARCH is set to 'YES' in Podfile
  • Check Xcode version compatibility
  • Verify iOS deployment target

๐Ÿ› Debug Information

// Check peer connection state
pc.onConnectionState = (RTCPeerConnectionState state) {
  print('Connection state: $state');
};

// Check ICE connection state
pc.onIceConnectionState = (RTCIceConnectionState state) {
  print('ICE connection state: $state');
};

๐Ÿค Contributing

We welcome contributions! Here's how you can help:

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒฟ Create a feature branch (git checkout -b feature/amazing-feature)
  3. โœ๏ธ Make your changes
  4. ๐Ÿงช Test thoroughly
  5. ๐Ÿ“ค Submit a pull request

๐Ÿ“‹ Contribution Guidelines

  • Follow the existing code style
  • Add tests for new features
  • Update documentation as needed
  • Ensure all tests pass

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ“ž Support

๐Ÿ†˜ Need Help?

  • ๐Ÿ› Report Issues: GitHub Issues
  • ๐Ÿ“– Documentation: Check the troubleshooting section above
  • ๐Ÿ” API Reference: Review the comprehensive API documentation
  • ๐Ÿ’ก This is a fixed version of the original flutter_webrtc package

๐ŸŒŸ Show Your Support

If this package helped you, please give it a โญ on GitHub!

๐Ÿ”„ Updates

This package is maintained and updated regularly. Check the CHANGELOG.md for version history and updates.


๐ŸŽฏ Ready to build amazing real-time communication apps?

Get Started View on GitHub

This version is optimized for production use and includes all necessary fixes and improvements.