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.
This commit is contained in:
18
lib/jpeg_encoder.dart
Normal file
18
lib/jpeg_encoder.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
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,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user