truvideo_camera_sdk 1.0.3-beta.2
truvideo_camera_sdk: ^1.0.3-beta.2 copied to clipboard
Access the device camera to capture photos and videos, saving them in the app’s storage and returning file paths for use.
Truvideo Camera SDK #
This plugin integrates TruvideoCameraSdk for capturing photos and videos.
Supported Platforms #
- ✅ Android
- ✅ iOS
Features #
- Opens the camera with configurations
- Supports front/rear camera selection
- Captures images and records videos
- Handles camera events
- AR Camera with augmented reality overlays (iOS: ARKit, Android: ARCore)
- Smart Scanner QR/barcode detection
- Check AR hardware support and required AR framework installation
Requirements #
- Flutter SDK
- TruvideoCameraSdk Plugin
Setup #
- Add TruvideoCameraSdk Plugin to your project.
- Install dependencies:
flutter pub get - Ensure proper permissions in
AndroidManifest.xml&Info.plist. - Run the app:
flutter run
Usage #
-
Listen to camera events:
TruvideoCameraSdk.events.listen((event) { print("Event: \${event.type}, Data: \${event.data?.toJson()}"); }); -
Open camera:
final config = CameraConfiguration( lensFacing: TruvideoSdkCameraLensFacing.front, flashMode: TruvideoSdkCameraFlashMode.off, orientation: TruvideoSdkCameraOrientation.portrait, outputPath: outputPath ?? '', mode: CameraMode.videoAndImage(videoMaxCount: 3, imageMaxCount: 5, durationLimit: 60), ); List<TruvideoSdkCameraMedia> result = await TruvideoCameraSdk.openCamera(configuration: config); for (var media in result) { print('Captured: ${media.filePath} – ${media.type}'); } -
Open AR Camera
Future<void> openARCamera() async {
final dir = await getApplicationDocumentsDirectory();
// You can have your custom path here
final outputPath = '${dir.path}/ar_gallery';
await Directory(outputPath).create(recursive: true);
final config = ArCameraConfiguration(
orientation: TruvideoSdkCameraOrientation.portrait,
outputPath: outputPath,
mode:CameraMode.videoAndImage(),
);
try {
List<TruvideoSdkCameraMedia> result =
await TruvideoCameraSdk.openArCamera(configuration: config);
for (var media in result) {
print('Captured: ${media.filePath} – ${media.type}');
}
} on PlatformException catch (e) {
print('AR Camera error: ${e.message}');
}
}
- Open Scanner
Future<void> openScanner() async {
try {
String? result = await TruvideoCameraSdk.openScanner();
if (result != null) {
print('Result text: $result');
} else {
print('Result not found or scanner cancelled by user');
}
} on PlatformException catch (e) {
print('Scanner error: ${e.message}');
}
}
License #
MIT #
Support #
If you have any questions or suggestions regarding the SDK, please contact us at [email protected].