Picture lead-in to Youtube video

Posted by cf_PhillipSenn on Stack Overflow See other posts from Stack Overflow or by cf_PhillipSenn
Published on 2010-05-13T15:15:42Z Indexed on 2010/05/13 15:24 UTC
Read the original article Hit count: 152

Filed under:
|

I have the following, which displays an image and when the user clicks on the image, it takes them to the Youtube video:

<html>
<head>
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1", {uncompressed: true});
</script>

<script>
jQuery(function($){
    $('a').click(function() {
        $(this).html('<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/Msef24JErmU&hl=en_US&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Msef24JErmU&hl=en_US&fs=1&rel=0&color1=0x2b405b&color2=0x6b8ab6" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>');
        return false;
    });
});
</script>
</head>
<body>
    <a href="javascript:void();"><img src="http://www.clipov.net/pic/paul_oakenfold+%5Bstarry_eyed_surprise%5D+_+3-07+mtv_dance_beats+clear.jpg"></a>
</body>
</html>

Q: How do I autoplay the video to keep the user from having to click on it (a second time)?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about youtube