Fix Full Screen Issues by Video Embedder WordPress Plugin

If you are hav­ing prob­lems try­ing to dis­play an embed­ded video(s) in your posts like me, then this might help you out. I usu­ally embed videos from Hulu, Vimeo and YouTube mostly. But it’s been a prob­lem try­ing to have the lat­ter 2 dis­play in fullscreen mode.

For Vimeo, the fullscreen icon/grpahic dis­plays on the over­lay of the video. But press­ing on it, just pauses the video and noth­ing else. For YouTube, there was no fullscreen icon/graphic in the first place. I think that might have been caused by some code changes on YouTube’s end.

Mean­while, it seems that the author of Video Embed­der, Kristof­fer Fors­gren, hasn’t been able to update the plu­gin since 2009. So for those like me who still finds good use for the plu­gin, it was a let down not find­ing any new comments/updates since August of 2009.

Any­ways, I pro­ceeded to just snoop around and edit part of the code in the file video-embedder.php (in the plugin’s direc­tory under wp-content/plugins/). Be sure to backup as usual before editing/updating code. To fix the Vimeo issue (and prob­a­bly oth­ers too), find the func­tion buildEm­bed() block and apply the fol­low­ing updates (around line 600):

function buildEmbed($code)
{
    $options = get_option(videoembedder_options);
    $width = $options["video_width"];
    $height = $options["video_height"];
    $object = '';
    if(is_feed()) {
        $object  = '<object width="'.$width.'" height="'.$height.'">';
        $object .= '<param name="movie" value="'.$code.'"></param>';
        $object .= '<param name="allowFullScreen" value="true" />';
        $object .= '<param name="wmode" value="transparent"></param>';
        $object .= '<embed src="'.$code.'" type="application/x-shockwave-flash" wmode="transparent" allowfullscreen="true" width="'.$width.'" height="'.$height.'"></embed>';
        $object .= '</object>';
    } else {
        $object  = '<object type="application/x-shockwave-flash" width="'.$width.'" height="'.$height.'" data="'.$code.'">';
        $object .= '<param name="movie" value="'.$code.'" />';
        $object .= '<param name="allowFullScreen" value="true" />';
        $object .= '<param name="wmode" value="transparent" />';
        $object .= '<param name="quality" value="high" />';
        $object .= '</object>';
    }
    return $object;
}

To fix the YouTube issue, find the sec­tion com­mented “// Youtube” in the func­tion videoembedder_embed() block. Then, just add the fol­low­ing high­lighted snip­pet (around line 300):

$new = buildEmbed("http://www.youtube.com/v/".$video."&amp;rel=0&amp;fs=1")

I hope that helps. Hope­fully, there’s an offi­cial update; or if you have found another plu­gin that is new and well-received by the Word­Press com­mu­nity that does what Video Embed­der do or bet­ter, please do let us know by post­ing a comment.

Update
I might as well add the fol­low­ing update to this post. If you would like to have the abil­ity for your YouTube embed­ded videos to play at a higher qual­ity and/or HD, just add the fol­low­ing snippet:

$new = buildEmbed("http://www.youtube.com/v/".$video."&amp;rel=0&amp;fs=1&amp;ap=%2526fmt%3D18")

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>