WebView
, so I use HTML5 tag <video>
and put these web files into src/main/asset/... folder.I used cprcrack/VideoEnabledWebView and RotatedVerticalFrameLayout. I just changed part of onShowCustomView(View view, CustomViewCallback callback) in VideoEnabledWebChromeClient.
// Hide the non-video view, add the video view, and show it
activityNonVideoView.setVisibility(View.INVISIBLE);
Point screenSize = Utils.getDisplaySize(activityNonVideoView.getContext());
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(screenSize.y, screenSize.x);
params.gravity = Gravity.BOTTOM;
videoViewContainer.setLayoutParams(params);
activityVideoView.addView(videoViewContainer);
activityVideoView.setVisibility(View.VISIBLE);
In Activity I changed line in OnToggledFullscreenCallback
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE)
to
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
so that it hides navigation bar.
For getting display size I used
public static Point getDisplaySize(Context context) {
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
Point size = new Point();
display.getRealSize(size);
return size;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With