diff options
| author | mirror <mirror@localhost> | 2026-11-22 08:41:00 +0900 |
|---|---|---|
| committer | mirror <mirror@localhost> | 2026-11-22 08:41:00 +0900 |
| commit | 449d8b74bd6d9dae98a07254cdfad677b920e7b0 (patch) | |
| tree | c131c3528c4d517f56e19b854a7453fedb097d40 /plugins/aves_video/lib/src/video_loop_mode.dart | |
| download | aves-src-master.tar.gz aves-src-master.zip | |
Diffstat (limited to 'plugins/aves_video/lib/src/video_loop_mode.dart')
| -rw-r--r-- | plugins/aves_video/lib/src/video_loop_mode.dart | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/plugins/aves_video/lib/src/video_loop_mode.dart b/plugins/aves_video/lib/src/video_loop_mode.dart new file mode 100644 index 0000000..196bd01 --- /dev/null +++ b/plugins/aves_video/lib/src/video_loop_mode.dart @@ -0,0 +1,19 @@ +import 'package:aves_model/aves_model.dart'; + +extension ExtraVideoLoopMode on VideoLoopMode { + static const shortVideoThreshold = Duration(seconds: 30); + + bool shouldLoop(AvesEntryBase entry) { + if (entry.isAnimated) return true; + + switch (this) { + case VideoLoopMode.never: + return false; + case VideoLoopMode.shortOnly: + final durationMillis = entry.durationMillis; + return durationMillis != null ? durationMillis < shortVideoThreshold.inMilliseconds : false; + case VideoLoopMode.always: + return true; + } + } +} |
