jQuery Flash Plugin - YouTube Video

« Back to the jQuery flash plugin

The Beatles - Twist And Shout

Javascript:

$(document).ready(function(){
    $('a[@href^="http://youtube.com"]').flash(
        { height: 370, width: 450 },
        { version: 8 },
        function(htmlOptions) {
            $this = $(this);
            htmlOptions.src = $this.attr('href');
            $this.before($.fn.flash.transform(htmlOptions));						
        }
    );
});

Before:

<p><a href="http://www.youtube.com/v/rFY1AF4r3Ts">My great YouTube video</a></p>

After:

<p>
    <embed width="425" height="350" type="application/x-shockwave-flash" src="http://youtube.com/v/TyvN59L4hJU" pluginspage="http://www.adobe.com/go/getflashplayer" flashvars=""/>
    <a href="http://www.youtube.com/v/rFY1AF4r3Ts">My great YouTube video</a>
</p>