diff --git a/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java b/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java index e760a5f..42ca70a 100644 --- a/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java +++ b/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java @@ -5,6 +5,7 @@ import android.annotation.TargetApi; import android.app.DownloadManager; import android.content.Context; import android.content.Intent; +import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.Color; @@ -589,6 +590,7 @@ public class RNCWebViewManager extends SimpleViewManager { protected void setupWebChromeClient(ReactContext reactContext, WebView webView) { if (mAllowsFullscreenVideo) { + int initialRequestedOrientation = reactContext.getCurrentActivity().getRequestedOrientation(); mWebChromeClient = new RNCWebChromeClient(reactContext, webView) { @Override public void onShowCustomView(View view, CustomViewCallback callback) { @@ -600,6 +602,8 @@ public class RNCWebViewManager extends SimpleViewManager { mVideoView = view; mCustomViewCallback = callback; + mReactContext.getCurrentActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { mVideoView.setSystemUiVisibility(FULLSCREEN_SYSTEM_UI_VISIBILITY); mReactContext.getCurrentActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); @@ -630,6 +634,7 @@ public class RNCWebViewManager extends SimpleViewManager { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { mReactContext.getCurrentActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } + mReactContext.getCurrentActivity().setRequestedOrientation(initialRequestedOrientation); mReactContext.removeLifecycleEventListener(this); } @@ -1059,4 +1064,4 @@ public class RNCWebViewManager extends SimpleViewManager { } } } -} \ No newline at end of file +}