4

I have just not been able to make even a simple Vimeo API call using XHR, because I have not been able to generate the API Signature at all using just JavaScript. I have no clue how to go about this. Is there anyone who could provide me a simple example of how to call, let's say, video.search from just JavaScript. I have my API key and the secret, but making a simple call is seeming like a monumental task right now.

Regards, rohan

2
  • 1
    If it's got a secret key then you shouldn't be using javascript. You would have to put the secret key in javascript, where anyone could get it. Do the request on your server. Commented Jul 30, 2011 at 23:37
  • I know of that issue, and I know why I MUST make this call from my server, but the problem is that this is a hack I'm doing for Open Hack India and I have exactly 10 hours 24 minutes to finish up this alongwith a lot of work. Shifting this to a server deployment would make things extremely difficult for now. Commented Jul 30, 2011 at 23:51

1 Answer 1

5

I don't believe you can use Vimeo's advanced API with only JavaScript. To do that, you need to authenticate with OAuth using a server-side language:

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

Vimeo's JavaScript API allows you to do things like load a single video, or get information about a videos in JSON/XML. This doesn't include video.search unfortunately.

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

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

Then just use document.getElementById() to start using the API. Method calls on their universal embed (iframe) gets a little tricky, because they only allow messages sent as a serialized JSON objects. I recommend using their Froogaloop javascript framework which handles most of this for you.

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

Vimeo also has a working example online.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.