diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 132d223..6f6824f 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -44,6 +44,8 @@
Unlock Stash with Face ID.
NSPhotoLibraryUsageDescription
Choose photos to use as covers and images in Stash.
+ NSPhotoLibraryAddUsageDescription
+ Save a frame of a video to your photos.
NSLocalNetworkUsageDescription
Stash connects to your media server and finds Chromecast devices on the local network.
NSBonjourServices
diff --git a/lib/features/pip/pip.dart b/lib/features/pip/pip.dart
index 24fc3f3..7f2eeea 100644
--- a/lib/features/pip/pip.dart
+++ b/lib/features/pip/pip.dart
@@ -24,7 +24,7 @@ final pipServiceProvider = Provider((ref) => PipService.create());
/// Picture-in-picture and background playback (4.12), chosen in the
/// settings and stored for all servers.
class PlaybackModes {
- const PlaybackModes({this.autoPip = true, this.background = false, this.lockScreen = false});
+ const PlaybackModes({this.autoPip = true, this.background = false, this.lockScreen = false, this.fullBuffer = false});
/// Android: a playing video continues in picture-in-picture when the user
/// leaves the app.
@@ -38,7 +38,12 @@ class PlaybackModes {
/// notification (lock_screen.dart). Off by default, for discretion.
final bool lockScreen;
- PlaybackModes copyWith({bool? autoPip, bool? background, bool? lockScreen}) => PlaybackModes(
+ /// Playback starts once the whole video is buffered (needs memory, so
+ /// off by default).
+ final bool fullBuffer;
+
+ PlaybackModes copyWith({bool? autoPip, bool? background, bool? lockScreen, bool? fullBuffer}) => PlaybackModes(
+ fullBuffer: fullBuffer ?? this.fullBuffer,
autoPip: autoPip ?? this.autoPip,
background: background ?? this.background,
lockScreen: lockScreen ?? this.lockScreen,
@@ -49,6 +54,7 @@ class PlaybackModesNotifier extends Notifier {
static const _autoPipKey = 'auto_pip';
static const _backgroundKey = 'background_playback';
static const _lockScreenKey = 'lock_screen_controls';
+ static const _fullBufferKey = 'buffer_fully';
@override
PlaybackModes build() {
@@ -57,6 +63,7 @@ class PlaybackModesNotifier extends Notifier {
autoPip: prefs.getBool(_autoPipKey) ?? true,
background: prefs.getBool(_backgroundKey) ?? false,
lockScreen: prefs.getBool(_lockScreenKey) ?? false,
+ fullBuffer: prefs.getBool(_fullBufferKey) ?? false,
);
}
@@ -70,6 +77,11 @@ class PlaybackModesNotifier extends Notifier {
await ref.read(sharedPreferencesProvider).setBool(_lockScreenKey, value);
}
+ Future setFullBuffer(bool value) async {
+ state = state.copyWith(fullBuffer: value);
+ await ref.read(sharedPreferencesProvider).setBool(_fullBufferKey, value);
+ }
+
Future setBackground(bool value) async {
state = state.copyWith(background: value);
await ref.read(sharedPreferencesProvider).setBool(_backgroundKey, value);
@@ -239,13 +251,37 @@ final pipProvider = NotifierProvider(PipNotifier.new);
/// or in picture-in-picture.
final backgroundPlaybackProvider = Provider((ref) {
var videoOff = false;
+ // Where playback was when the app was hidden, and when, to catch a jump
+ // after coming back.
+ Duration? hiddenAt;
+ DateTime? hiddenSince;
+ var keptPlaying = false;
- void setVideo(bool on) {
+ Future setVideo(bool on) async {
final platform = ref.read(playerProvider).platform;
- if (platform is NativePlayer) unawaited(platform.setProperty('vid', on ? 'auto' : 'no'));
+ if (platform is NativePlayer) await platform.setProperty('vid', on ? 'auto' : 'no');
videoOff = !on;
}
+ /// Back in the app: mpv rebuilds its video output when the video comes
+ /// back, which can reseek a transcode or leave the picture black. Seeking
+ /// to where playback really is brings the picture back at the right place.
+ Future restore() async {
+ final player = ref.read(playerProvider);
+ final since = hiddenSince;
+ final at = hiddenAt;
+ hiddenSince = hiddenAt = null;
+ var position = player.state.position;
+ if (at != null && since != null) {
+ final expected = keptPlaying ? at + DateTime.now().difference(since) : at;
+ // The player's own position is trusted unless it jumped.
+ if ((position - expected).abs() > const Duration(seconds: 3)) position = expected;
+ }
+ if (videoOff) await setVideo(true);
+ if (!ref.mounted || ref.read(nowPlayingProvider) == null) return;
+ await player.seek(position);
+ }
+
final lifecycle = AppLifecycleListener(
onHide: () {
if (ref.read(nowPlayingProvider) == null || ref.read(isCastingProvider)) return;
@@ -253,14 +289,22 @@ final backgroundPlaybackProvider = Provider((ref) {
if (ref.read(pipProvider) && !pip.endedJustNow()) return;
final player = ref.read(playerProvider);
if (!player.state.playing) return;
+ hiddenAt = player.state.position;
+ hiddenSince = DateTime.now();
if (ref.read(playbackModesProvider).background && !pip.endedJustNow()) {
- setVideo(false);
+ keptPlaying = true;
+ unawaited(setVideo(false));
} else {
+ keptPlaying = false;
unawaited(player.pause());
}
},
onShow: () {
- if (videoOff) setVideo(true);
+ if (hiddenSince == null || ref.read(nowPlayingProvider) == null || ref.read(isCastingProvider)) {
+ if (videoOff) unawaited(setVideo(true));
+ return;
+ }
+ unawaited(restore());
},
);
ref.onDispose(lifecycle.dispose);
diff --git a/lib/features/player/playback_tracker.dart b/lib/features/player/playback_tracker.dart
index 8b0712d..7fded77 100644
--- a/lib/features/player/playback_tracker.dart
+++ b/lib/features/player/playback_tracker.dart
@@ -130,9 +130,11 @@ class PlaybackTracker {
// Snapshot before the await: the session may change meanwhile.
_unsavedWatched = 0;
_lastSavedResume = resume;
+ // Known at once, so a scene reopened right away starts from here even
+ // while the save is still on its way.
+ onResumeSaved?.call(scene.id, resume);
try {
await api.saveActivity(scene.id, resumeTime: resume, playDuration: watched);
- onResumeSaved?.call(scene.id, resume);
} catch (e) {
debugPrint('sceneSaveActivity failed: $e');
if (identical(_scene, scene)) {
diff --git a/lib/features/player/player_providers.dart b/lib/features/player/player_providers.dart
index 2bd116e..f22b711 100644
--- a/lib/features/player/player_providers.dart
+++ b/lib/features/player/player_providers.dart
@@ -14,6 +14,7 @@ import '../../data/repositories/stash_session.dart';
import '../cast/cast_media.dart';
import '../cast/cast_providers.dart';
import '../cast/cast_service.dart' show CastKind;
+import '../pip/pip.dart' show playbackModesProvider;
import 'playback_tracker.dart';
import 'sliding_panel.dart';
import 'video_zoom.dart';
@@ -366,7 +367,10 @@ class NowPlayingNotifier extends Notifier {
void playQueue(List scenes, {required String title, int start = 0}) {
if (scenes.isEmpty) return;
_autoplay ??= ref.listen(playerCompletedProvider, (_, next) {
- if (next.value == true) playNext();
+ if (next.value != true) return;
+ final queue = ref.read(playQueueProvider);
+ if (queue == null || !queue.hasNext) return;
+ ref.read(autoplayCountdownProvider.notifier).start(queue.scenes[queue.index + 1]);
});
final queue = PlayQueue(title: title, scenes: scenes, index: start.clamp(0, scenes.length - 1));
ref.read(playQueueProvider.notifier).set(queue);
@@ -425,6 +429,7 @@ class NowPlayingNotifier extends Notifier {
ref.read(playQueueProvider.notifier).set(i < 0 ? null : queue.at(i));
}
+ ref.read(autoplayCountdownProvider.notifier).cancel();
if (state == null) ref.read(miniplayerHeightProvider).value = kMiniPlayerHeight;
ref.read(playerClosingProvider.notifier).set(false);
if (state?.id != scene.id) {
@@ -520,14 +525,56 @@ class NowPlayingNotifier extends Notifier {
void _open(String url, Duration start, {bool play = true}) {
_openedAt = start;
- ref.read(playerProvider).open(
- Media(
- url,
- httpHeaders: ref.read(authHeadersProvider),
- start: start > Duration.zero ? start : null,
- ),
- play: play,
- );
+ final player = ref.read(playerProvider);
+ final buffering = play && ref.read(playbackModesProvider).fullBuffer;
+ _bufferWait?.cancel();
+ _bufferWait = null;
+ final platform = player.platform;
+ if (platform is NativePlayer) {
+ // Room for a whole video, else mpv stops reading ahead at its default.
+ unawaited(platform.setProperty('demuxer-max-bytes', buffering ? '$_fullBufferBytes' : '$_defaultBufferBytes'));
+ unawaited(platform.setProperty('demuxer-readahead-secs', buffering ? '86400' : '1'));
+ }
+ player.open(
+ Media(
+ url,
+ httpHeaders: ref.read(authHeadersProvider),
+ start: start > Duration.zero ? start : null,
+ ),
+ play: play && !buffering,
+ );
+ if (buffering) _playWhenBuffered(player);
+ }
+
+ static const _defaultBufferBytes = 32 * 1024 * 1024;
+ static const _fullBufferBytes = 1024 * 1024 * 1024;
+ StreamSubscription? _bufferWait;
+
+ /// Starts [player] once everything is buffered (the playback setting
+ /// "buffer fully"); the play button starts it earlier.
+ void _playWhenBuffered(Player player) {
+ void start() {
+ _bufferWait?.cancel();
+ _bufferWait = null;
+ if (ref.mounted && !ref.read(isCastingProvider)) unawaited(player.play());
+ }
+
+ bool done(Duration buffer) {
+ final total = player.state.duration;
+ return total > Duration.zero && buffer >= total - const Duration(seconds: 1);
+ }
+
+ _bufferWait = player.stream.buffer.listen((buffer) {
+ if (done(buffer)) start();
+ });
+ // The play button ends the wait.
+ late final StreamSubscription playing;
+ playing = player.stream.playing.listen((on) {
+ if (!on) return;
+ _bufferWait?.cancel();
+ _bufferWait = null;
+ playing.cancel();
+ });
}
/// Whether the panel is open, not just the mini bar.
@@ -578,6 +625,7 @@ class NowPlayingNotifier extends Notifier {
}
void close() {
+ ref.read(autoplayCountdownProvider.notifier).cancel();
ref.read(playerClosingProvider.notifier).set(false);
ref.read(playQueueProvider.notifier).set(null);
ref.read(playerHistoryProvider.notifier).clear();
@@ -591,3 +639,50 @@ class NowPlayingNotifier extends Notifier {
}
final nowPlayingProvider = NotifierProvider(NowPlayingNotifier.new);
+
+/// The queue's next scene waiting to start after one ended: a short
+/// countdown the user can cancel or skip.
+typedef AutoplayCountdown = ({Scene next, int seconds});
+
+class AutoplayCountdownNotifier extends Notifier {
+ /// How long the next scene waits.
+ static const delay = 5;
+
+ Timer? _timer;
+
+ @override
+ AutoplayCountdown? build() {
+ ref.onDispose(() => _timer?.cancel());
+ return null;
+ }
+
+ void start(Scene next) {
+ _timer?.cancel();
+ state = (next: next, seconds: delay);
+ _timer = Timer.periodic(const Duration(seconds: 1), (_) {
+ final current = state;
+ if (current == null) return;
+ if (current.seconds <= 1) {
+ skip();
+ } else {
+ state = (next: current.next, seconds: current.seconds - 1);
+ }
+ });
+ }
+
+ /// Plays the next scene now.
+ void skip() {
+ if (state == null) return;
+ cancel();
+ ref.read(nowPlayingProvider.notifier).playNext();
+ }
+
+ void cancel() {
+ _timer?.cancel();
+ _timer = null;
+ if (state != null) state = null;
+ }
+}
+
+final autoplayCountdownProvider =
+ NotifierProvider(AutoplayCountdownNotifier.new);
diff --git a/lib/features/player/scene_actions.dart b/lib/features/player/scene_actions.dart
index a5a2f27..6a0a9b1 100644
--- a/lib/features/player/scene_actions.dart
+++ b/lib/features/player/scene_actions.dart
@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:gal/gal.dart';
import '../../core/config/haptics.dart';
import '../../core/config/theme.dart';
@@ -409,6 +410,11 @@ class _SceneMoreSheet extends ConsumerWidget {
title: Text(l.addToGroup),
onTap: () => then((below) => showAddToGroupSheet(below, scene)),
),
+ ListTile(
+ leading: const Icon(Icons.photo_camera_outlined),
+ title: Text(l.saveStill),
+ onTap: () => then((below) => unawaited(_saveStill(below, ref, scene))),
+ ),
if (files.isNotEmpty)
ListTile(
leading: const Icon(Icons.info_outline),
@@ -771,3 +777,17 @@ class WatchLaterButton extends ConsumerWidget {
);
}
}
+
+/// Saves the frame on screen to the photo gallery (Pictures on Android).
+Future _saveStill(BuildContext context, WidgetRef ref, Scene scene) async {
+ final l = context.l10n;
+ final messenger = ScaffoldMessenger.of(context);
+ try {
+ final bytes = await ref.read(playerProvider).screenshot(format: 'image/png');
+ if (bytes == null) throw StateError('no frame');
+ await Gal.putImageBytes(bytes, name: 'stashtube_${scene.id}_${DateTime.now().millisecondsSinceEpoch}');
+ messenger.showSnackBar(SnackBar(content: Text(l.stillSaved)));
+ } catch (e) {
+ messenger.showSnackBar(SnackBar(content: Text(l.stillNotSaved)));
+ }
+}
diff --git a/lib/features/player/video_controls.dart b/lib/features/player/video_controls.dart
index d9541d9..1a5e6a3 100644
--- a/lib/features/player/video_controls.dart
+++ b/lib/features/player/video_controls.dart
@@ -695,6 +695,8 @@ class _StashVideoControlsState extends ConsumerState {
),
// Always there (empty without an error), so the tree stays the same.
_PlaybackErrorOverlay(error: error, sceneId: widget.scene.id, onQuality: widget.onQuality),
+ // Always there too (empty unless the queue's next scene is waiting).
+ const _AutoplayOverlay(),
if (_tipsShowing)
GestureTipsOverlay(seekSeconds: seek.enabled ? seek.step.inSeconds : null, onDismiss: _dismissTips),
// Always there (empty while unlocked), above the gestures and buttons.
@@ -1015,3 +1017,80 @@ Future showSpeedSheet(BuildContext context, Player player) => showModalBot
);
},
);
+
+/// Over the video after a queue's scene ended: "Next: in 5 s" with
+/// "Cancel" and "Play now". Empty otherwise; taps outside its buttons reach
+/// the controls below.
+class _AutoplayOverlay extends ConsumerWidget {
+ const _AutoplayOverlay();
+
+ @override
+ Widget build(BuildContext context, WidgetRef ref) {
+ final countdown = ref.watch(autoplayCountdownProvider);
+ if (countdown == null) return const SizedBox.shrink();
+ final l = context.l10n;
+ final theme = Theme.of(context);
+ const onVideo = Colors.white;
+ final notifier = ref.read(autoplayCountdownProvider.notifier);
+
+ return Stack(
+ fit: StackFit.expand,
+ children: [
+ const IgnorePointer(child: ColoredBox(color: Colors.black54)),
+ LayoutBuilder(
+ builder: (context, constraints) => FittedBox(
+ fit: BoxFit.scaleDown,
+ child: SizedBox(
+ width: constraints.maxWidth,
+ child: Padding(
+ padding: const EdgeInsets.all(AppSpacing.l),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Semantics(
+ liveRegion: true,
+ child: Text(
+ l.nextVideoIn(countdown.seconds),
+ textAlign: TextAlign.center,
+ style: theme.textTheme.titleSmall?.copyWith(color: onVideo),
+ ),
+ ),
+ Text(
+ countdown.next.title,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: theme.textTheme.bodySmall?.copyWith(color: Colors.white70),
+ ),
+ const SizedBox(height: AppSpacing.s),
+ Wrap(
+ alignment: WrapAlignment.center,
+ spacing: AppSpacing.s,
+ children: [
+ FilledButton.icon(
+ icon: const Icon(Icons.skip_next),
+ label: Text(l.playNow),
+ onPressed: () {
+ Haptics.light();
+ notifier.skip();
+ },
+ ),
+ OutlinedButton(
+ style: OutlinedButton.styleFrom(
+ foregroundColor: onVideo,
+ side: const BorderSide(color: Colors.white70),
+ ),
+ onPressed: notifier.cancel,
+ child: Text(l.cancel),
+ ),
+ ],
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ),
+ ],
+ );
+ }
+}
diff --git a/lib/features/settings/settings_categories.dart b/lib/features/settings/settings_categories.dart
index 6ac84e9..2348eb7 100644
--- a/lib/features/settings/settings_categories.dart
+++ b/lib/features/settings/settings_categories.dart
@@ -580,6 +580,14 @@ class _PlaybackModeTiles extends ConsumerWidget {
value: modes.background,
onChanged: withHaptic((v) => ref.read(playbackModesProvider.notifier).setBackground(v)),
),
+ SwitchListTile(
+ secondary: const Icon(Icons.downloading_outlined),
+ title: Text(l.bufferFully),
+ subtitle: Text(l.bufferFullySubtitle),
+ isThreeLine: true,
+ value: modes.fullBuffer,
+ onChanged: withHaptic((v) => ref.read(playbackModesProvider.notifier).setFullBuffer(v)),
+ ),
if (ref.watch(lockScreenSupportedProvider))
SwitchListTile(
secondary: const Icon(Icons.lock_outline),
diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb
index 6c60464..f2cb641 100644
--- a/lib/l10n/app_de.arb
+++ b/lib/l10n/app_de.arb
@@ -585,6 +585,18 @@
"autoPipSubtitle": "Ein laufendes Video spielt in einem kleinen Fenster weiter.",
"backgroundPlayback": "Hintergrundwiedergabe",
"backgroundPlaybackSubtitle": "Der Ton läuft weiter, während die App im Hintergrund ist.",
+ "nextVideoIn": "Nächstes Video in {seconds, plural, =1{1 Sekunde} other{{seconds} Sekunden}}",
+ "@nextVideoIn": {
+ "placeholders": {
+ "seconds": {"type": "int"}
+ }
+ },
+ "playNow": "Jetzt abspielen",
+ "saveStill": "Aktuelles Bild speichern",
+ "stillSaved": "Bild in den Fotos gespeichert.",
+ "stillNotSaved": "Das Bild konnte nicht gespeichert werden.",
+ "bufferFully": "Vor dem Abspielen vollständig puffern",
+ "bufferFullySubtitle": "Die Wiedergabe startet, sobald das ganze Video geladen ist. Braucht bei langen Videos Speicher und Zeit; die Play-Taste startet früher.",
"performerShorts": "{count, plural, =1{1 Short} other{{count} Shorts}}",
"channelTabVideos": "Videos",
"channelTabShorts": "Shorts",
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb
index 18e5fea..de41a7f 100644
--- a/lib/l10n/app_en.arb
+++ b/lib/l10n/app_en.arb
@@ -1277,6 +1277,18 @@
"autoPipSubtitle": "A playing video continues in a small window.",
"backgroundPlayback": "Background playback",
"backgroundPlaybackSubtitle": "The sound keeps playing while the app is in the background.",
+ "nextVideoIn": "Next video in {seconds, plural, =1{1 second} other{{seconds} seconds}}",
+ "@nextVideoIn": {
+ "placeholders": {
+ "seconds": {"type": "int"}
+ }
+ },
+ "playNow": "Play now",
+ "saveStill": "Save current frame",
+ "stillSaved": "Frame saved to your photos.",
+ "stillNotSaved": "The frame could not be saved.",
+ "bufferFully": "Buffer fully before playing",
+ "bufferFullySubtitle": "Playback starts once the whole video is loaded. Needs memory and time on long videos; the play button starts it sooner.",
"performerShorts": "{count, plural, =1{1 short} other{{count} shorts}}",
"@performerShorts": {
"placeholders": {
diff --git a/lib/l10n/gen/app_localizations.dart b/lib/l10n/gen/app_localizations.dart
index af83a2a..338eaff 100644
--- a/lib/l10n/gen/app_localizations.dart
+++ b/lib/l10n/gen/app_localizations.dart
@@ -3428,6 +3428,48 @@ abstract class AppLocalizations {
/// **'The sound keeps playing while the app is in the background.'**
String get backgroundPlaybackSubtitle;
+ /// No description provided for @nextVideoIn.
+ ///
+ /// In en, this message translates to:
+ /// **'Next video in {seconds, plural, =1{1 second} other{{seconds} seconds}}'**
+ String nextVideoIn(int seconds);
+
+ /// No description provided for @playNow.
+ ///
+ /// In en, this message translates to:
+ /// **'Play now'**
+ String get playNow;
+
+ /// No description provided for @saveStill.
+ ///
+ /// In en, this message translates to:
+ /// **'Save current frame'**
+ String get saveStill;
+
+ /// No description provided for @stillSaved.
+ ///
+ /// In en, this message translates to:
+ /// **'Frame saved to your photos.'**
+ String get stillSaved;
+
+ /// No description provided for @stillNotSaved.
+ ///
+ /// In en, this message translates to:
+ /// **'The frame could not be saved.'**
+ String get stillNotSaved;
+
+ /// No description provided for @bufferFully.
+ ///
+ /// In en, this message translates to:
+ /// **'Buffer fully before playing'**
+ String get bufferFully;
+
+ /// No description provided for @bufferFullySubtitle.
+ ///
+ /// In en, this message translates to:
+ /// **'Playback starts once the whole video is loaded. Needs memory and time on long videos; the play button starts it sooner.'**
+ String get bufferFullySubtitle;
+
/// No description provided for @performerShorts.
///
/// In en, this message translates to:
diff --git a/lib/l10n/gen/app_localizations_de.dart b/lib/l10n/gen/app_localizations_de.dart
index dacdc46..2b05dde 100644
--- a/lib/l10n/gen/app_localizations_de.dart
+++ b/lib/l10n/gen/app_localizations_de.dart
@@ -2099,6 +2099,36 @@ class AppLocalizationsDe extends AppLocalizations {
String get backgroundPlaybackSubtitle =>
'Der Ton läuft weiter, während die App im Hintergrund ist.';
+ @override
+ String nextVideoIn(int seconds) {
+ String _temp0 = intl.Intl.pluralLogic(
+ seconds,
+ locale: localeName,
+ other: '$seconds Sekunden',
+ one: '1 Sekunde',
+ );
+ return 'Nächstes Video in $_temp0';
+ }
+
+ @override
+ String get playNow => 'Jetzt abspielen';
+
+ @override
+ String get saveStill => 'Aktuelles Bild speichern';
+
+ @override
+ String get stillSaved => 'Bild in den Fotos gespeichert.';
+
+ @override
+ String get stillNotSaved => 'Das Bild konnte nicht gespeichert werden.';
+
+ @override
+ String get bufferFully => 'Vor dem Abspielen vollständig puffern';
+
+ @override
+ String get bufferFullySubtitle =>
+ 'Die Wiedergabe startet, sobald das ganze Video geladen ist. Braucht bei langen Videos Speicher und Zeit; die Play-Taste startet früher.';
+
@override
String performerShorts(int count) {
String _temp0 = intl.Intl.pluralLogic(
diff --git a/lib/l10n/gen/app_localizations_en.dart b/lib/l10n/gen/app_localizations_en.dart
index fa2b232..ec2967e 100644
--- a/lib/l10n/gen/app_localizations_en.dart
+++ b/lib/l10n/gen/app_localizations_en.dart
@@ -2090,6 +2090,36 @@ class AppLocalizationsEn extends AppLocalizations {
String get backgroundPlaybackSubtitle =>
'The sound keeps playing while the app is in the background.';
+ @override
+ String nextVideoIn(int seconds) {
+ String _temp0 = intl.Intl.pluralLogic(
+ seconds,
+ locale: localeName,
+ other: '$seconds seconds',
+ one: '1 second',
+ );
+ return 'Next video in $_temp0';
+ }
+
+ @override
+ String get playNow => 'Play now';
+
+ @override
+ String get saveStill => 'Save current frame';
+
+ @override
+ String get stillSaved => 'Frame saved to your photos.';
+
+ @override
+ String get stillNotSaved => 'The frame could not be saved.';
+
+ @override
+ String get bufferFully => 'Buffer fully before playing';
+
+ @override
+ String get bufferFullySubtitle =>
+ 'Playback starts once the whole video is loaded. Needs memory and time on long videos; the play button starts it sooner.';
+
@override
String performerShorts(int count) {
String _temp0 = intl.Intl.pluralLogic(
diff --git a/pubspec.lock b/pubspec.lock
index b26cb2f..8eb464e 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -535,6 +535,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
+ gal:
+ dependency: "direct main"
+ description:
+ name: gal
+ sha256: f71e79840fe023a21f2f949771375444b6efcd34b9e625d5f4f5504971380a77
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.3.3"
get:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 7d58586..013dd70 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -74,6 +74,7 @@ dependencies:
# System notifications when a server task ends (features/notifications/).
# No Google services, so it stays in the F-Droid build.
flutter_local_notifications: ^22.3.2
+ gal: ^2.3.3
dev_dependencies:
integration_test:
diff --git a/test/features/library_epic9_test.dart b/test/features/library_epic9_test.dart
index cfd87a6..8f19889 100644
--- a/test/features/library_epic9_test.dart
+++ b/test/features/library_epic9_test.dart
@@ -115,6 +115,16 @@ void main() {
player.completed.add(true);
await tester.pump();
+ // A countdown first; cancelling it keeps the scene, letting it run plays the next.
+ expect(container.read(autoplayCountdownProvider)?.next.id, 'b');
+ expect(container.read(nowPlayingProvider)?.id, 'a');
+ container.read(autoplayCountdownProvider.notifier).cancel();
+ await tester.pump(const Duration(seconds: 6));
+ expect(container.read(nowPlayingProvider)?.id, 'a');
+ player.completed.add(false);
+ player.completed.add(true);
+ await tester.pump();
+ await tester.pump(const Duration(seconds: AutoplayCountdownNotifier.delay));
expect(container.read(nowPlayingProvider)?.id, 'b');
expect(player.opened.last.uri, 'http://s/scene/b/stream');
diff --git a/test/features/scene_actions_test.dart b/test/features/scene_actions_test.dart
index 92fe5df..0e8fe5c 100644
--- a/test/features/scene_actions_test.dart
+++ b/test/features/scene_actions_test.dart
@@ -255,6 +255,9 @@ void main() {
});
testWidgets('"More" lists the rarer actions and opens the file info', (tester) async {
+ tester.view.physicalSize = const Size(800, 1400);
+ tester.view.devicePixelRatio = 1;
+ addTearDown(tester.view.reset);
await pumpActions(tester);
await tester.tap(find.byTooltip('More'));
await tester.pumpAndSettle();
@@ -269,6 +272,9 @@ void main() {
});
testWidgets('"More" opens the scene editor', (tester) async {
+ tester.view.physicalSize = const Size(800, 1400);
+ tester.view.devicePixelRatio = 1;
+ addTearDown(tester.view.reset);
await pumpActions(tester);
await tester.tap(find.byTooltip('More'));
await tester.pumpAndSettle();
diff --git a/test/features/settings_seek_test.dart b/test/features/settings_seek_test.dart
index 6aa7224..e10cd52 100644
--- a/test/features/settings_seek_test.dart
+++ b/test/features/settings_seek_test.dart
@@ -40,6 +40,9 @@ void main() {
});
testWidgets('the playback settings change them', (tester) async {
+ tester.view.physicalSize = const Size(800, 1400);
+ tester.view.devicePixelRatio = 1;
+ addTearDown(tester.view.reset);
final c = await container();
await tester.pumpWidget(UncontrolledProviderScope(
container: c,
diff --git a/tool/altstore/make_source.py b/tool/altstore/make_source.py
index 6685fe5..02a37d6 100755
--- a/tool/altstore/make_source.py
+++ b/tool/altstore/make_source.py
@@ -23,6 +23,8 @@
'NSLocalNetworkUsageDescription':
'Stash connects to your media server and finds Chromecast devices '
'on the local network.',
+ 'NSPhotoLibraryAddUsageDescription':
+ 'Save a frame of a video to your photos.',
'NSPhotoLibraryUsageDescription':
'Choose photos to use as covers and images in Stash.',
}