Hello,
If you want to show webrtc, you need to add following permission in your AndroidManifest.xml.
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="true"/>
<uses-feature android:name="android.hardware.camera.autofocus"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
Then you need to create a custom renderer for your WebView
to enable the JavaScript and request permission.
[assembly: ExportRenderer(typeof(WebView), typeof(MyWebview))]
namespace webviewPlayVideo.Droid
{
internal class MyWebview : WebViewRenderer
{
public MyWebview(Context context) : base(context)
{
}
protected override void OnElementChanged(ElementChangedEventArgs<WebView> e)
{
base.OnElementChanged(e);
if (Control!=null) {
Control.Settings.JavaScriptEnabled = true;
Control.SetWebChromeClient(new MyWebChromeClient());
}
}
}
internal class MyWebChromeClient : Android.Webkit.WebChromeClient
{
public override void OnPermissionRequest(Android.Webkit.PermissionRequest request)
{
base.OnPermissionRequest(request);
request.Grant(request.GetResources());
}
}
}
Please note: Test link is not working.
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.