fix camera position

This commit is contained in:
otsmr 2025-07-12 01:27:40 +02:00
parent 0177bf2a11
commit 3cab405ec3
3 changed files with 12 additions and 10 deletions

View file

@ -727,6 +727,9 @@ Future<bool> compressVideoIfExists(int mediaUploadId) async {
return false;
}
Stopwatch stopwatch = Stopwatch();
stopwatch.start();
MediaInfo? mediaInfo;
try {
mediaInfo = await VideoCompress.compressVideo(
@ -737,7 +740,9 @@ Future<bool> compressVideoIfExists(int mediaUploadId) async {
true, // https://github.com/jonataslaw/VideoCompress/issues/184
);
if (mediaInfo!.filesize! >= 30 * 1000 * 1000) {
Log.info("Video has now size of ${mediaInfo!.filesize} bytes.");
if (mediaInfo.filesize! >= 30 * 1000 * 1000) {
// if the media file is over 20MB compress it with low quality
mediaInfo = await VideoCompress.compressVideo(
videoOriginalFile.path,
@ -749,6 +754,8 @@ Future<bool> compressVideoIfExists(int mediaUploadId) async {
} catch (e) {
Log.error("during video compression: $e");
}
stopwatch.stop();
Log.info("It took ${stopwatch.elapsedMilliseconds}ms to compress the video");
if (mediaInfo == null) {
Log.error("could not compress video.");

View file

@ -22,8 +22,6 @@ class _HomeViewCameraPreviewState extends State<HomeViewCameraPreview> {
!HomeViewState.cameraController!.value.isInitialized) {
return Container();
}
bool isFront = HomeViewState.cameraController?.description.lensDirection ==
CameraLensDirection.front;
return Positioned.fill(
child: MediaViewSizing(
child: Screenshot(
@ -38,12 +36,7 @@ class _HomeViewCameraPreviewState extends State<HomeViewCameraPreview> {
HomeViewState.cameraController!.value.previewSize!.height,
height:
HomeViewState.cameraController!.value.previewSize!.width,
child: Transform(
alignment: Alignment.center,
transform: Matrix4.rotationY(
(isFront && Platform.isAndroid) ? 3.14 : 0),
child: CameraPreview(HomeViewState.cameraController!),
),
child: CameraPreview(HomeViewState.cameraController!),
),
),
),

View file

@ -497,7 +497,9 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
width: 20,
height: 20,
child: CircularProgressIndicator(
strokeWidth: 1, color: context.color.primary),
strokeWidth: 1,
color: context.color.primary,
),
),
),
if (!sharePreviewIsShown &&