Shopkeeper by counter in store

Sometimes you will want a YouTube video you've embedded on your website to play automatically when someone visits your site.

I do this on my own sites. Many of my squeeze pages have videos that introduce the free offer. Sometimes I want videos to autoplay on my blog for specific posts.

It's not hard to get a YouTube video to autoplay, in fact, it's very easy! All you need is one line of code …

autoplay = 1

Because this code is added to the YouTube video url, we need an extra command to append it. That command is &. Therefore, our line of code became this:

& autoplay = 1

Knowing where and how to add this code is the tricky part (but even that is easy).

First, you need to grab the embed code for the YouTube video. To do this, go to the video on YouTube and click on the 'Embed' button (located just below the video).

Here's the original code that you get from YouTube will look something like this:

title = "YouTube video player" width = "640" height = "390" src = "[YouTube-url]? rel = 0" frameborder = "0" allowfullscreen

Here's what it should look like after you've added the autoplay code:

title = "YouTube video player" width = "640" height = "390" src = "[YouTube-url]? rel = 0 & autoplay = 1 " frameborder = "0" allowfullscreen

If you're using the old YouTube embed code, the video url appears twice. Because of this you'll need to append the autoplay code to both the urls.

And that's all that you need to do! Your YouTube videos will now play automatically whenever someones visits your website.

If you want to turn off the autoplay feature, there's one of two things you can do.

One option is to delete the extra line of code that you added (ie & autoplay = 1), thus leaving the embed code the way it was before.

Another option is to change the autoplay value from 1 to 0, ie autoplay = 0.

One thing you should be aware of when you turn on the YouTube autoplay feature is that it affects the view count. If someone goes to your website and the video starts playing automatically, it will not count as another view toward the total view count.

If, however, the visitor decides to play the video again, it will then count as a view.

The reasoning behind this, I assume, is to stop scrupulous people inflating their view count numbers (which in turn will affect the video's ranking).

Source by John Lagoudakis