How To Autoplay Youtube Videos?

April 8, 2011

 

Sometimes you’ll want to autoplay Youtube videos, for example, if you have a video squeeze page (see mine here).

By default, Youtube videos do not autoplay. But the good news is that autoplaying Youtube videos is very easy. All  you need to do is add one line of code:

autoplay=1

The hardest part is knowing how and where to add it, and that’s not hard! :)

New Youtube Embed Code (default)

To get the Youtube embed code, you simply go to the video you want to embed on your website and click on the ‘Embed’ button (located below the video). You’ll be shown some code that looks like this:

<iframe title=”YouTube video player” width=”640″ height=”390″ src=”http://www.youtube.com/embed/s3DcPo3e5H0?rel=0″ frameborder=”0″ allowfullscreen></iframe>

Here’s where you can add the autoplay code:

<iframe title=”YouTube video player” width=”640″ height=”390″ src=”http://www.youtube.com/embed/s3DcPo3e5H0?rel=0&amp;autoplay=1” frameborder=”0″ allowfullscreen></iframe>

Old Youtube Embed Code

If you’re using the old Youtube embed code, the original code will look like this:

<object width=”640″ height=”390″><param name=”movie” value=”http://www.youtube.com/v/s3DcPo3e5H0?fs=1&amp;hl=en_GB&amp;rel=0″></param><param name=”allowFullScreen” value=”true”></param><param name=”allowscriptaccess” value=”always”></param><embed src=”http://www.youtube.com/v/s3DcPo3e5H0?fs=1&amp;hl=en_GB&amp;rel=0″  type=”application/x-shockwave-flash” allowscriptaccess=”always” allowfullscreen=”true” width=”640″ height=”390″></embed></object>

Here’s where you’ll need to add the Youtube autoplay code (2 places):

<object width=”640″ height=”390″><param name=”movie” value=”http://www.youtube.com/v/s3DcPo3e5H0?fs=1&amp;hl=en_GB&amp;rel=0&amp;autoplay=1“></param><param name=”allowFullScreen” value=”true”></param><param name=”allowscriptaccess” value=”always”></param><embed src=”http://www.youtube.com/v/s3DcPo3e5H0?fs=1&amp;hl=en_GB&amp;rel=0&amp;autoplay=1” type=”application/x-shockwave-flash” allowscriptaccess=”always” allowfullscreen=”true” width=”640″ height=”390″></embed></object>

If you’ve found this article helpful, please leave a comment below. Thanks!

.

Related Posts

Tags: , How To

Facebook comments:

to “How To Autoplay Youtube Videos?”
  1. Eddie says:

    Do you know a line of code to add color to the play bar? They used to be able to come in all sorts of colors, blue, green, red, etc.

  2. Hi Eddie, thanks for asking! I’ve just created a video and step-by-step tutorial that you can follow here:

    How To Change Youtube Video Border and Control Bar Color

  3. Melanie says:

    Hm doesn’t seem to work.

  4. Hi Melanie, please send me a copy of your embed code and I’ll take a look at it. Use the Contact form here. Thanks.

  5. Amber says:

    I can’t get it to work. Do you need my embed code?

  6. Sure Amber. Send it through the form here: http://johnlagoudakis.com/contact Thanks

  7. Facundo says:

    Perfect, exactly the little piece of code I was looking for. Thanks

  8. Works ‘like a boss’
    Will use this again as now you tube videos can autoplay its a whole new world. Nice one dude

  9. Glad to hear it! Thanks for the feedback.

  10. bob says:

    Thanks for this sir! worked like a charm! looks like this tutorials’ much updated compared to youtube’s API.
    bob´s last [type] ..When the old comes new… again.

  11. Dave says:

    You might find this useful … created a script that allows you to select which Youtube embed parameters to include.

    http://www.davewooding.com/how-to-customize-and-embed-a-youtube-video/

    Thanks.

    Dave

  12. Well done Dave! Very handy script.

  13. Nice to see that such a helpful site and contents – Thanks!

  14. Hiba says:

    Hi,
    I’ve been having trouble embeding youtube players for the past 6 months…I used to be able to embed them just fine along with the autoplay thing but I don’t know why the embeding stopped working with either of the codes (old vs. new).
    I have a feeling that the new code might not work on the website I’m trying to embed videos on (the website is http://www.viki.com) just because I don’t know whether the iframe thing works for them.
    But I know that youtube embeding does work because I’ve seen other people embed the videos on their viki profiles, and even on comments.
    I’ve had to resort to using mixpod.com but it doesn’t play all the videos I want.
    Anyway for now I’d just like help with embeding this playlist >
    http://www.youtube.com/playlist?list=PL6E27736F70E133B2

    PLEASE HELP!!!!!

  15. Helmin Husakovic says:

    Thanks, it’s work!

Leave a Reply

(required)

(required)


CommentLuv badge

Local Online Marketing – How To Approach Business Owners

Just yesterday, a friend and I went out to lunch. He’s starting out a new local marketing business and...

What Domain Name Should I Register For My Squeeze Page?

Recently I was asked by a subscriber the following question: “G’day John, What are your thoughts in regards to...

How To Set Up Tracking For Email Optins

Building an email list is super important for any business. For those that take the iniative to do this,...

Fixed or Growth Mindset?

Right now I’m listening to an amazing audio book by Carol Dweck titled, “Mindset: The New Psychology of Success“....

My Money Management System

Recently I attended a seminar featuring a very successful business person. During the seminar he outlined a very simple...

Contact Form 7 Not Working?

Do you find that your Contact Form 7 form is not working anymore? For a few years now I’ve...

Are You a Leader?

What are some of the characteristics of a good trainer, a good coach, or a good leader? Here’s some...

Do You Know What You Want?

Do you know what you want? Most people don’t get what they want because they don’t know what they...

Can You Make Money Selling Amazon Kindle Ebooks?

Can you make money selling Amazon Kindle ebooks? Absolutely! In fact, I didn’t realize just how it easy it...

Your Aweber Account Has Been Flagged!

Here’s a scary subject line I just saw in my inbox today: “Your Aweber Account Has Been Flagged” It’s...