From d3bda4a204aeeded04b8f4146e2f8200d9a4f843 Mon Sep 17 00:00:00 2001 From: Hampton Maxwell Date: Sat, 9 Jun 2018 16:11:18 -0700 Subject: [PATCH] Don't affect pause status after playing in the background --- .../java/com/brentvatne/exoplayer/ReactExoplayerView.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 34df0031..7ccb255d 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -85,6 +85,7 @@ class ReactExoplayerView extends FrameLayout implements private int resumeWindow; private long resumePosition; private boolean loadVideoStarted; + private boolean isInBackground; private boolean isPaused = true; private boolean isBuffering; private float rate = 1f; @@ -174,11 +175,15 @@ class ReactExoplayerView extends FrameLayout implements @Override public void onHostResume() { - setPlayWhenReady(!isPaused); + if (!playInBackground || !isInBackground) { + setPlayWhenReady(!isPaused); + } + isInBackground = false; } @Override public void onHostPause() { + isInBackground = true; if (playInBackground) { return; }