Allan
Allan

Reputation: 82

Google video intelligence service in php error

Im trying to get labels from a YouTube video with google video intelligence in PHP

This is my code

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

Its returning error

Fatal error: Uncaught Google\ApiCore\ApiException: { "message": "Request contains an invalid argument.", "code": 3, "status": "INVALID_ARGUMENT", "details": [] }

Anyone has any idea why?

Upvotes: 1

Views: 92

Answers (1)

Burak Tamince
Burak Tamince

Reputation: 41

try this : use Google\Cloud\VideoIntelligence\V1\Client\VideoIntelligenceServiceClient;

Upvotes: 0

Related Questions