Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video Fullscreen Enabled on Android #110

Open
claudiocleberson opened this issue Sep 19, 2018 · 0 comments
Open

Video Fullscreen Enabled on Android #110

claudiocleberson opened this issue Sep 19, 2018 · 0 comments

Comments

@claudiocleberson
Copy link

Hey Man, thanks for your awesome plugin, it saved me a ton of time.

I had some difficult to play video in fullscreen on android. but that stackoverflow answer put me on the right track.
[https://stackoverflow.com/a/50103945/6805293]

If you find it helpful, you can enable fullscreen on Android, just by changing the class:

`public class FormsWebViewChromeClient : WebChromeClient
{

    readonly WeakReference<FormsWebViewRenderer> Reference;

    public FormsWebViewChromeClient(FormsWebViewRenderer renderer)
    {
        Reference = new WeakReference<FormsWebViewRenderer>(renderer);
    }

    readonly FrameLayout.LayoutParams matchParentLayout = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FillParent,
                                                                                                    ViewGroup.LayoutParams.FillParent);
    private ViewGroup parent;
    View customView;

    public FormsWebViewChromeClient(ViewGroup parent)
    {
        this.parent = parent;
    }

    public override void OnShowCustomView(View view, ICustomViewCallback callback)
    {
        customView = view;
        view.LayoutParameters = matchParentLayout;
        parent.AddView(view);
        customView.Visibility = ViewStates.Visible;
    }

    public override void OnHideCustomView()
    {
        //content.Visibility = ViewStates.Visible;
        parent.RemoveView(customView);
        customView = null;
    }
}`

and change the SetupControl on the FormsWebViewRendere classe for the:

webView.SetWebChromeClient(new FormsWebViewChromeClient(webView));

cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant