Vimeo API 使用 PHP 上传视频不起作用

问题描述

抱歉,如果在其他地方已经回答了这个问题,请将我重定向到答案,我会删除这个问题(顺便说一句,我在这里搜索过但没有找到)。

我正在设置 Vimeo API,以便我可以通过网络界面上传到我的 vimeo 帐户。我已按照有关如何在 Vimeo 开发站点上使用视频上传的教程进行操作,但它们不起作用。

这是我的代码(取自 vimeo 教程):

require 'sdk/autoload.PHP';
use Vimeo\Vimeo;
$client = new Vimeo("{client_id}","{client_secret}","{access_token}");

$file_name = "test-video.MOV";
$uri = $client->upload($file_name,array(
  "name" => "Untitled","description" => "The description goes here."
));

$response = $client->request($uri . '?fields=transcode.status');
if ($response['body']['transcode']['status'] === 'complete') {
  print 'Your video finished transcoding.';
} elseif ($response['body']['transcode']['status'] === 'in_progress') {
  print 'Your video is still transcoding.';
} else {
  print 'Your video encountered an error during transcoding.';
}

$response = $client->request($uri . '?fields=link');
echo "Your video link is: " . $response['body']['link'];

我从中得到的响应是 HTTP ERROR 500。但是,视频似乎确实以正确的标题和描述加载到 Vimeo 中,但它没有任何内容,即视频文件本身似乎不是已上传

作为参考,我有正确的访问密钥和正确的权限设置,并且在 vimeo 开发帐户中启用了上传

更新:我打开了错误显示,这是显示错误

Fatal error: Uncaught Error: Class 'TusPHP\Tus\Client' not found in /home/hp3-linc1-nfs2-z/400/506400/user/htdocs/vimeo-upload/sdk/src/Vimeo/Upload/TusClient.PHP:8 Stack trace: #0 /home/hp3-linc1-nfs2-z/400/506400/user/htdocs/vimeo-upload/sdk/autoload.PHP(27): require() #1 [internal function]: {closure}('Vimeo\\Upload\\Tu...') #2 /home/hp3-linc1-nfs2-z/400/506400/user/htdocs/vimeo-upload/sdk/src/Vimeo/Vimeo.PHP(592): spl_autoload_call('Vimeo\\Upload\\Tu...') #3 /home/hp3-linc1-nfs2-z/400/506400/user/htdocs/vimeo-upload/sdk/src/Vimeo/Vimeo.PHP(338): Vimeo\Vimeo->perform_upload_tus('test-video.MOV',15473903,Array) #4 /home/hp3-linc1-nfs2-z/400/506400/user/htdocs/vimeo-upload/index.PHP(20): Vimeo\Vimeo->upload('test-video.MOV',Array) #5 {main} thrown in /home/hp3-linc1-nfs2-z/400/506400/user/htdocs/vimeo-upload/sdk/src/Vimeo/Upload/TusClient.PHP on line 8

TusClient.PHP 中的代码如下所示:

namespace Vimeo\Upload;

class TusClient extends \TusPHP\Tus\Client
{
    /**
     * Sets the url for retrieving the TUS upload.
     * @param string $url
     * @return $this
     */
    public function setUrl(string $url)
    {
        $this->url = $url;
        return $this;
    }
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)