我想以自动播放方式播放youtube视频,我在android中使用WebView,并且尝试使用以下代码自动播放youtube视频,但无法播放
html页面
<body>
<div id="setup-box">
<div class="bg"></div>
<div class="message">
<img src="platform/common/images/setup-logo.png"><br><br>
<span>Oynatıcı kodunuzu PixageOne platformu 'Oynatıcılar' sekmesine ekleyerek ekranınızı platforma tanımlayabilir, içeriklerinizi yayınlamaya başlayabilirsiniz.</span>
<div class="code"><span class="block">*</span><span class="block">*</span><span class="block">*</span><span class="block">*</span><span class="block">*</span><span class="block">*</span></div>
<div class="error" >** Lütfen İnternet Bağlantınızı Kontrol Ediniz !</div>
</div>
</div>
<video autoplay loop muted src="../Common/media/pixage.mp4" id="videoElement"></video>
</body
android类
WebView browser = ((Activity) context).findViewById(R.id.webView);
browser.getSettings().setJavaScriptEnabled(true);
browser.loadUrl( "file:///android_asset/index.html");
browser.addJavascriptInterface(new WebAppInterface(context), "MyFunction");
browser.setWebChromeClient(new WebChromeClientCustomPoster());
//((Activity) context).setContentView(browser);
WebSettings ws = browser.getSettings();
ws.setAllowFileAccess(true);
ws.setAllowFileAccessFromFileURLs(true);
ws.setMediaPlaybackRequiresUserGesture(false);
ws.setAllowUniversalAccessFromFileURLs(true);
ws.setJavaScriptCanOpenWindowsAutomatically(true);
ws.setAllowContentAccess(true);
ws.setJavaScriptEnabled(true);
ws.setDomStorageEnabled(true);