This video plugin can take a YouTube or Vimeo url and return an array of info such as a thumbnail image, title, length, tags, views, etc. It can even automatically embed the video into the page. It uses the newer iframe embed method which adds html5 support to both YouTube & Vimeo video which means they can be play on mobile devices such as iPhone and Android.

Requires PHP 5.2+ with JSON support.

Embed Video

Embedding a video is super easy. Just input a YouTube or Vimeo url and optional dimensions like so:

YouTube Thumbnails

YouTube Data

Video id: AZW9NYX6JZAPublished date: 2009-04-09T18:59:13.000ZLast updated: 2011-01-26T09:01:46.000ZTitle: St Vincent – “Actor Out Of Work”Info: Check out the first single “Actor Out Of Work” from St. Vincent’s newest album Actor. Buy her magnificent new album here: beggarsgroupusa.comUser: 4ADRecordsComments: 574Category: Check out the first single “Actor Out Of Work” from St. Vincent’s newest album Actor. Buy her magnificent new album here: beggarsgroupusa.comDuration: 150Category: Check out the first single “Actor Out Of Work” from St. Vincent’s newest album Actor. Buy her magnificent new album here: beggarsgroupusa.comTags: St. Vincent, Actor Out Of Work, Actor, 4AD, Sufjan Stevens, Polyphonic SpreeFavorited: 4219Views: 483931

While the function will automatically determine if your video is from YouTube or Vimeo, the respective API ’s each return slightly different data. We’ve already seen what info you can get back from a YouTube video, now here’s an example of the data returned from Vimeo: