Android WebView中video标签支持

1.启用Activity的硬件加速

[Activity(Label = "MyApp", HardwareAccelerated =true, Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]

    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity

    {

2.设置MediaPlaybackRequiresUserGesture为false

                 Control.Settings.AllowUniversalAccessFromFileURLs = true;

                Control.Settings.BuiltInZoomControls = false;

                Control.Settings.LoadsImagesAutomatically = true;

                Control.Settings.JavaScriptCanOpenWindowsAutomatically = false;

                Control.Settings.SetSupportZoom(false);

                Control.Settings.JavaScriptCanOpenWindowsAutomatically = false;

                Control.Settings.JavaScriptEnabled = true;

                Control.Settings.MediaPlaybackRequiresUserGesture = false;

                Control.Settings.DefaultTextEncodingName = "utf-8";

                Control.Settings.DisplayZoomControls = false;

你可能感兴趣的:(Android WebView中video标签支持)