protected function getVideoIdFromUrl($videoUrl)
	{
		$videoId = $videoUrl;
		$urlPart = parse_url($videoUrl);
		$path = $urlPart['path'];
		if (isset($urlPart['host']) && strtolower($urlPart['host']) == 'youtu.be') {
			if (preg_match('/\/([^\/\?]*)/i', $path, $temp))
				$videoId = $temp[1];
		} else {
			if (preg_match('/\/embed\/([^\/\?]*)/i', $path, $temp))
				$videoId = $temp[1];
			elseif (preg_match('/\/v\/([^\/\?]*)/i', $path, $temp))
				$videoId = $temp[1];
			elseif (preg_match('/\/watch/i', $path, $temp) && isset($urlPart['query']))
			{
				$query = $this->decodeString($urlPart['query']);
				$videoId = $query['v'];
			}
		}

		return $videoId;
	}
protected function getVideoIdFromUrl($videoUrl)
	{
		$videoId = $videoUrl;
		$urlPart = parse_url($videoUrl);
		$path = $urlPart['path'];
		if (isset($urlPart['host']) && strtolower($urlPart['host']) == 'youtu.be') {
			if (preg_match('/\/([^\/\?]*)/i', $path, $temp))
				$videoId = $temp[1];
		} else {
			if (preg_match('/\/embed\/([^\/\?]*)/i', $path, $temp))
				$videoId = $temp[1];
			elseif (preg_match('/\/v\/([^\/\?]*)/i', $path, $temp))
				$videoId = $temp[1];
			elseif (preg_match('/\/watch/i', $path, $temp) && isset($urlPart['query']))
			{
				$query = $this->decodeString($urlPart['query']);
				$videoId = $query['v'];
			}
		}

		return $videoId;
	}
protected function getVideoIdFromUrl ( $ videoUrl ) { $ videoId = $ videoUrl ; $ urlPart = parse_url ( $ videoUrl ) ; $ path = $ urlPart [ 'path' ] ; if ( isset ( $ urlPart [ 'host' ] ) && strtolower ( $ urlPart [ 'host' ] ) == 'youtu.be' ) { if ( preg_match ( '/\/([^\/\?]*)/i' , $ path , $ temp ) ) $ videoId = $ temp [ 1 ] ; } else { if ( preg_match ( '/\/embed\/([^\/\?]*)/i' , $ path , $ temp ) ) $ videoId = $ temp [ 1 ] ; elseif ( preg_match ( '/\/v\/([^\/\?]*)/i' , $ path , $ temp ) ) $ videoId = $ temp [ 1 ] ; elseif ( preg_match ( '/\/watch/i' , $ path , $ temp ) && isset ( $ urlPart [ 'query' ] ) ) { $ query = $ this -> decodeString ( $ urlPart [ 'query' ] ) ; $ videoId = $ query [ 'v' ] ; } } return $ videoId ; }
Cuts video id from absolute Youtube or youtu.be video url

@param  string $videoUrl Full Youtube or youtu.be video url
@return string           Video ID
Cuts video id from absolute Youtube or youtu . be video url