diff --git a/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java b/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java index 91bad7b..12dc06f 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.graphics.Bitmap; import android.graphics.Color; import android.net.Uri; @@ -533,6 +534,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) { @@ -544,6 +546,7 @@ 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); @@ -574,6 +577,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); }