Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jun 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Reference Error (iframe,object)

    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="clsid27CDB6E-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.



    Code:
        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)


    Code:
        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:

    Code:
    // 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:



    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');
            */
        }

  • #2
    New Coder
    Join Date
    Jun 2005
    Location
    Blackpool. UK
    Posts
    98
    Thanks
    0
    Thanked 4 Times in 4 Posts
    Find your spelling error and remove the additional 's'
    Chris

    Indifference will be the downfall of mankind, but who cares?

  • #3
    New to the CF scene
    Join Date
    Jun 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by chrishirst View Post
    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.

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,010
    Thanks
    203
    Thanked 2,538 Times in 2,516 Posts
    Quote Originally Posted by chrishirst View Post
    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.
    Last edited by Philip M; 06-03-2014 at 11:04 AM.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,043
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Where is embeds array or object defined? I don't see it in your posted code.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •