From fcbba19129f801de4ef2454f68837f87cce526ff Mon Sep 17 00:00:00 2001 From: Prateek Sunal Date: Fri, 28 Feb 2025 21:43:35 +0530 Subject: [PATCH] fix: remove rotate property, add scroll widget in failure or any dialog, seekbar smooth, player ux buttons same position, failure title for preview --- mobile/lib/services/preview_video_store.dart | 4 ---- mobile/lib/ui/components/dialog_widget.dart | 24 ++++++++++--------- .../ui/settings/backup/backup_item_card.dart | 4 +++- .../seek_bar.dart | 2 +- .../file/video_widget_media_kit_common.dart | 4 ++-- .../ui/viewer/file/video_widget_native.dart | 1 + 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/mobile/lib/services/preview_video_store.dart b/mobile/lib/services/preview_video_store.dart index 787d3e5891..47463ef6e3 100644 --- a/mobile/lib/services/preview_video_store.dart +++ b/mobile/lib/services/preview_video_store.dart @@ -227,7 +227,6 @@ class PreviewVideoStore { if (bitrate != null && bitrate <= 4000 * 1000 && codecIsH264) { session = await FFmpegKit.execute( '-i "${file.path}" ' - '-metadata:s:v:0 rotate=0 ' '-c:v copy -c:a copy ' '-f hls -hls_time 2 -hls_flags single_file ' '-hls_list_size 0 -hls_key_info_file ${keyinfo.path} ' @@ -240,7 +239,6 @@ class PreviewVideoStore { !codecIsH264) { session = await FFmpegKit.execute( '-i "${file.path}" ' - '-metadata:s:v:0 rotate=0 ' '-vf "format=yuv420p10le,zscale=transfer=linear,tonemap=tonemap=hable:desat=0:peak=10,zscale=transfer=bt709:matrix=bt709:primaries=bt709,format=yuv420p" ' '-color_primaries bt709 -color_trc bt709 -colorspace bt709 ' '-c:v libx264 -crf 23 -preset medium ' @@ -253,7 +251,6 @@ class PreviewVideoStore { else if (colorSpace != null && isColorGood) { session = await FFmpegKit.execute( '-i "${file.path}" ' - '-metadata:s:v:0 rotate=0 ' '-vf "scale=-2:720,fps=30" ' '-c:v libx264 -b:v 2000k -crf 23 -preset medium ' '-c:a aac -b:a 128k -f hls -hls_time 2 -hls_flags single_file ' @@ -264,7 +261,6 @@ class PreviewVideoStore { else { session = await FFmpegKit.execute( '-i "${file.path}" ' - '-metadata:s:v:0 rotate=0 ' '-vf "scale=-2:720,fps=30,format=yuv420p10le,zscale=transfer=linear,tonemap=tonemap=hable:desat=0:peak=10,zscale=transfer=bt709:matrix=bt709:primaries=bt709,format=yuv420p" ' '-color_primaries bt709 -color_trc bt709 -colorspace bt709 ' '-x264-params "colorprim=bt709:transfer=bt709:colormatrix=bt709" ' diff --git a/mobile/lib/ui/components/dialog_widget.dart b/mobile/lib/ui/components/dialog_widget.dart index 0dbf491177..1bab11669d 100644 --- a/mobile/lib/ui/components/dialog_widget.dart +++ b/mobile/lib/ui/components/dialog_widget.dart @@ -78,17 +78,19 @@ class DialogWidget extends StatelessWidget { ), child: Padding( padding: const EdgeInsets.all(16), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - ContentContainer( - title: title, - body: body, - icon: icon, - ), - const SizedBox(height: 36), - Actions(buttons), - ], + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ContentContainer( + title: title, + body: body, + icon: icon, + ), + const SizedBox(height: 36), + Actions(buttons), + ], + ), ), ), ); diff --git a/mobile/lib/ui/settings/backup/backup_item_card.dart b/mobile/lib/ui/settings/backup/backup_item_card.dart index da00498ca3..84d9272853 100644 --- a/mobile/lib/ui/settings/backup/backup_item_card.dart +++ b/mobile/lib/ui/settings/backup/backup_item_card.dart @@ -144,6 +144,7 @@ class _BackupItemCardState extends State { ), onPressed: () { String errorMessage = ""; + bool isPreview = false; if (widget.item.error is Exception) { final Exception ex = widget.item.error as Exception; errorMessage = "Error: " + @@ -154,10 +155,11 @@ class _BackupItemCardState extends State { errorMessage = widget.item.error.toString(); } else if (widget.preview?.error != null) { errorMessage = widget.preview!.error!.toString(); + isPreview = true; } showErrorDialog( context, - 'Upload failed', + isPreview ? "Preview upload ailed" : 'Upload failed', errorMessage, ); }, diff --git a/mobile/lib/ui/viewer/file/native_video_player_controls/seek_bar.dart b/mobile/lib/ui/viewer/file/native_video_player_controls/seek_bar.dart index c3a9e80f8c..226a33224d 100644 --- a/mobile/lib/ui/viewer/file/native_video_player_controls/seek_bar.dart +++ b/mobile/lib/ui/viewer/file/native_video_player_controls/seek_bar.dart @@ -92,7 +92,7 @@ class _SeekBarState extends State with SingleTickerProviderStateMixin { }); _seekTo(value); }, - divisions: widget.duration ?? 4500, + divisions: 4500, onChangeEnd: (value) { setState(() { _animationController.value = value; diff --git a/mobile/lib/ui/viewer/file/video_widget_media_kit_common.dart b/mobile/lib/ui/viewer/file/video_widget_media_kit_common.dart index c3791d757e..a3e5b5929e 100644 --- a/mobile/lib/ui/viewer/file/video_widget_media_kit_common.dart +++ b/mobile/lib/ui/viewer/file/video_widget_media_kit_common.dart @@ -34,7 +34,7 @@ class VideoWidget extends StatefulWidget { class _VideoWidgetState extends State { final showControlsNotifier = ValueNotifier(true); - static const verticalMargin = 72.0; + static const double verticalMargin = 64; final _hideControlsDebouncer = Debouncer( const Duration(milliseconds: 2000), ); @@ -74,7 +74,7 @@ class _VideoWidgetState extends State { if (widget.controller.player.state.playing) { _hideControlsDebouncer.run(() async { showControlsNotifier.value = false; - widget.playbackCallback?.call(false); + widget.playbackCallback?.call(true); }); } } diff --git a/mobile/lib/ui/viewer/file/video_widget_native.dart b/mobile/lib/ui/viewer/file/video_widget_native.dart index 3d4578e549..f91b10d53e 100644 --- a/mobile/lib/ui/viewer/file/video_widget_native.dart +++ b/mobile/lib/ui/viewer/file/video_widget_native.dart @@ -487,6 +487,7 @@ class _VideoWidgetNativeState extends State void _onPlaybackEnded() async { await _controller?.stop(); if (localSettings.shouldLoopVideo()) { + Bus.instance.fire(SeekbarTriggeredEvent(position: 0)); await _controller?.play(); } }