Browse Source

close #1395

app will pause the video when navigating away and is independent of the play-in-background preference
renovate/androidx.fragment-fragment-ktx-1.x
Austin Huang 3 years ago
parent
commit
eba0951176
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 19
      app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java

19
app/src/main/java/awais/instagrabber/fragments/PostViewV2Fragment.java

@ -274,6 +274,25 @@ public class PostViewV2Fragment extends Fragment implements EditTextDialogFragme
}
}
@Override
public void onPrimaryNavigationFragmentChanged(final boolean isPrimaryNavigationFragment) {
if (!isPrimaryNavigationFragment) {
final Media media = viewModel.getMedia();
switch (media.getType()) {
case MEDIA_TYPE_VIDEO:
if (videoPlayerViewHelper != null) {
videoPlayerViewHelper.pause();
}
return;
case MEDIA_TYPE_SLIDER:
if (sliderItemsAdapter != null) {
pauseSliderPlayer();
}
default:
}
}
}
private void init() {
final Bundle arguments = getArguments();
if (arguments == null) {

Loading…
Cancel
Save