Skip to content

armgit / ente

Public Imported from GitHub
0

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

refactor: Use separate _stopped bool instead of token state

Prateek Sunal98f22147731d
diff --git a/mobile/apps/photos/lib/services/video_preview_service.dart b/mobile/apps/photos/lib/services/video_preview_service.dart
index 2069550324..191eb20ce8 100644
--- a/mobile/apps/photos/lib/services/video_preview_service.dart
+++ b/mobile/apps/photos/lib/services/video_preview_service.dart
@@ -98,6 +98,7 @@ class VideoPreviewService {
int uploadingFileId = -1;
CancelToken? _streamingCancelToken;
int? _currentFfmpegSessionId;
+ bool _stopped = false;
final Configuration config;
final ServiceLocator serviceLocator;
@@ -139,10 +140,11 @@ class VideoPreviewService {
_items.clear();
}
- bool get _isStopped => _streamingCancelToken?.isCancelled ?? false;
+ bool get _isStopped => _stopped;
/// Stop streaming immediately, cancels FFmpeg and network requests.
Future<void> stop() async {
+ _stopped = true;
_streamingCancelToken?.cancel();
uploadingFileId = -1;
clearQueue();
@@ -1313,7 +1315,8 @@ class VideoPreviewService {
bool forceProcess = false,
}) {
Future.delayed(duration, () async {
- _streamingCancelToken = null; // Reset for new session
+ _stopped = false;
+ _streamingCancelToken = null;
if (_hasQueuedFile && !forceProcess) return;
// Don't start streaming if file uploads are in progress