On my page I have a YouTube video's thumbnail as image, and I want to play the video using prettyPhoto after the user clicks on the image. How can I accomplish that?
Here's my code for the image:
<div class="video" id="videoPlaceHolder" style="position:relative;">
<a rel="prettyPhotos" href="https://www.youtube.com/embed/<?php getFirstFeatureVideoURL(); ?>">
<img style="background:url(<?php getFirstFeatureVideoThumbnail() ?>); background-repeat:no-repeat; background-size:cover; -moz-background-size: cover;" src="/images/ytIndex_overlay.png" onClick="addPlayer();" />
</a>
</div>
The php function getFirstFeatureVideoURL
grabs and returns the first video's "correct" URL (I have checked it separately and the video plays w/o any problem). The other function called getFirstFeatureVideoThumbnail
returns the video's thumbnail. I have all the plugins ready for the prettyPhoto
, and so far it's working for all the images perfectly. However, when I try to play this video by clicking on the image, it gives me the error:
Image cannot be loaded. Make sure the path is correct and the image exists
Why am I getting this error?