i am trying to make a plugin that would play a video From Dailymotion inside of the JW PLAYER.. And i having an issues that is driving me crazy...
so maybe someone with more knowledge can help me out here.. the plugin is pretty simple and is for a joomla video component. so i will post the revelant part of the php code..
basically i am grabbing the load a VIDEO LINK from the DAILYMOTION that located in my DB
so the $video_detail->video_url = http://www.dailymotion.com/video/x4m1b6_sengoku-kazuyuki-fujita-vs-peter-gr_sport
then i am using CURL to load the link above over at http://www.keepvid.com and then it will SCRAPE the source code of the page for the .FLV link which everything working fine. as i scrape and extract the .flv file link from keepvid and you can download the video.. and also i echoed the link to my page no problem..
<?php
// ##################################################
// ########### GET DIRECT FLV LINK FROM DAILYMOTION
// ##################################################
$geturl = "http://keepvid.com/?url=".$video_detail->video_url."";
//$geturl = $video_detail->video_url; // RETRIEVE video_url FROM THE DATABASE
if (function_exists('curl_init')){
$ch=curl_init();
$timeout=30; // set to zero for no timeout
curl_setopt($ch,CURLOPT_URL, $geturl);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
$file_contents=curl_exec($ch);
curl_close($ch);
}
$start_position = strpos($file_contents, "Links found on");
$start_position = strpos($file_contents, "Report any problems to", $start_position);
$start_position = strpos($file_contents, "<a href=\"", $start_position)+9;
$end_position = strpos($file_contents, "\"", $start_position)-$start_position;
$getflvlink = substr($file_contents, $start_position, $end_position);
$flv_link = ltrim($getflvlink);
// echo "".$flv_link."";
// $flv_link = "http://proxy-35.dailymotion.com/16/320x240/flv/7746594.flv?3729391860564098ca7ed38576d57c4e13a7dae";
?>
<script type="text/javascript">
var flashvars =
{
'file': '<?php echo $flv_link;?>',
'type': 'video',
'skin': '<?php echo $mosConfig_live_site;?>/components/com_jomtube/assets/swf/skins/bekle/overlay.swf',
'controlbar': 'over',
'stretching': 'uniform',
'frontcolor': 'ffffff',
'lightcolor': 'ff6600',
'autostart': 'true'
};
var params =
{
'allowfullscreen': 'true',
'allowscriptaccess': 'always'
};
var attributes =
{
'name': 'JomPlayerId1',
'id': 'JomPlayerId1'
};
swfobject.embedSWF('<?php echo $mosConfig_live_site;?>/components/com_jomtube/assets/swf/player.swf', 'JomTubePlayerId1', '<?php echo $videowidth;?>', '<?php echo $videoheight;?>', '9.0.124', false, flashvars, params, attributes);
</script>
<?php
$jwplayer_embed = "<div id=\"JomPlayerContainer\" class=\"JomPlayerContainer\">
<a id=\"JomTubePlayerId1\" class=\"player1\" href=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\">Get the Adobe Flash Player to see this video.</a>
</div>
";
return $jwplayer_embed;
?>
and this is the part thats driving me crazy... is run the php it returns on the page..
Get the Adobe Flash Player to see this video.
but if i uncomment the hardcoded variable then it works
// $flv_link = "http://proxy-35.dailymotion.com/16/320x240/flv/7746594.flv?3729391860564098ca7ed38576d57c4e13a7dae";or if hard code the in javascript
'file': 'http://proxy-35.dailymotion.com/16/320x240/flv/7746594.flv?3729391860564098ca7ed38576d57c4e13a7dae',instead
'file': '<?php echo $flv_link;?>',i just dont understand as i can echo the exact same link on the same page that i WEBSCRAPED from the the http://www.keepvid.com but instead of the jwplayer showing the video it shows the Get the Adobe Flash Player to see this video. but if i uncomment the the 2 methods above with same exact link and hard code it in the php it works..
any help appreciated.. as i run out of logical ideas..