Merge pull request #833 from moduval/master
Fix playInBackground props in ExoPlayer
This commit is contained in:
commit
24766c2e3b
@ -42,6 +42,5 @@ https://github.com/google/ExoPlayer
|
|||||||
|
|
||||||
## Unimplemented props
|
## Unimplemented props
|
||||||
|
|
||||||
- `playInBackground={true}`
|
|
||||||
- `rate={1.0}`
|
|
||||||
- Expansion file - `source={{ mainVer: 1, patchVer: 0 }}`
|
- Expansion file - `source={{ mainVer: 1, patchVer: 0 }}`
|
||||||
|
|
||||||
|
@ -93,6 +93,7 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
private long resumePosition;
|
private long resumePosition;
|
||||||
private boolean loadVideoStarted;
|
private boolean loadVideoStarted;
|
||||||
private boolean isFullscreen;
|
private boolean isFullscreen;
|
||||||
|
private boolean isInBackground;
|
||||||
private boolean isPaused = true;
|
private boolean isPaused = true;
|
||||||
private boolean isBuffering;
|
private boolean isBuffering;
|
||||||
private float rate = 1f;
|
private float rate = 1f;
|
||||||
@ -186,14 +187,15 @@ class ReactExoplayerView extends FrameLayout implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onHostResume() {
|
public void onHostResume() {
|
||||||
if (playInBackground) {
|
if (!playInBackground || !isInBackground) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
setPlayWhenReady(!isPaused);
|
setPlayWhenReady(!isPaused);
|
||||||
}
|
}
|
||||||
|
isInBackground = false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onHostPause() {
|
public void onHostPause() {
|
||||||
|
isInBackground = true;
|
||||||
if (playInBackground) {
|
if (playInBackground) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user