Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RTCEdgeEngine

An open-source Flutter SDK for Real-Time Video Calling using WebRTC, Firestore & Firebase Cloud Messaging


Overview

RTCEdgeEngine is a cross-platform Flutter SDK that enables seamless real-time video calling experiences — from one-to-one private calls to one-to-many monetized sessions.

It’s built on top of WebRTC, Firebase Firestore, and Firebase Cloud Messaging (FCM) for signaling and call notifications, offering a complete end-to-end communication layer.

📦 The package also includes an example project, TubeCaller, demonstrating anonymous calling, an online users dashboard, and real-time call handling.


Features

  • 1-to-1 and 1-to-Many Calls using WebRTC.
  • Signaling via Firestore (no custom signaling server required).
  • Incoming Call Notifications powered by Firebase Cloud Messaging.
  • Works in Foreground, Background, or App Killed States.
  • Built with Clean Architecture principles.
  • Ready-to-use UI components (call screen, picker, etc.).
  • Example app (TubeCaller) for quick integration reference.

Architecture


┌──────────────────────────────────────────────┐
│                RTCEdgeEngine                │
│----------------------------------------------│
│  • WebRTC Core (Media + Peer Connections)    │
│  • Firestore Signaling                       │
│  • FCM Integration                           │
│  • Call Manager + Interface Handler          │
│----------------------------------------------│
│      Built on: Flutter + Firebase + WebRTC   │
└──────────────────────────────────────────────┘
│
▼
┌──────────────────────────────┐
│        TubeCaller App        │
│ - Anonymous calling          │
│ - Online users list          │
│ - Dashboard UI               │
│ - Call notification handling │
└──────────────────────────────┘


Example Project — TubeCaller

TubeCaller is a fully functional example included with RTCEdgeEngine.
It showcases:

  • Anonymous calling using RTCEdgeEngine.
  • Live online user list and availability tracking via Firestore.
  • Call invitations and signaling management.
  • FCM-powered call notifications (even when app is killed).

You can use it as a boilerplate to build your own video calling app.


Getting Started

1️⃣ Prerequisites

  • Flutter SDK ≥ 3.0.0
  • Firebase Project (with Firestore & Cloud Messaging enabled)
  • Android Studio / Xcode setup for native builds

2️⃣ Clone the Repository

git clone https://github.com/yourusername/RTCEdgeEngine.git
cd RTCEdgeEngine

3️⃣ Setup Firebase

  1. Create a project in Firebase Console.

  2. Enable:

    • Firestore Database
    • Cloud Messaging (FCM)
  3. Download your Firebase configuration files:

    • google-services.json → place in /android/app/
    • GoogleService-Info.plist → place in /ios/Runner/
  4. Add Firebase plugins to your pubspec.yaml:

dependencies:
  firebase_core: ^3.0.0
  cloud_firestore: ^5.0.0
  firebase_messaging: ^15.0.0
  flutter_webrtc: ^0.10.0

4️⃣ Initialize Firebase

In your main.dart file:

import 'package:firebase_core/firebase_core.dart';
import 'package:rtcedge_engine/rtcedge_engine.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  runApp(MyApp());
}

5️⃣ Basic Usage

Here’s how to set up and start a call:

import 'package:rtcedge_engine/rtcedge_engine.dart';

final rtcEngine = RTCEdgeEngine();

Future<void> initRTC() async {
  await rtcEngine.initialize(
    signalingCollection: "calls",
  );

  rtcEngine.onIncomingCall = (callerId) {
    print("Incoming call from $callerId");
    rtcEngine.showCallPicker(context, callerId);
  };
}

Future<void> makeCall(String targetUserId) async {
  await rtcEngine.startCall(targetUserId: targetUserId);
}

6️⃣ Handling Incoming Calls with FCM

Register the FCM listener for background/killed state notifications:

FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
  final callerId = message.data['callerId'];
  rtcEngine.showIncomingCallScreen(callerId);
});

Package Structure

RTCEdgeEngine/
├── lib/
│   ├── src/
│   │   ├── signaling/
│   │   ├── call_manager.dart
│   │   ├── rtc_service.dart
│   │   ├── notification_service.dart
│   │   └── ui/
│   └── rtcedge_engine.dart
├── example/
│   └── tube_caller/
└── README.md

Example Commands

Run the example TubeCaller app:

cd example/tube_caller
flutter pub get
flutter run

Contributing

We welcome contributions! 🎉

  1. Fork the repository
  2. Create a new feature branch
  3. Commit your changes with clear messages
  4. Submit a Pull Request

Make sure to follow Flutter best practices and keep the code well-documented.


License

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


WebRTC Signaling & Notification Flow

Below is a simplified overview of how RTCEdgeEngine handles call setup, signaling, and notifications:

sequenceDiagram
    participant Caller
    participant Firestore
    participant FCM
    participant Receiver
    participant RTCEngine

    Caller->>RTCEngine: Start call (createOffer)
    RTCEngine->>Firestore: Save offer SDP in "calls" collection
    Firestore->>Receiver: Trigger Firestore listener
    Receiver->>RTCEngine: Read offer and createAnswer
    RTCEngine->>Firestore: Save answer SDP
    Firestore->>Caller: Update with answer SDP
    Caller->>RTCEngine: Set remote description (answer)

    par ICE Exchange
        Caller->>Firestore: Push ICE candidates
        Receiver->>Firestore: Push ICE candidates
    end

    Note over Caller,Receiver: WebRTC PeerConnection established 🎥

    FCM-->>Receiver: Send incoming call push notification
    Receiver->>RTCEngine: Show call picker (app in background/killed)
Loading

Summary

RTCEdgeEngine empowers Flutter developers to build scalable, Firebase-integrated video calling apps with minimal setup — combining WebRTC, Firestore, and FCM into one clean, modular SDK.

Start with TubeCaller, and you’ll have an end-to-end working demo in minutes.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages