Added flag for background mode (#563)

* Added flag for background mode

* Better flag name
This commit is contained in:
Nawal "Deshi" Rahim 2017-05-09 06:30:45 +10:00 committed by Matt Apperson
parent 98c51f114b
commit 72a46bc308

View File

@ -93,6 +93,7 @@ class ReactExoplayerView extends FrameLayout implements
private boolean repeat; private boolean repeat;
private boolean disableFocus; private boolean disableFocus;
private float mProgressUpdateInterval = 250.0f; private float mProgressUpdateInterval = 250.0f;
private boolean playInBackground = false;
// \ End props // \ End props
// React // React
@ -171,11 +172,17 @@ class ReactExoplayerView extends FrameLayout implements
@Override @Override
public void onHostResume() { public void onHostResume() {
if (playInBackground) {
return;
}
setPlayWhenReady(!isPaused); setPlayWhenReady(!isPaused);
} }
@Override @Override
public void onHostPause() { public void onHostPause() {
if (playInBackground) {
return;
}
setPlayWhenReady(false); setPlayWhenReady(false);
} }
@ -605,7 +612,7 @@ class ReactExoplayerView extends FrameLayout implements
public void setPlayInBackground(boolean playInBackground) { public void setPlayInBackground(boolean playInBackground) {
// TODO: implement this.playInBackground = playInBackground;
} }
public void setDisableFocus(boolean disableFocus) { public void setDisableFocus(boolean disableFocus) {