flutter_deepar_agora
A bridge plugin that pipes DeepAR AR-processed frames directly into Agora RTC as an external video source. One-liner integration for AR filters in live streams.
Features
- ๐ Automatic frame forwarding from DeepAR โ Agora
- ๐ญ Convenience methods for effect loading and camera switching
- ๐ Frame count tracking
- ๐งน Clean start/stop lifecycle
Getting Started
1. Install
dependencies:
flutter_deepar_agora: ^0.1.0
# This automatically pulls flutter_deepar and agora_rtc_engine
2. Usage
import 'package:flutter_deepar_agora/flutter_deepar_agora.dart';
import 'package:agora_rtc_engine/agora_rtc_engine.dart';
// 1. Initialize DeepAR
final deepar = DeepARController();
await deepar.initialize(licenseKey: 'YOUR_DEEPAR_KEY');
// 2. Initialize Agora with external video source
final agoraEngine = createAgoraRtcEngine();
await agoraEngine.initialize(RtcEngineContext(appId: 'YOUR_AGORA_APP_ID'));
await agoraEngine.getMediaEngine().setExternalVideoSource(
enabled: true,
useTexture: false,
);
// 3. Create the bridge โ this is all you need!
final bridge = DeepARAgoraBridge(
deepAR: deepar,
agoraEngine: agoraEngine,
);
// 4. Start capture and forwarding
await deepar.startCapture();
await bridge.startForwarding();
// AR-processed frames now flow into Agora automatically!
// 5. Load effects
await bridge.loadEffect('effects/my_filter.deepar');
// 6. Stop when done
bridge.stopForwarding();
await deepar.stopCapture();
bridge.dispose();
How It Works
The bridge subscribes to DeepARController.frameStream and pushes each frame to Agora via MediaEngine.pushVideoFrame(). It handles:
- RGBA (Android) and BGRA (iOS) format detection
- Frame timestamping
- Error resilience (frame push failures are non-fatal)
License
MIT License. See LICENSE for details.
Libraries
- flutter_deepar_agora
- Bridge plugin that pipes DeepAR AR-processed frames directly into Agora RTC as an external video source.