最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Making a vimeo API call from JavaScript - Stack Overflow

programmeradmin5浏览0评论

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

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

Share Improve this question asked Jul 30, 2011 at 23:23 Rohan PrabhuRohan Prabhu 7,3125 gold badges41 silver badges75 bronze badges 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. – evan 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. – Rohan Prabhu Commented Jul 30, 2011 at 23:51
Add a ment  | 

1 Answer 1

Reset to default 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./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./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./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 remend using their Froogaloop javascript framework which handles most of this for you.

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

Vimeo also has a working example online.

发布评论

评论列表(0)

  1. 暂无评论