Skip to content

Commit

Permalink
Close video player on resume with invalid state
Browse files Browse the repository at this point in the history
In some cases the video player may be stopped when the activity is paused. This ends up crashing the app on resume. Check for this kind of invalid state and close the video player to prevent crashing.
  • Loading branch information
nielsvanvelzen committed Dec 10, 2023
1 parent d9eb849 commit 004b39e
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,17 @@ private void startFadeTimer() {
public void onResume() {
super.onResume();

// Close player when resuming without a valid playback contoller
if (!mPlaybackController.hasFragment()) {
if (navigationRepository.getValue().getCanGoBack()) {
navigationRepository.getValue().goBack();
} else {
navigationRepository.getValue().reset(Destinations.INSTANCE.getHome());
}

return;
}

// Hide system bars
WindowCompat.setDecorFitsSystemWindows(requireActivity().getWindow(), false);
WindowCompat.getInsetsController(requireActivity().getWindow(), requireActivity().getWindow().getDecorView()).hide(WindowInsetsCompat.Type.systemBars());
Expand Down

0 comments on commit 004b39e

Please sign in to comment.