WordPress.org

Ready to get started?Download WordPress

Forums

Simple Video Embedder code (1 post)

  1. vacom
    Member
    Posted 4 years ago #

    My video all in megavideo.com but it not accept video from megavideo.com.

    I edit this code in simple-video-embedder/video-poster.php but it still not working! I edit in Youtube code coz the megavideo it same with youtube...

    You can see here:

    function megavideoOracle($url)
    	{
    		return (bool) preg_match("#http://(?:www\.)?megavideo\.com/watch\?v=([_\-a-z0-9]+)#i", $url);
    	}
    
    	function megavideoPlayer($url, $width, $height)
    	{
    		$matches = array();
    
    		// example: http://www.megavideo.com/?v=A0NNIJM6
    		preg_match("#http://(?:www\.)?megavideo\.com/watch\?v=([_\-A-Z0-9]+)#i", $url, $matches);
    
    		if( strstr($url, "&fmt=22") ) // Check for HD
    		{
    			$res = '<object width="' . $width . '" height="' . $height . '"><param value="http://www.megavideo.com/v/' . $matches[1] . '&ap=%2526fmt%3D22';
    			if ( strstr($url, "&autoplay=1") ) $res .= '&autoplay=1';
    			$res .= '" name="movie" /><param value="window" name="wmode" /><param value="true" name="allowFullScreen" /><embed width="' . $width . '" height="' . $height . '" wmode="window" allowfullscreen="true" type="application/x-shockwave-flash" src="http://www.megavideo.com/v/' . $matches[1] . '&ap=%2526fmt%3D22';
    			if ( strstr($url, "&autoplay=1") ) $res .= '&autoplay=1';
    			$res .= '"></embed></object>';
    			return $res;
    		}
    		else
    		{
    			$res = '<object width="' . $width . '" height="' . $height . '"><param name="movie" value="http://www.megavideo.com/v/' . $matches[1] . '';
    			if ( strstr($url, "&autoplay=1") ) $res .= '&autoplay=1';
    			$res .= '"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.megavideo.com/v/' . $matches[1] . '';
    			if ( strstr($url, "&autoplay=1") ) $res .= '&autoplay=1';
    			$res .= '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="' . $width . '" height="' . $height . '"></embed></object>';
    			return $res;
    		}
    	}

    I use the Video Elements Theme, any help our programmer, please..

Topic Closed

This topic has been closed to new replies.

About this Topic