xamarin android中的Webview html音频播放器

xamarin android中的Webview html音频播放器,android,xamarin,Android,Xamarin,如何在webview中获得此音频播放器,如果我们在chrome或任何浏览器中播放音频链接, 默认情况下,它提供了类似于上面的内容,我们可以得到与android webview完全相同的结果。 我试图获取html元素,但UI看起来非常奇怪- 尝试1- var iframeURL = string.Format("<video width=\"{0}\" height=\"{1}\" controls=\"\" autopl

如何在webview中获得此音频播放器,如果我们在chrome或任何浏览器中播放音频链接, 默认情况下,它提供了类似于上面的内容,我们可以得到与android webview完全相同的结果。 我试图获取html元素,但UI看起来非常奇怪-

尝试1-

var iframeURL = string.Format("<video width=\"{0}\" height=\"{1}\" controls=\"\" autoplay=\"\" name=\"media\"><source src=\"{2}\" type=\"audio/mpeg\"></video>",
            width, height, embedUrl);
        string finalUrl = string.Format("<html><body>{0}</body></html>", iframeURL);
var-iframeURL=string.Format(“”,
宽度、高度、嵌入深度);
string finalUrl=string.Format(“{0}”,iframeURL);
最后一个url是我的web源

尝试2-

var iframeURL = string.Format("<iframe style=\"position:fixed; top: 50%; left: 50%;" +
      " width:" + " {1}px; height: {2}px; margin-left: {3}px; margin-top: {4}px;\"" + " src =\"{0}\" frameborder=\"0\" " + "allow=\"accelerometer;" +
      " autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>",
            embedUrl, width, height, -width / 2, -height / 2);
        string finalUrl = string.Format("<html><body>{0}</body></html>", iframeURL);
        return finalUrl;
var-iframeURL=string.Format(“”,
嵌入URL,宽度,高度,-宽度/2,-高度/2);
string finalUrl=string.Format(“{0}”,iframeURL);
回归终局;
应该这样做

   var html = string.Format("<!DOCTYPE html><html><head><meta name=\"viewport\"
   content=\"width=device-width, initial-scale=1.0\"></head><body><audio controls
   autoplay name=\"media\"><source src=\"{0}\" type=\"audio/mpeg\"></audio> 
   </body></html>",embedUrl);
    webView.Source = new HtmlWebViewSource
    {
    Html = html,
    };

var html=string.Format(“

您是在Xamarin.Forms还是Xamarin.Android项目上工作?在Xamarin.Forms上工作……但我想一切都可以……我可以做自定义Reneder,但问题是什么应该是正确的htmlWhy不使用音频元素?尝试过了,不起作用,它只显示一个播放图像,其他什么都没有,我的答案对您有用吗?
<WebView x:Name="webView" VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"></WebView>