Title: Simple Video Embedder code
Last modified: August 19, 2016

---

# Simple Video Embedder code

 *  [vacom](https://wordpress.org/support/users/vacom/)
 * (@vacom)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/simple-video-embedder-code/)
 * 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..

The topic ‘Simple Video Embedder code’ is closed to new replies.

## Tags

 * [code](https://wordpress.org/support/topic-tag/code/)
 * [Coding](https://wordpress.org/support/topic-tag/coding/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [vacom](https://wordpress.org/support/users/vacom/)
 * Last activity: [16 years, 5 months ago](https://wordpress.org/support/topic/simple-video-embedder-code/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
