Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use vimeo advanced API to display videos

I was using the Vimeo simple API to display the videos from a channel on my website, but as you may know, it has a limit. I was wondering if you could give me an example of how to use the advanced API. I have read the documentation, But I just don't know how to use those methods (obviously i am not php expert).

So it would be awesome if you could show me one example or any tutorial were I could understand it.

This is Part of the code I was using in the simple API:

    var apiEndpoint = 'http://vimeo.com/api/v2/';
var oEmbedEndpoint = 'http://vimeo.com/api/oembed.json'
var oEmbedCallback = 'switchVideo';
var videosCallback = 'setupGallery&iframe=false';

    $(document).ready(function() {
    $.getScript(apiEndpoint + vimeoUsername + '/videos.json?callback=' + videosCallback);
});

    function setupGallery(videos) {         

    for (var i = 0; i < videos.length; i++) {
        var html = '<li><a href="' + videos[i].url +'"alt="'+videos[i].title+'"><img src="' + videos[i].thumbnail_large + '" class="thumb" />';
        html += '<div><p>' + videos[i].title + '</p></div></a></li>';
        $('#thumbs ul').append(html);

    }

I just want to do the same but with the advance API (using php).

thanks a lot, I'd appreciate any advise.

like image 217
lilymz Avatar asked Jun 14 '13 10:06

lilymz


People also ask

What are Vimeo showcases?

A showcase (previously album) is a collection of videos for public or private sharing.

Does Vimeo have an API?

Working with Video Uploads. The Vimeo API includes a full set of features for uploading and managing video files. With this functionality, you can access all the amazing upload capabilities of vimeo.com through your own front end in your own application.

How do I embed a Vimeo video without iFrame?

Simply put, if you want to embed Vimeo without iFrame, you will first need to click on the share button of the video. From there, a window will pop up, and you can click on the Show options button to use the old embed code choice to proceed with the project.


1 Answers

[edit] NOTE: This is the old, advanced API. It is no longer supported by Vimeo, or accessible by new app developers. Please refer to the new upload documentation at https://developer.vimeo.com/api/upload/videos

  1. Create an Api APP at developer.vimeo.com/apps
  2. Use the official PHP library

Once you have that, you need to create your vimeo object

// You must replace CONSUMER_KEY and CONSUMER_SECRET with the values from your app
$vimeo = new phpVimeo('CONSUMER_KEY', 'CONSUMER_SECRET');

Once you have the vimeo object, you can make api calls using the call method. This method takes an api method.

$videos = $vimeo->call('VIMEO_METHOD');

For your specific use case, finding the videos uploaded by a user, you use the method vimeo.videos.getUploaded. You can find more documentation (and try it out!) at the vimeo api playground

Once you understand all of that, I believe the following code would work for you.

$vimeo = new phpVimeo('CONSUMER_KEY', 'CONSUMER_SECRET');
$videos = $vimeo->call('vimeo.videos.getUploaded', array('user_id' => $vimeo_username));
like image 167
Dashron Avatar answered Oct 19 '22 16:10

Dashron