flutter_webrtc_fixed_v0_12_0 0.12.2
flutter_webrtc_fixed_v0_12_0: ^0.12.2 copied to clipboard
Flutter WebRTC plugin for iOS/Android/Destkop/Web, based on GoogleWebRTC. Fixed version with improvements and bug fixes.
๐ Flutter WebRTC Fixed v0.12.0 #
๐ฏ 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
Enterprise Grade APIs for Feeds, Chat, & Video. Try the Flutter Video tutorial ๐ฌ
LiveKit - Open source WebRTC infrastructure
๐ฆ Installation #
๐ฏ Quick Start (Recommended) #
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
- flutter-tizen: https://github.com/flutter-tizen/plugins/tree/master/packages/flutter_webrtc
- flutter-elinux(WIP): https://github.com/sony/flutter-elinux-plugins/issues/7
๐ ๏ธ 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) andAndroidManifest.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:
- ๐ด Fork the repository
- ๐ฟ Create a feature branch (
git checkout -b feature/amazing-feature
) - โ๏ธ Make your changes
- ๐งช Test thoroughly
- ๐ค 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.