1. Are you ready for the Galaxy S20? Here is everything we know so far!

How to play video fullscreen with landscape in Android WebView?

Discussion in 'Android Development' started by Alysson122010, Sep 12, 2019.

  1. Alysson122010

    Alysson122010 Lurker
    Thread Starter

    Person I have an application that I have a html5 player I have also a code that makes my webview accept that this html 5 enables the full screen player option. It even needs to be with screen rotation enabled to be able to see landscape but I want it to be landscape when I click the full screen option. How do I do it?

    code down:
    class Browser_home extends WebViewClient {

    Browser_home() {
    mInterstitialAd.show ();
    }

    @override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
    mInterstitialAd.show ();
    super.onPageStarted(view, url, favicon);

    }

    @override
    public void onPageFinished(WebView view, String url) {
    mInterstitialAd.show ();
    setTitle(view.getTitle());
    super.onPageFinished(view, url);



    }
    }





    private class MyChrome extends WebChromeClient {

    private View mCustomView;
    private WebChromeClient.CustomViewCallback mCustomViewCallback;
    protected FrameLayout mFullscreenContainer;
    private int mOriginalOrientation;
    private int mOriginalSystemUiVisibility;


    MyChrome() {mInterstitialAd.show ();}

    public Bitmap getDefaultVideoPoster()
    {
    if (mCustomView == null) {
    mInterstitialAd.show ();
    return null;

    }
    mInterstitialAd.show ();
    return BitmapFactory.decodeResource(getApplicationContext().getResources(), 2130837573);
    }

    public void onHideCustomView()
    {
    mInterstitialAd.show ();
    ((FrameLayout)getWindow().getDecorView()).removeView(this.mCustomView);
    this.mCustomView = null;
    getWindow().getDecorView().setSystemUiVisibility(this.mOriginalSystemUiVisibility);
    setRequestedOrientation(this.mOriginalOrientation);
    this.mCustomViewCallback.onCustomViewHidden();
    this.mCustomViewCallback = null;

    }

    public void onShowCustomView(View paramView, WebChromeClient.CustomViewCallback paramCustomViewCallback)
    {
    if (this.mCustomView != null)
    {
    mInterstitialAd.show ();
    onHideCustomView();

    return;
    }
    mInterstitialAd.show ();
    this.mCustomView = paramView;
    this.mOriginalSystemUiVisibility = getWindow().getDecorView().getSystemUiVisibility();
    this.mOriginalOrientation = getRequestedOrientation();
    this.mCustomViewCallback = paramCustomViewCallback;
    ((FrameLayout)getWindow().getDecorView()).addView(this.mCustomView, new FrameLayout.LayoutParams(-1, -1));
    getWindow().getDecorView().setSystemUiVisibility(3846);

    }

    }
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...
Similar Threads - play video fullscreen
  1. ukiltmybrutha
    Replies:
    1
    Views:
    236
  2. Ruskey
    Replies:
    6
    Views:
    546
  3. pranaman
    Replies:
    1
    Views:
    359
  4. ashcliuewkanc
    Replies:
    1
    Views:
    761
  5. Nishaun Lawrence
    Replies:
    9
    Views:
    1,119
  6. karl Waddington
    Replies:
    4
    Views:
    424
  7. Jimmy Luong
    Replies:
    2
    Views:
    387
  8. chinnar
    Replies:
    0
    Views:
    1,133
  9. MoodyBlues
    Replies:
    6
    Views:
    769
  10. Queenie AM
    Replies:
    5
    Views:
    913

Share This Page

Loading...