PDA

View Full Version : Reference Error (iframe,object)



darelorg
06-02-2014, 11:34 PM
Hello, I've just started learning PHP, JavaScript and I've got a big problem on my website. I'm getting this ReferenceError. I know what's the problem, but I don't know how to solve it. The main problem is because I want to use GKPlugin and Player(jwplayer). Plugin need to use object, example:


<object id="flashplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="400">
<param name="movie" value="player.swf" />
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" />
<param name="FlashVars" value="plugins=plugins/proxy.swf&proxy.link=http://www.vidbull.com/53qx9uo10k5d" />
<embed name="flashplayer" src="player.swf" FlashVars="plugins=plugins/proxy.swf&proxy.link=http://www.vidbull.com/53qx9uo10k5d" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="600" height="400" />
</object>

Script is generetad just to embed with iframe, and the problem is when I replace it with object, then I'm getting this error. I know that JS can't "call" that iframe to show because I've replaced it with object. You guys probably know about what I'm talking. I'm just searching for some instructions, guidelines from you.



ReferenceError: embeds is not defined


if (embeds[embedid].indexOf("rapidplayer")== iframe_ad){

Here's the rest of code, I think it's used to show iframe.




elseif (substr_count($link,"gorillavid")){
$video_id = explode("/",$link);
if (isset($video_id[count($video_id)-1])){
$video_id = $video_id[count($video_id)-1];
$embed = '<object id="flashplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="400">
<param name="movie" value="http://www.kiinc.com/videott/player.swf" />
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always" />
<param name="FlashVars" value="plugins=http://www.kiinc.com/videott/plugins/proxy.swf&proxy.link=http://gorillavid.in/'.$video_id.'" />
<embed name="flashplayer" src="player.swf" FlashVars="plugins=http://www.kiinc.com/videott/plugins/proxy.swf&proxy.link=http://gorillavid.in/'.$video_id.'" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="600" height="400" />
</object>';


This is the original code. Don't look at providers(source as gorillavid) because I used gorillavid in previous an posted another example from another source (zalaa)



elseif (substr_count($link,"zalaa")){
$video_id = explode("/",$link);
if (isset($video_id[count($video_id)-1])){
$video_id = $video_id[count($video_id)-1];
$embed = '<IFRAME SRC="http://www.zalaa.com/embed-'.$video_id.'.html" FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH='.$width.' HEIGHT='.$height.'></IFRAME>';

Function which embed links and should embed GKPlugin/Player:


// general image link

if (!$embed){
$embed = "<div style='background-color:#000000; width: ".$width."px; height: ".$height."px;text-align:center;cursor:pointer;' onclick='window.open(\"$link\");'>";
$embed.= "<p style='text-align:center; padding-top: 70px;'>";
$embed.= "<a href='$link' target='_blank' style='font-size:24px; color: #ffffff !important'>Click here to play this video</a>";
$embed.= "</p>";
$embed.= "</div>";
}
return $embed;
}


JavaScript code:




function getEmbed(embedid){
if (embeds[embedid].indexOf("rapidplayer")== iframe_ad){
var html_content = "<div class='fake_embed' id='fake_embed"+embedid+"' onclick='closeFakeEmbed("+embedid+");'>" +
"<br /><br />" +
"<div class='fake_embed_ad_close'><a href='javascript:void(0);' onclick='closeFakeEmbed("+embedid+");'>Close Ad</a></div>" +
"<div class='fake_embed_ad' id='fake_embed_ad" + embedid +"'>" +
"<iframe src='"+baseurl+"/iframe_ad.php' width='300' height='300' frameborder='NO' border='0'></iframe>" +
"</div>" +
"<div class='fake_embed_bar'><span class='fake_embed_bar_right'></span></div>" +
"</div>" +
"<div id='real_embed"+embedid+"' style='display:none'>"+embeds[embedid]+"</div>";


jQuery('#videoBox'+embedid).html(html_content);
jQuery('#videoBox'+embedid).show();
} else {
jQuery('#videoBox'+embedid).html(embeds[embedid]);
jQuery('#videoBox'+embedid).show();
}

}

function countDown(embedid){
showCounter = showCounter-1;
jQuery('span#counter').html(showCounter);
if (showCounter>0){
showTimer = setTimeout('countDown('+embedid+');',1000);
} else {
showTimer = null;
showCounter = 20;
getEmbed(embedid);
}
}

function changeEmbed(embedid, counter){
if (counter == 0){
jQuery('.embedcontainer').html('');
jQuery('.embedcontainer').hide();
getEmbed(embedid);
} else {
if (showTimer){
clearTimeout(showTimer);
}
showTimer = null;
showCounter = counter;

jQuery('.embedcontainer').html('');
jQuery('.embedcontainer').hide();
jQuery('#videoBox'+embedid).html(js_lang.ticker);
jQuery('#videoBox'+embedid+' span#counter').html(showCounter);
jQuery('#videoBox'+embedid).slideDown("slow");

showTimer = setTimeout('countDown('+embedid+');',1000);
}
/*
jQuery('li.selected').removeClass('selected');
jQuery('#selector'+embedid).addClass('selected');
*/
}

chrishirst
06-03-2014, 01:08 AM
Find your spelling error and remove the additional 's'

darelorg
06-03-2014, 01:53 AM
Find your spelling error and remove the additional 's'

What, where? Thats not the problem, it's working with iframe, if I change embed to object, script is not working because this JS. It calls iframe not object. Spelling is not the problem, I'm shure.

Philip M
06-03-2014, 10:35 AM
Find your spelling error and remove the additional 's'

chrishurst - you could be much more helpful. Snide and disagreeable replies will not win you any friends. You seem to have an attitude problem. You refer to a spelling error - where is it? The OP does not seem to think it exists.

glenngv
06-04-2014, 07:15 AM
Where is embeds array or object defined? I don't see it in your posted code.