Skip to content

WordPress plugin for improved Vimeo embedding via API

License

Notifications You must be signed in to change notification settings

ms-studio/vimeo-vortex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

About

WordPress plugin for improved Vimeo embedding via API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published