After I add option autoplay of youtube ,I can't see the ads

88 views Asked by At

When I write youtube iframe tag with autoplay like this,

<iframe width="560" height="315" src="https://www.youtube.com/embed/T_gCnf9-qW0?showinfo=0" frameborder="0" allowfullscreen></iframe>

I can see the ad while video playing but, when

<iframe width="560" height="315" src="https://www.youtube.com/embed/T_gCnf9-qW0?showinfo=0&autoplay=1" frameborder="0" allowfullscreen></iframe>

I can't see the ads. i just added autoplay=1.

How can I see the ads with autoplay ?

1

There are 1 answers

0
abielita On

I don't see any error with your code. You may check this documentation which shows how to set autoplay properly. Also be noted that in certain mobile browsers (such as Chrome and Safari), the HTML5 element only allows playback to take place if it's initiated by a user interaction (such as tapping on the player). As stated in this link, functions and parameters such as autoplay, playVideo(), loadVideoById() won't work in all mobile environments due to this restriction.