/vimeo-vortex

WordPress plugin for improved Vimeo embedding via API

Primary LanguagePHPGNU General Public License v2.0GPL-2.0

Vimeo Vortex

A WordPress plugin that adds some functionality to improve Vimeo embeds.

Most importantly, it uses the Vimeo oEmbed API to load information about the video.

Based on that, we can build a preview that is just an image, rather than an iframe. When the user clicks on it, we create the iframe and play the video.

When used on pages that load a large amount of videos, that makes a big difference in terms of performance / speed!

Based on previous work on websites including Kunstraum Kreuzlingen, Information-Fiction. It is in use on kunstraum-kreuzlingen.ch, eracom.ch and kinogeneva.ch.

Usage

Currently, there are two helper functions. Both take as input the $url of a Vimeo movie.

  • vimeovortex($url) = will produce a player.
  • vimeovortex_array($url) = will return the vimeo object as array.

With the second function, if you want to display the video thumbnail, you can do the following:

if ( !empty( $video_url ) ) {

	if (function_exists('vimeovortex')) {
		
		$video = vimeovortex_array($video_url);
		
		$video_img = $video["video"]["thumbnail_url"];
						    			
		echo '<img src="'. $video_img .'" alt="" width="'. $video["video"]["width"] .'" height="'. $video["video"]["height"] .'" />';
		
	}
}

Aknowledgements

This plugin uses some code examples kindly provided by the web:

See also: