diff --git a/android/src/main/java/com/brentvatne/react/ReactVideoView.java b/android/src/main/java/com/brentvatne/react/ReactVideoView.java index 954130a1..6568f860 100644 --- a/android/src/main/java/com/brentvatne/react/ReactVideoView.java +++ b/android/src/main/java/com/brentvatne/react/ReactVideoView.java @@ -9,6 +9,7 @@ import android.os.Build; import android.os.Handler; import android.util.Log; import android.view.MotionEvent; +import android.view.WindowManager; import android.webkit.CookieManager; import android.widget.MediaController; @@ -89,7 +90,6 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP private Handler videoControlHandler = new Handler(); private MediaController mediaController; - private String mSrcUriString = null; private String mSrcType = "mp4"; private ReadableMap mRequestHeaders = null; @@ -591,6 +591,15 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP mMediaPlayerValid = false; super.onDetachedFromWindow(); + + if (mThemedReactContext != null) { + mThemedReactContext.getCurrentActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + mThemedReactContext.getCurrentActivity().getWindow().clearFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } + }); + } } @Override @@ -598,6 +607,15 @@ public class ReactVideoView extends ScalableVideoView implements MediaPlayer.OnP super.onAttachedToWindow(); + if (mThemedReactContext != null) { + mThemedReactContext.getCurrentActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + mThemedReactContext.getCurrentActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } + }); + } + if(mMainVer>0) { setSrc(mSrcUriString, mSrcType, mSrcIsNetwork, mSrcIsAsset, mRequestHeaders, mMainVer, mPatchVer); }