What I Need:
- when user click on video url it must redirected to you video.
- we are using html5lightbox plugin .
problem im facing:
- redirection is not working in iframe.
- though when i click on src of iframe it is redirected to you tube url.
here is html code
<div id="html5lightbox-web" style="display:block;width:500px;height:400px;">
<iframe width="500" height="400" src="http://t.co/hNLWmspb" frameborder="0">
</iframe></div>
- i have tested on chrome its not auto redirected t particular page url.
problem explanation
- when user click on image video should be opened .
tweet data
VW @ European Motor Show Brussels - Behind the scene (part 1): <a class="twtlnk" rel="nofollow" href="http://youtu.be/XzqagJTsNrc" target=\"_blank\">http://youtu.be/XzqagJTsNrc</a> via <a class="twthand" href="https://twitter.com/youtube" rel="nofollow" target=\"_blank\" >@youtube</a>
here is code snippet
$media_url;// http://t.co/hNLWmspb
$parsed = parse_url($media_url);
print_r($parsed);
Array ( [scheme] => http [host] => t.co [path] => /hNLWmspb
$ytarray=explode("/", $media_url);
$ytendstring=end($ytarray);
$ytendarray=explode("?v=", $ytendstring);
$ytendstring=end($ytendarray);
$ytendarray=explode("&", $ytendstring);
$ytcode=$ytendarray[0];
print_r($ytcode);
if(preg_match('/http:\/\/(www\.)*youtube\.com\/.*/',$parsed['path']))
{
// echo "YouTube URL found!\n";
$content='<div class="4u"><div class="box photo tile">
<a href='.$media_url.' class="html5lightbox" data-group=""
titl="'.$tweet_content.'">';
}
else
{
$content='<div class="4u"><div class="box photo tile">
<a href="http://www.youtube.com/embed/""'.$ytcode.' class="html5lightbox" data-group=""
titl="'.$tweet_content.'">';
}
- i have taken help from How to embed YouTube videos in PHP?.