How to auto play iframe youtube on webview android -
I use Android webview your app to display videos from YouTube, it works well.
But I want this to be an automatic game.
It would add to my activity that I Veediouarel the "? Autoplay = 1" , but nothing changes, it will still auto play is not. I think that webview or play is not possible auto Android browser to get, I think you need "YouTube API" check out the link below: 1] the 2] These above links will give you an idea of YouTube as well as the API.
Expands the public class LandVideoAct activity {WebView mWebView; String videoURL = ""; @ Override protected void saved create (bundled Instansstet) {Suprknkret (saved Instensstet); RequestWindowFeature (Window.FEATURE_NO_TITLE); SetContentView (R.layout.landfull); VideoURL = "http://www.youtube.com/embed/VYIi49czywo?autoplay=1"; MWebView = (webview) ViewById (RID. FullViewView); String vid = "& lt; html> body style = \" margin: 0; Padding: 0 \ "iframe width = \" 100% \ "height = \" 100% \ "src = \" "+ video URL + \" \ "type = \" text / html \ "Frembord = \" 0 \ "& Gt; & lt; / iframe & gt; & lt; body & gt; & lt; html & gt;"; WebChromeClient mWebChromeClient = New WebChromeClient () {Public Lighting on Change (Webview View, Intro New Progress) {}}; . MWebView.getSettings () setPluginState (WebSettings.PluginState.ON); MWebView.setWebChromeClient (mWebChromeClient); MWebViewksetWebViewClient (new WebViewClient () {public void onPageFinished (WebView view, String url) {mWebView.loadUrl ( "javascript: (function () {DocumentkgetElementsByTagName ( 'video') [0] Kple ();}) () ");}}); MWebView.getSettings () setJavaScriptEnabled (true). MWebView.getSettings () setAppCacheEnabled (true). MWebView.setInitialScale (1); . MWebView.getSettings () setLoadWithOverviewMode (true); . MWebView.getSettings () setUseWideViewPort (true); If (Build.VERSION.SDK_INT & lt; 17) {Log.i ("GPSNETWORK", "<17"); } And {Log.i ("GPSNETWORK", build.VERSION.SDK_INT + "& gt; = 17"); . MWebView.getSettings () setMediaPlaybackRequiresUserGesture (wrong); } MWebView.loadData (vid, "text / html", "UTF-8"); }}
Comments
Post a Comment