flutter_webrtc_fixed_v0_12_0 0.12.1
flutter_webrtc_fixed_v0_12_0: ^0.12.1 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.