jQuery autoplay video youtube

Sometimes you just need to start a video playing by some user interaction on the page other than clicking right on that video itself. Perhaps a Play Video button of your own creation lives on your page and you want to start that video when that button is clicked. Thats JavaScript territory. And if that video is a YouTube or Vimeo video, well need to make use of the APIs they provide. No problem.,Its likely you have some structure to your JavaScript on your page, so generally Id recommend just having this function call another function that is inside your organizational system and get going on the right track right away. But for this tutorial, lets just keep it soup-y.,Here we bind a simple click event to an element on the page with the id #play-button [whatever custom button you want] and call the player objects playVideo method.,Thanks for the article, Chris! Always good to get people thinking about the possibilities of a sometimes overlooked service!

Video liên quan

Chủ Đề