Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix: set defailt time to 10 seconds if the video duration is null & avoid un-necessary playbackCallback is isFromMemories is true

AmanRajSinghMourya19eb3a51416e
diff --git a/mobile/lib/ui/viewer/file/video_widget_media_kit_new.dart b/mobile/lib/ui/viewer/file/video_widget_media_kit_new.dart
index 5ff3b636bb..021263395c 100644
--- a/mobile/lib/ui/viewer/file/video_widget_media_kit_new.dart
+++ b/mobile/lib/ui/viewer/file/video_widget_media_kit_new.dart
@@ -262,8 +262,11 @@ class _VideoWidgetMediaKitNewState extends State<VideoWidgetMediaKitNew>
}
player.open(Media(url), play: _isAppInFG);
});
- final duration = controller!.player.state.duration.inSeconds;
- widget.onFinalFileLoad?.call(
+ int duration = controller!.player.state.duration.inSeconds;
+ if (duration == 0) {
+ duration = 10;
+ }
+ widget.onFinalFileLoad?.call(
memoryDuration: duration,
);
}
diff --git a/mobile/lib/ui/viewer/file/video_widget_native.dart b/mobile/lib/ui/viewer/file/video_widget_native.dart
index 741077e12a..acf428482f 100644
--- a/mobile/lib/ui/viewer/file/video_widget_native.dart
+++ b/mobile/lib/ui/viewer/file/video_widget_native.dart
@@ -465,6 +465,7 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
}
void _seekListener() {
+ if (widget.isFromMemories) return;
if (!_isSeeking.value &&
_controller?.playbackStatus == PlaybackStatus.playing) {
_debouncer.run(() async {
@@ -483,6 +484,7 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
}
void _onPlaybackStatusChanged() {
+ if (widget.isFromMemories) return;
final duration = widget.file.duration != null
? widget.file.duration! * 1000
: _controller?.videoInfo?.durationInMilliseconds;
@@ -527,7 +529,7 @@ class _VideoWidgetNativeState extends State<VideoWidgetNative>
Future<void> _onPlaybackReady() async {
if (_isPlaybackReady.value) return;
await _controller!.play();
- final durationInSeconds = durationToSeconds(duration) ?? 0;
+ final durationInSeconds = durationToSeconds(duration) ?? 10;
widget.onFinalFileLoad?.call(memoryDuration: durationInSeconds);
unawaited(_controller!.setVolume(1));
_isPlaybackReady.value = true;