【问题标题】:How to upload video to Brightcove though API如何通过 API 将视频上传到 Brightcove
【发布时间】:2020-07-01 13:47:25
【问题描述】:

我正在尝试通过 API 将一个新视频上传到 Brightcove,此时我设法只发布了带有视频信息的 json 数据,并且 Brightcove 中的一切看起来都很好,但我无法添加视频文件在 Brightcove 中上传。我检查了其他答案,但它们对我不起作用,因为它们已经很老了。感谢您的帮助!

    $access_token = $this->getAccessToken();
    
    $data = array(
        'name' => 'test',
        'description' => 'test',
        'tags' => ['test']
    );

    $data_string =  json_encode($data);


    $url = 'https://cms.api.brightcove.com/v1/accounts/1774206337/videos';



    $ch = curl_init();


    curl_setopt_array($ch, array(
        CURLOPT_URL  => $url,
        CURLOPT_POSTFIELDS => $data_string,
        CURLOPT_HTTPHEADER     => array(
            'Content-type: application/json',
            "Authorization: Bearer {$access_token}",
        )
    ));

    
    $result = curl_exec($ch);

    dd($result);

【问题讨论】:

    标签: php laravel api brightcove


    【解决方案1】:

    您已创建一个视频对象,对该调用的响应的 JSON 正文将包含新视频的 id。您需要对该id 发出摄取请求。

    如果源文件已经可以通过 URL 访问,请关注https://apis.support.brightcove.com/dynamic-ingest/getting-started/quick-start-dynamic-ingest-api.html,Brightcove 将下载文件进行转码。

    如需上传文件,请关注https://apis.support.brightcove.com/dynamic-ingest/getting-started/source-file-upload-api-dynamic-ingest.html

    【讨论】:

    • 感谢您的小解释,但这足以让我理解如何做到这一点。最后,它工作得很好!我从来不知道我们需要提出 2 个请求。谢谢,为我节省了很多时间!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-05-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-12
    • 2015-07-12
    • 2015-08-31
    相关资源
    最近更新 更多