Skip to content

Commit eba0951

Browse files
close #1395
app will pause the video when navigating away and is independent of the play-in-background preference
1 parent 4a295f0 commit eba0951

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

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

+19
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,25 @@ public void onSaveInstanceState(@NonNull final Bundle outState) {
274274
}
275275
}
276276

277+
@Override
278+
public void onPrimaryNavigationFragmentChanged(final boolean isPrimaryNavigationFragment) {
279+
if (!isPrimaryNavigationFragment) {
280+
final Media media = viewModel.getMedia();
281+
switch (media.getType()) {
282+
case MEDIA_TYPE_VIDEO:
283+
if (videoPlayerViewHelper != null) {
284+
videoPlayerViewHelper.pause();
285+
}
286+
return;
287+
case MEDIA_TYPE_SLIDER:
288+
if (sliderItemsAdapter != null) {
289+
pauseSliderPlayer();
290+
}
291+
default:
292+
}
293+
}
294+
}
295+
277296
private void init() {
278297
final Bundle arguments = getArguments();
279298
if (arguments == null) {

0 commit comments

Comments
 (0)