Search code examples
javascriptphpapivimeo

How to get album list from vimeo


Currently working on a project where I have hosted all the video files to vimeo server.

Now I want to display the thumbnail of those videos on my page, using vimeo API. So far there is API available to fetch users data after authenticating them using application while this is not the case here.

How can I display those videos list as thumbnails on my page, any quick fix will be appreciated?


Solution

  • Use this URL to get video details in JSON http://vimeo.com/api/v2/video/VIDEO_ID.json (Also available is XML: http://vimeo.com/api/v2/video/VIDEO_ID.xml)

    Example: http://vimeo.com/api/v2/video/6271487.json

    Then, check the values thumbnail_small, thumbnail_medium and thumbnail_large.

    Update: To get the thumbnail for private video:

    Download Viemo PHP library. Then use this code:

    $video_id = 'VIDEO_ID';
    $key = 'YOUR_CONSUMER_KEY';
    $secret = 'YOUR_CONSUMER_SECRET';
    
    require_once('vimeo.php');
    $vimeo = new phpVimeo($key, $secret);
    $video = $vimeo->call('vimeo.videos.getInfo', array('video_id' => $video_id));
    
    $img_small = $video->video[0]->thumbnails->thumbnail[0]->_content;
    $img_medium = $video->video[0]->thumbnails->thumbnail[1]->_content;
    $img_large = $video->video[0]->thumbnails->thumbnail[2]->_content;