Google 视频情报服务出现 php 错误

问题描述 投票:0回答:1

我正在尝试使用 PHP 中的谷歌视频智能从 YouTube 视频中获取标签

这是我的代码

require __DIR__ . '/vendor/autoload.php';

use Google\Cloud\VideoIntelligence\V1\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\Feature;
use Google\Client;



$youTubeUrl = "***";





$videoIntelligenceServiceClient = new VideoIntelligenceServiceClient([
  'credentials' => json_decode(file_get_contents('creds.json'), true)
]);



$features = [
    Feature::LABEL_DETECTION,
];
$operationResponse = $videoIntelligenceServiceClient->annotateVideo([
    'inputUri' => $youTubeUrl,
    'features' => $features
]);
$operationResponse->pollUntilComplete();




if ($operationResponse->operationSucceeded()) {
    $results = $operationResponse->getResult();
    foreach ($results->getAnnotationResults() as $result) {
      var_dump($result);
    }
  }

返回错误

致命错误:未捕获 Google\ApiCore\ApiException: { "message": "请求包含无效参数。", "code": 3, "status": "INVALID_ARGUMENT", "details": [] }

有人知道为什么吗?

php google-api google-api-php-client video-intelligence-api
1个回答
0
投票

试试这个:

use Google\Cloud\VideoIntelligence\V1\Client\VideoIntelligenceServiceClient;

© www.soinside.com 2019 - 2024. All rights reserved.