Skip to content

Commit

Permalink
#737 keep playing slideshow when losing focus but app is still visibl…
Browse files Browse the repository at this point in the history
…e (e.g. split screen)
  • Loading branch information
deckerst committed Jan 6, 2024
1 parent b57253c commit 694c594
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
### Changed

- Info: strip `unlocated` filter from context collection when editing location via map
- Slideshow: keep playing when losing focus but app is still visible (e.g. split screen)

## <a id="v1.10.2"></a>[v1.10.2] - 2023-12-24

Expand Down
9 changes: 7 additions & 2 deletions lib/widgets/viewer/entry_viewer_stack.dart
Original file line number Diff line number Diff line change
Expand Up @@ -290,19 +290,24 @@ class _EntryViewerStackState extends State<EntryViewerStack> with EntryViewContr
void _onAppLifecycleStateChanged() {
switch (AvesApp.lifecycleStateNotifier.value) {
case AppLifecycleState.inactive:
// inactive: when losing focus
_onAppInactive();
case AppLifecycleState.hidden:
case AppLifecycleState.paused:
case AppLifecycleState.detached:
// paused: when switching to another app
// detached: when app is without a view
viewerController.autopilot = false;
pauseVideoControllers();
case AppLifecycleState.resumed:
availability.onResume();
case AppLifecycleState.hidden:
// hidden: transient state between `inactive` and `paused`
break;
}
}

Future<void> _onAppInactive() async {
final playingController = context.read<VideoConductor>().getPlayingController();
viewerController.autopilot = false;
bool enabledPip = false;
if (settings.videoBackgroundMode == VideoBackgroundMode.pip) {
enabledPip |= await _enablePictureInPicture();
Expand Down

0 comments on commit 694c594

Please sign in to comment.