Skip to content

Commit

Permalink
Added flag for background mode (#563)
Browse files Browse the repository at this point in the history
* Added flag for background mode

* Better flag name
  • Loading branch information
deshiknaves authored and Matt Apperson committed May 8, 2017
1 parent 98c51f1 commit 72a46bc
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -171,11 +172,17 @@ protected void onDetachedFromWindow() {

@Override
public void onHostResume() {
if (playInBackground) {
return;
}
setPlayWhenReady(!isPaused);
}

@Override
public void onHostPause() {
if (playInBackground) {
return;
}
setPlayWhenReady(false);
}

Expand Down Expand Up @@ -605,7 +612,7 @@ public void setRateModifier(float rate) {


public void setPlayInBackground(boolean playInBackground) {
// TODO: implement
this.playInBackground = playInBackground;
}

public void setDisableFocus(boolean disableFocus) {
Expand Down

0 comments on commit 72a46bc

Please sign in to comment.