问题描述
我是使用Vimeo的简单的API来显示在我的网站从一个频道中的视频,但正如你可能知道,它有一个限制。我在想,如果你能给我如何使用先进的API的例子。我已阅读文档,但我只是不知道如何使用这些方法(当然我不是PHP的专家)。
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.
这是我使用的是简单的API在code的部分:
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);
}
我只想做相同,但与提前API(使用PHP)。
I just want to do the same but with the advance API (using php).
非常感谢,我想AP preciate任何意见。
thanks a lot, I'd appreciate any advise.
推荐答案
注意:这是旧的,先进的API。它是由Vimeo的不再支持,或者通过新的应用程序开发人员访问。请参阅新的上传文档的
[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
- 在developer.vimeo.com/apps创建一个API APP
- 使用 PHP库
- Create an Api APP at developer.vimeo.com/apps
- Use the official PHP library
一旦你的,你需要创建VIMEO对象
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');
一旦有VIMEO对象,你可以使用呼叫
方法API调用。此方法需要一个。
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');
有关您的具体使用情况,发现由用户上传的视频,您使用的方法 vimeo.videos.getUploaded
。你可以找到更多的文档(并尝试一下!)在
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
一旦你了解了这一切,我相信下面code会为你工作。
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));
这篇关于如何利用先进的VIMEO API来显示视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!