如何使用vimeo高级API显示视频 [英] how to use vimeo advanced API to display videos

查看:35
本文介绍了如何使用vimeo高级API显示视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Vimeo simple 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 中使用的代码的一部分:

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).

非常感谢,如果您有任何建议,我将不胜感激.

thanks a lot, I'd appreciate any advise.

推荐答案

[edit] 注意: 这是旧的、高级的 API.Vimeo 不再支持它,或者新的应用程序开发人员可以访问它.请参阅 https://developer.vimeo.com/api/upload/videos 上的新上传文档

[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. 在 developer.vimeo.com/apps 创建一个 Api APP
  2. 使用官方 PHP 库

一旦你有了它,你需要创建你的 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 对象后,您可以使用 call 方法进行 api 调用.此方法采用 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.您可以在 vimeo 找到更多文档(并尝试一下!)api游乐场

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));

这篇关于如何使用vimeo高级API显示视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆