I\'m trying to start playing an embedded youtube video by clicking an image. The idea is to have an image on top of a video, and when the image is clicked it fades out and s
The quick and dirty way is to simply swap out the iframe with one that has autoplay=1 set using jQuery.
Placeholder:
Autoplay link:
Watch the video
The onClick catcher that calls the function
jQuery('a.introVid').click(function(){
autoPlayVideo('VIDEO_ID_HERE','450','283');
});
The function
/*--------------------------------
Swap video with autoplay video
---------------------------------*/
function autoPlayVideo(vcode, width, height){
"use strict";
$("#videoContainer").html('');
}