π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fix: Duration computation from playlist
Neeraj Guptac392bd2fd286
diff --git a/mobile/lib/services/preview_video_store.dart b/mobile/lib/services/preview_video_store.dartindex 732050197c..c8e4d7aa89 100644--- a/mobile/lib/services/preview_video_store.dart+++ b/mobile/lib/services/preview_video_store.dart@@ -653,13 +653,21 @@ class PreviewVideoStore {int? parseDurationFromHLS(String playlist) {final lines = playlist.split("\n");+ double totalDuration = 0.0;for (final line in lines) {- if (line.startsWith("#EXT-X-TARGETDURATION")) {- final duration = line.split(":").last.trim();- return int.tryParse(duration);+ if (line.startsWith("#EXTINF:")) {+ // Extract duration value (e.g., "#EXTINF:2.400000," β "2.400000")+ final durationStr = line.substring(+ 8,+ line.length - 1,+ );+ final duration = double.tryParse(durationStr);+ if (duration != null) {+ totalDuration += duration;+ }}}- return null;+ return totalDuration > 0 ? totalDuration.round() : null;}Future<(String, String)> _getPreviewUrl(EnteFile file) async {