From 72a46bc308d63f6ae95bb2a18b9ee6feaf867860 Mon Sep 17 00:00:00 2001 From: "Nawal \"Deshi\" Rahim" Date: Tue, 9 May 2017 06:30:45 +1000 Subject: [PATCH] Added flag for background mode (#563) * Added flag for background mode * Better flag name --- .../com/brentvatne/exoplayer/ReactExoplayerView.java | 9 ++++++++- 1 file changed, 8 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 8b6aea06..85db1c93 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -93,6 +93,7 @@ class ReactExoplayerView extends FrameLayout implements private boolean repeat; private boolean disableFocus; private float mProgressUpdateInterval = 250.0f; + private boolean playInBackground = false; // \ End props // React @@ -171,11 +172,17 @@ class ReactExoplayerView extends FrameLayout implements @Override public void onHostResume() { + if (playInBackground) { + return; + } setPlayWhenReady(!isPaused); } @Override public void onHostPause() { + if (playInBackground) { + return; + } setPlayWhenReady(false); } @@ -605,7 +612,7 @@ class ReactExoplayerView extends FrameLayout implements public void setPlayInBackground(boolean playInBackground) { - // TODO: implement + this.playInBackground = playInBackground; } public void setDisableFocus(boolean disableFocus) {