Auto Play Using <iframe> You Tube video -? Autoplay = 1 does not work

How to start auto-play video using a new style of embedded code for Youtube?

My code followed these instructions and does not work. I also looked at YouTube for help, and they say the same thing - it doesn’t work for me.

<html><body> <iframe width="640" height="385" src="//www.youtube.com/embed/0319ZgKMLzw?autoplay" frameborder="0" allowfullscreen></iframe></body> </html> 

Look, not auto-play here , the code is in firebug.

+6
source share
3 answers

Change your embed code to "? Autoplay = 1" and add "http: //". Here is the working code for you ...

 <iframe width="640" height="385" src="http://www.youtube.com/embed/0319ZgKMLzw?autoplay=1"> </iframe> 
+2
source

try adding = 1 after "auto play" on your code

0
source

try it. It worked for me.

 private class AutoPlayVideoWebViewClient extends WebViewClient { @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); // mimic onClick() event on the center of the WebView long delta = 100; long downTime = SystemClock.uptimeMillis(); float x = view.getLeft() + (view.getWidth()/2); float y = view.getTop() + (view.getHeight()/2); MotionEvent tapDownEvent = MotionEvent.obtain(downTime, downTime + delta, MotionEvent.ACTION_DOWN, x, y, 0); tapDownEvent.setSource(InputDevice.SOURCE_CLASS_POINTER); MotionEvent tapUpEvent = MotionEvent.obtain(downTime, downTime + delta + 2, MotionEvent.ACTION_UP, x, y, 0); tapUpEvent.setSource(InputDevice.SOURCE_CLASS_POINTER); view.dispatchTouchEvent(tapDownEvent); view.dispatchTouchEvent(tapUpEvent); } } 

Somewhere,

 myWebView.setWebViewClient(new AutoPlayVideoWebViewClient()); 
0
source

Source: https://habr.com/ru/post/953397/


All Articles