app will pause the video when navigating away and is independent of the play-in-background preference
This commit is contained in:
Austin Huang 2021-07-13 21:46:13 -04:00
parent 4a295f0617
commit eba0951176
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
1 changed files with 19 additions and 0 deletions

View File

@ -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) {