Skip to content

Commit 1f27ca0

Browse files
zhulduzlimaAniceto
authored andcommitted
1 parent 765a662 commit 1f27ca0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import android.view.Window;
1515
import android.view.accessibility.CaptioningManager;
1616
import android.widget.FrameLayout;
17+
import android.view.WindowManager;
1718
import android.widget.ImageButton;
1819
import android.widget.ImageView;
1920

@@ -223,11 +224,13 @@ private void createViews() {
223224
protected void onAttachedToWindow() {
224225
super.onAttachedToWindow();
225226
initializePlayer();
227+
setKeepScreenOn(true);
226228
}
227229

228230
@Override
229231
protected void onDetachedFromWindow() {
230232
super.onDetachedFromWindow();
233+
setKeepScreenOn(false);
231234
/* We want to be able to continue playing audio when switching tabs.
232235
* Leave this here in case it causes issues.
233236
*/
@@ -604,9 +607,6 @@ private void startPlayback() {
604607
} else {
605608
initializePlayer();
606609
}
607-
if (!disableFocus) {
608-
setKeepScreenOn(true);
609-
}
610610
}
611611

612612
private void pausePlayback() {
@@ -615,7 +615,6 @@ private void pausePlayback() {
615615
setPlayWhenReady(false);
616616
}
617617
}
618-
setKeepScreenOn(false);
619618
}
620619

621620
private void stopPlayback() {
@@ -1188,6 +1187,7 @@ public void setPausedModifier(boolean paused) {
11881187
} else {
11891188
pausePlayback();
11901189
}
1190+
setKeepScreenOn(!isPaused);
11911191
}
11921192
}
11931193

0 commit comments

Comments
 (0)