0

i have webview for video call which is i am using in xamarin form app. In video call both user can share file, i need to add option for user to choose image from gallery or from camera where user can capture image and send.

here is my code

    public override bool OnShowFileChooser(Android.Webkit.WebView webView, IValueCallback filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
    
    {





        this.message = filePathCallback;
        Intent chooserIntent = fileChooserParams.CreateIntent();
        chooserIntent.AddCategory(Intent.CategoryOpenable);
    
        this.mContext.StartActivity(Intent.CreateChooser(chooserIntent, "File Chooser"), filechooser, this.OnActivityResult);
        return true;
    }
    private void OnActivityResult(int requestCode, Result resultCode, Intent data)
    {
        if (resultCode != Android.App.Result.Ok)
        {
            this.message.OnReceiveValue(null);
            return;
        }
        if (data != null)
        {
            if (requestCode == filechooser)
            {
                if (null == this.message)
                {
                    return;
                }

                try
                {
                    this.message.OnReceiveValue(WebChromeClient.FileChooserParams.ParseResult((int)resultCode, data));

                }
                catch (Exception)
                {

                    throw;
                }
                this.message = null;
            }
        }
    }

with this code it only open gallery i need to know how i can add camera option with it

0 Answers0