Files
external-cam/lib/jpeg_encoder.dart
Kai Chappell 1660696d7f wireless camera app for Android
Stream a phone's camera to a tablet over WiFi/hotspot.
WebSocket transport with native YUV-to-JPEG encoding,
UDP auto-discovery, remote control (zoom, flash, camera switch,
rotate, mirror) from the viewer.
2026-03-06 18:14:27 +00:00

19 lines
611 B
Dart

import 'package:camera/camera.dart';
import 'package:flutter/services.dart';
const _channel = MethodChannel('com.kschappell.external_cam/jpeg');
Future<Uint8List?> encodeJpeg(CameraImage image, {int quality = 50}) async {
return _channel.invokeMethod<Uint8List>('encodeJpeg', {
'width': image.width,
'height': image.height,
'y': image.planes[0].bytes,
'u': image.planes[1].bytes,
'v': image.planes[2].bytes,
'yRowStride': image.planes[0].bytesPerRow,
'uvRowStride': image.planes[1].bytesPerRow,
'uvPixelStride': image.planes[1].bytesPerPixel,
'quality': quality,
});
}