Keep screen on during video playback.
This commit is contained in:
parent
c548816daa
commit
c48ea68e7e
1 changed files with 8 additions and 1 deletions
|
@ -244,6 +244,9 @@ public class VideoPlayer extends FrameLayout {
|
||||||
|
|
||||||
public void setWindow(@Nullable Window window) {
|
public void setWindow(@Nullable Window window) {
|
||||||
this.window = window;
|
this.window = window;
|
||||||
|
if (exoPlayerListener != null) {
|
||||||
|
exoPlayerListener.setWindow(window);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlayerStateCallbacks(@Nullable PlayerStateCallback playerStateCallback) {
|
public void setPlayerStateCallbacks(@Nullable PlayerStateCallback playerStateCallback) {
|
||||||
|
@ -272,7 +275,7 @@ public class VideoPlayer extends FrameLayout {
|
||||||
|
|
||||||
private static class ExoPlayerListener implements Player.Listener {
|
private static class ExoPlayerListener implements Player.Listener {
|
||||||
private final VideoPlayer videoPlayer;
|
private final VideoPlayer videoPlayer;
|
||||||
private final Window window;
|
private Window window;
|
||||||
private final PlayerStateCallback playerStateCallback;
|
private final PlayerStateCallback playerStateCallback;
|
||||||
private final PlayerPositionDiscontinuityCallback playerPositionDiscontinuityCallback;
|
private final PlayerPositionDiscontinuityCallback playerPositionDiscontinuityCallback;
|
||||||
|
|
||||||
|
@ -297,6 +300,10 @@ public class VideoPlayer extends FrameLayout {
|
||||||
onPlaybackStateChanged(videoPlayer.exoPlayer.getPlayWhenReady(), playbackState);
|
onPlaybackStateChanged(videoPlayer.exoPlayer.getPlayWhenReady(), playbackState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setWindow(Window window) {
|
||||||
|
this.window = window;
|
||||||
|
}
|
||||||
|
|
||||||
private void onPlaybackStateChanged(boolean playWhenReady, int playbackState) {
|
private void onPlaybackStateChanged(boolean playWhenReady, int playbackState) {
|
||||||
switch (playbackState) {
|
switch (playbackState) {
|
||||||
case Player.STATE_IDLE:
|
case Player.STATE_IDLE:
|
||||||
|
|
Loading…
Add table
Reference in a new issue