PHP Video Plugin

Last Update
28 January 2011
Regular License
$4
Extended License
$20
Sales
184

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:

echo $video->embed('http://www.youtube.com/watch?v=AZW9NYX6JZA', '630', '350');

Result Video Info To pull the info for a video all you need to do is pass the url of the video you’re interested in. The function will automatically determine the type and return an array of relevant data.

$info = $video->info('http://www.youtube.com/watch?v=AZW9NYX6JZA');

// Information returned from a YouTube link $info['video_id'] $info['published'] $info['updated'] $info['title'] $info['info'] $info['user'] $info['comments'] $info['category'] $info['duration'] $info['category'] $info['tags'] $info['thumb_1'] $info['thumb_2'] $info['thumb_3'] $info['thumb_large'] $info['favorites'] $info['views']

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:

$info = $video->info('http://vimeo.com/14173983');

// Information return from a Vimeo link $info['video_id'] $info['status'] $info['title'] $info['info'] $info['mobile_url'] $info['thumb_small'] $info['thumb_med'] $info['thumb_large'] $info['user'] $info['user_url'] $info['user_thumb_small'] $info['user_thumb_medium'] $info['user_thumb_large'] $info['user_thumb_huge'] $info['likes'] $info['plays'] $info['comments'] $info['duration'] $info['width'] $info['height'] $info['tags'] $info['embed']

Vimeo Thumbnails

Vimeo Data

Video id: 14173983Title: Joshua Tree Under the Milky Way

Info: Timelapse video of the Perseid Meteor Shower and the galactic core of the Milky Way as seen from Joshua Tree National Park. These were taken between August 12 and August 15, 2010.

For more photos and words: http://photography.evosia.com/2010/08/13/under-the-milky-way-in-joshua-tree-national-park/

Website: http://www.evosia.com Facebook:http://www.facebook.com/evosiastudios Twitter: http://twitter.com/evosia

Gear: 5D Mk II, EF 16 -35mm L. Settings: f/2.8, 6400 ISO , 20 second exposures.

Music is Samskeyti by Sigur RosMobile url: http://vimeo.com/m/#/14173983Likes: 2501Plays: 572653Comments: 261Duration: 65Width: 640Height: 360Tags: Perseid Meteor Shower, Milky Way, timelapse, joshua tree national park, canon 5d Mk II

Vimeo User Info User: Henry Jun Wah LeeUser url: http://vimeo.com/evosia

More Files From the PHP Plugin Suite