Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Fix most of the seekbar issues when turning off looping videos

ashilknf8593255ac24
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 015e6eb5ef..f57d772566 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
@@ -2,6 +2,7 @@ import "dart:async";
import "package:flutter/material.dart";
import "package:native_video_player/native_video_player.dart";
+import "package:photos/core/configuration.dart";
import "package:photos/theme/colors.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/utils/debouncer.dart";
@@ -136,16 +137,21 @@ class _SeekBarState extends State<SeekBar> with SingleTickerProviderStateMixin {
}
void _onPlaybackPositionChanged() async {
- if (widget.controller.playbackInfo?.status == PlaybackStatus.paused) {
+ if (widget.controller.playbackInfo?.status == PlaybackStatus.paused ||
+ (widget.controller.playbackInfo?.status == PlaybackStatus.stopped &&
+ widget.controller.playbackInfo?.positionFraction != 0)) {
return;
}
final target = widget.controller.playbackInfo?.positionFraction ?? 0;
- //To immediately set the position to 0 when the ends when playing in loop
+ //To immediately set the position to 0 when the video ends
if (_prevPositionFraction == 1.0 && target == 0.0) {
setState(() {
_animationController.value = 0;
});
+ if (!Configuration.instance.shouldLoopVideo()) {
+ return;
+ }
}
//There is a slight delay (around 350 ms) for the event being listened to