fix: remove rotate property, add scroll widget in failure or any dialog, seekbar smooth, player ux buttons same position, failure title for preview

This commit is contained in:
Prateek Sunal
2025-02-28 21:43:35 +05:30
parent 11a42e7ee3
commit fcbba19129
6 changed files with 20 additions and 19 deletions

View File

@@ -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" '

View File

@@ -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),
],
),
),
),
);

View File

@@ -144,6 +144,7 @@ class _BackupItemCardState extends State<BackupItemCard> {
),
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<BackupItemCard> {
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,
);
},

View File

@@ -92,7 +92,7 @@ class _SeekBarState extends State<SeekBar> with SingleTickerProviderStateMixin {
});
_seekTo(value);
},
divisions: widget.duration ?? 4500,
divisions: 4500,
onChangeEnd: (value) {
setState(() {
_animationController.value = value;

View File

@@ -34,7 +34,7 @@ class VideoWidget extends StatefulWidget {
class _VideoWidgetState extends State<VideoWidget> {
final showControlsNotifier = ValueNotifier<bool>(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<VideoWidget> {
if (widget.controller.player.state.playing) {
_hideControlsDebouncer.run(() async {
showControlsNotifier.value = false;
widget.playbackCallback?.call(false);
widget.playbackCallback?.call(true);
});
}
}

View File

@@ -487,6 +487,7 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
void _onPlaybackEnded() async {
await _controller?.stop();
if (localSettings.shouldLoopVideo()) {
Bus.instance.fire(SeekbarTriggeredEvent(position: 0));
await _controller?.play();
}
}