Making a Vimeo API call from JavaScript

I simply could not even make a simple Vimeo API call using XHR, because I was not able to generate an API signature at all using only JavaScript. I have no idea how to do this. Is there anyone who could provide me with a simple example of how to call, say, video.search only from JavaScript. I have an API key and a secret, but a simple call looks like a monumental task right now.

Regards, Rohan

+4
source share
1 answer

I do not believe that you can use Vimeo advanced API only with JavaScript. To do this, you need to authenticate using OAuth using the server language:

http://vimeo.com/api/docs/getting-started

The Vimeo JavaScript API allows you to do things like loading a single video or retrieving video information in JSON / XML. Unfortunately, this does not apply to video.search.

http://vimeo.com/api/docs/player-js

If you still want to use the JavaScript API, you need to include the API in the actual video by adding api = 1 . In the iframe, add it as a query string: http://player.vimeo.com/video/VIDEO_ID?api=1 or, using Flash, add it as a separate parameter tag <param name="flashvars" value="api=1" /> .

Then just use document.getElementById() to start using the API. The method that invokes their generic nesting (iframe) becomes a bit complicated because they allow you to send messages as serialized JSON objects . I recommend using the Froogaloop javascript framework that handles most of this for you.

https://github.com/vimeo/player-api/tree/master/javascript

Vimeo also has a working example on the Internet.

+5
source

All Articles