Skip to content

Commit 9a1dfb9

Browse files
zhulduzlimaAniceto
authored andcommitted
1 parent 765a662 commit 9a1dfb9

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

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

2019
import com.brentvatne.react.R;
2120
import com.brentvatne.receiver.AudioBecomingNoisyReceiver;
@@ -223,11 +222,13 @@ private void createViews() {
223222
protected void onAttachedToWindow() {
224223
super.onAttachedToWindow();
225224
initializePlayer();
225+
setKeepScreenOn(true);
226226
}
227227

228228
@Override
229229
protected void onDetachedFromWindow() {
230230
super.onDetachedFromWindow();
231+
setKeepScreenOn(false);
231232
/* We want to be able to continue playing audio when switching tabs.
232233
* Leave this here in case it causes issues.
233234
*/
@@ -604,9 +605,6 @@ private void startPlayback() {
604605
} else {
605606
initializePlayer();
606607
}
607-
if (!disableFocus) {
608-
setKeepScreenOn(true);
609-
}
610608
}
611609

612610
private void pausePlayback() {
@@ -615,7 +613,6 @@ private void pausePlayback() {
615613
setPlayWhenReady(false);
616614
}
617615
}
618-
setKeepScreenOn(false);
619616
}
620617

621618
private void stopPlayback() {
@@ -1188,6 +1185,7 @@ public void setPausedModifier(boolean paused) {
11881185
} else {
11891186
pausePlayback();
11901187
}
1188+
setKeepScreenOn(!isPaused);
11911189
}
11921190
}
11931191

0 commit comments

Comments
 (0)