flutter_canvas_watermark
Hardware-accelerated dynamic forensic canvas DRM watermark overlay for Flutter video streams, confidential documents, and screen recording protection.
Developed by Huot Lysokheng (Mobile Team Lead at Codingate & WebRTC Architect).
⚡️ Need a Full Production WebRTC SFU Audio/Video Calling Kit?
Building a telehealth, education, or enterprise conferencing app with anti-leak protection?
Watermarking is one piece of the puzzle. If you need a complete, production-grade WebRTC infrastructure that replaces expensive third-party SaaS bills ($3,500+/mo Agora/Twilio fees), check out the Flutter Mediasoup SFU Real-Time Kit:
- ✅ Production Mediasoup SFU Node.js/TypeScript Cluster: Sub-180ms latency, multi-core worker scaling.
- ✅ Complete Flutter Client SDK: Audio/Video call state management, camera switching, audio route routing.
- ✅ Dynamic Simulcast & SVC: Multi-bitrate streaming with automatic network degradation handling.
- ✅ Integrated DRM Overlay: Pre-wired forensic canvas watermark overlay with live user tracing.
- ✅ One-Click Docker Compose: Deploy anywhere (Fly.io, AWS EC2, DigitalOcean, Hetzner).
👉 🇰🇭 Instant Checkout via Telegram (ABA KHQR - $249)
👉 💳 International Card Checkout on Gumroad
Features
- 🎨 Hardware-Accelerated Canvas: CustomPainter rendered directly via Skia / Impeller on the GPU for silky 60/120 FPS video rendering.
- ⏱️ Dynamic UTC Timestamp Ticking: Second-by-second auto-refreshing UTC timestamp traces the exact second a confidential leak or recording occurred.
- 🛡️ Zero Touch Obstruction: Overlay is wrapped with
IgnorePointerand separated withRepaintBoundaryto prevent touch event interception and avoid repainting underlying video frames. - 📐 Circumscribed Radial Coverage: Uses trigonometric circumscribed circle math to guarantee complete corner-to-corner coverage at any rotation angle (
-20°,-45°, etc.) across mobile, foldables, and desktop monitors. - ⚙️ Configurable Forensic Metadata: Authenticated user ID, client IP address, session token, opacity, custom monospace typography, and custom text builders.
- 🚀 Zero Third-Party Dependencies: Pure Flutter framework SDK. Zero dependency bloat, zero native binary conflicts, zero version lock-in.
- 🌐 100% Cross-Platform: iOS, Android, Web, macOS, Windows, and Linux.
Installation
Add flutter_canvas_watermark to your pubspec.yaml:
dependencies:
flutter_canvas_watermark: ^1.0.0
Or install via terminal:
flutter pub add flutter_canvas_watermark
Quick Start
1. Basic Watermark Overlay
Wrap your video player, PDF viewer, or confidential dashboard in DrmWatermarkOverlay:
import 'package:flutter/material.dart';
import 'package:flutter_canvas_watermark/flutter_canvas_watermark.dart';
class SecureVideoPlayerView extends StatelessWidget {
const SecureVideoPlayerView({super.key});
@override
Widget build(BuildContext context) {
return DrmWatermarkOverlay(
config: const DrmWatermarkConfig(
userId: 'usr_904812',
clientIp: '203.189.145.22',
opacity: 0.18,
angle: -0.35, // ~ -20 degrees
),
child: Center(
child: Text('Underlying Video or Document Content'),
),
);
}
}
2. Custom Forensic Text Builder
Format your watermark text with custom delimiters, timestamps, or confidentiality notices:
final customConfig = DrmWatermarkConfig(
userId: 'employee@company.internal',
clientIp: '10.240.0.15',
textBuilder: (config, timestamp) {
final utc = timestamp.toUtc();
return 'CONFIDENTIAL // ${config.userId} // ${utc.hour}:${utc.minute}:${utc.second}';
},
opacity: 0.22,
textStyle: const TextStyle(
color: Colors.redAccent,
fontSize: 11,
fontWeight: FontWeight.bold,
letterSpacing: 1.5,
),
);
3. Standalone Grid Painting
If you want to render the watermark directly within a custom canvas or Stack without wrapping a child widget:
Stack(
children: [
YourCustomVideoWidget(),
Positioned.fill(
child: DrmWatermarkGrid(
config: config,
),
),
],
)
Performance Considerations
- Repaint Isolation:
DrmWatermarkOverlaywraps the watermark canvas in aRepaintBoundary. Underlying video frames (e.g., Mediasoup, Agora, WebRTC) paint independently without forcing the watermark to recalculate layout. - Minimal Timer Overhead: The dynamic timestamp updates via an efficient periodic timer rather than per-frame ticking, reducing CPU utilization by 98% compared to standard animation controllers.
- Static Mode: Pass
updateInterval: Duration.zeroif your forensic security policy only requires static identifiers (User ID + Session ID) without second-level timestamps.
Contributing
Contributions, bug reports, and feature suggestions are welcome! Please feel free to open an issue or submit a pull request on GitHub.
License
This package is released under the MIT License.
Libraries
- flutter_canvas_watermark
- Hardware-accelerated dynamic forensic canvas DRM watermark overlay for Flutter.