Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion video/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "google/video-sample",
"type": "project",
"require": {
"google/cloud-videointelligence": "^1.5"
"google/cloud-videointelligence": "^1.14"
},
"require-dev": {
"google/cloud-core": "^1.23"
Expand Down
8 changes: 6 additions & 2 deletions video/quickstart.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
require __DIR__ . '/vendor/autoload.php';

# [START video_quickstart]
use Google\Cloud\VideoIntelligence\V1\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\Client\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\AnnotateVideoRequest;
use Google\Cloud\VideoIntelligence\V1\Feature;

# Instantiate a client.
Expand All @@ -31,7 +32,10 @@
'inputUri' => 'gs://cloud-samples-data/video/cat.mp4',
'features' => $features
];
$operation = $video->annotateVideo($options);
$request = (new AnnotateVideoRequest())
->setInputUri($options['inputUri'])
->setFeatures($options['features']);
$operation = $video->annotateVideo($request);

# Wait for the request to complete.
$operation->pollUntilComplete();
Expand Down
11 changes: 6 additions & 5 deletions video/src/analyze_explicit_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
namespace Google\Cloud\Samples\VideoIntelligence;

// [START video_analyze_explicit_content]
use Google\Cloud\VideoIntelligence\V1\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\AnnotateVideoRequest;
use Google\Cloud\VideoIntelligence\V1\Client\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\Feature;
use Google\Cloud\VideoIntelligence\V1\Likelihood;

Expand All @@ -39,10 +40,10 @@ function analyze_explicit_content(string $uri, int $pollingIntervalSeconds = 0)

# Execute a request.
$features = [Feature::EXPLICIT_CONTENT_DETECTION];
$operation = $video->annotateVideo([
'inputUri' => $uri,
'features' => $features,
]);
$request = (new AnnotateVideoRequest())
->setInputUri($uri)
->setFeatures($features);
$operation = $video->annotateVideo($request);

# Wait for the request to complete.
$operation->pollUntilComplete([
Expand Down
11 changes: 6 additions & 5 deletions video/src/analyze_labels_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
namespace Google\Cloud\Samples\VideoIntelligence;

// [START video_analyze_labels]
use Google\Cloud\VideoIntelligence\V1\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\AnnotateVideoRequest;
use Google\Cloud\VideoIntelligence\V1\Client\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\Feature;

/**
Expand All @@ -36,10 +37,10 @@ function analyze_labels_file(string $path, int $pollingIntervalSeconds = 0)

# Execute a request.
$features = [Feature::LABEL_DETECTION];
$operation = $video->annotateVideo([
'inputContent' => $inputContent,
'features' => $features,
]);
$request = (new AnnotateVideoRequest())
->setInputContent($inputContent)
->setFeatures($features);
$operation = $video->annotateVideo($request);

# Wait for the request to complete.
$operation->pollUntilComplete([
Expand Down
11 changes: 6 additions & 5 deletions video/src/analyze_labels_gcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
namespace Google\Cloud\Samples\VideoIntelligence;

// [START video_analyze_labels_gcs]
use Google\Cloud\VideoIntelligence\V1\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\AnnotateVideoRequest;
use Google\Cloud\VideoIntelligence\V1\Client\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\Feature;

/**
Expand All @@ -33,10 +34,10 @@ function analyze_labels_gcs(string $uri, int $pollingIntervalSeconds = 0)

# Execute a request.
$features = [Feature::LABEL_DETECTION];
$operation = $video->annotateVideo([
'inputUri' => $uri,
'features' => $features,
]);
$request = (new AnnotateVideoRequest())
->setInputUri($uri)
->setFeatures($features);
$operation = $video->annotateVideo($request);

# Wait for the request to complete.
$operation->pollUntilComplete([
Expand Down
11 changes: 6 additions & 5 deletions video/src/analyze_object_tracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
namespace Google\Cloud\Samples\VideoIntelligence;

// [START video_object_tracking_gcs]
use Google\Cloud\VideoIntelligence\V1\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\AnnotateVideoRequest;
use Google\Cloud\VideoIntelligence\V1\Client\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\Feature;

/**
Expand All @@ -33,10 +34,10 @@ function analyze_object_tracking(string $uri, int $pollingIntervalSeconds = 0)

# Execute a request.
$features = [Feature::OBJECT_TRACKING];
$operation = $video->annotateVideo([
'inputUri' => $uri,
'features' => $features,
]);
$request = (new AnnotateVideoRequest())
->setInputUri($uri)
->setFeatures($features);
$operation = $video->annotateVideo($request);

# Wait for the request to complete.
$operation->pollUntilComplete([
Expand Down
11 changes: 6 additions & 5 deletions video/src/analyze_object_tracking_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
namespace Google\Cloud\Samples\VideoIntelligence;

// [START video_object_tracking]
use Google\Cloud\VideoIntelligence\V1\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\AnnotateVideoRequest;
use Google\Cloud\VideoIntelligence\V1\Client\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\Feature;

/**
Expand All @@ -36,10 +37,10 @@ function analyze_object_tracking_file(string $path, int $pollingIntervalSeconds

# Execute a request.
$features = [Feature::OBJECT_TRACKING];
$operation = $video->annotateVideo([
'inputContent' => $inputContent,
'features' => $features,
]);
$request = (new AnnotateVideoRequest())
->setInputContent($inputContent)
->setFeatures($features);
$operation = $video->annotateVideo($request);

# Wait for the request to complete.
$operation->pollUntilComplete([
Expand Down
11 changes: 6 additions & 5 deletions video/src/analyze_shots.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
namespace Google\Cloud\Samples\VideoIntelligence;

// [START video_analyze_shots]
use Google\Cloud\VideoIntelligence\V1\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\AnnotateVideoRequest;
use Google\Cloud\VideoIntelligence\V1\Client\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\Feature;

/**
Expand All @@ -33,10 +34,10 @@ function analyze_shots(string $uri, int $pollingIntervalSeconds = 0)

# Execute a request.
$features = [Feature::SHOT_CHANGE_DETECTION];
$operation = $video->annotateVideo([
'inputUri' => $uri,
'features' => $features,
]);
$request = (new AnnotateVideoRequest())
->setInputUri($uri)
->setFeatures($features);
$operation = $video->annotateVideo($request);

# Wait for the request to complete.
$operation->pollUntilComplete([
Expand Down
11 changes: 6 additions & 5 deletions video/src/analyze_text_detection.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
namespace Google\Cloud\Samples\VideoIntelligence;

// [START video_detect_text_gcs]
use Google\Cloud\VideoIntelligence\V1\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\AnnotateVideoRequest;
use Google\Cloud\VideoIntelligence\V1\Client\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\Feature;

/**
Expand All @@ -33,10 +34,10 @@ function analyze_text_detection(string $uri, int $pollingIntervalSeconds = 0)

# Execute a request.
$features = [Feature::TEXT_DETECTION];
$operation = $video->annotateVideo([
'inputUri' => $uri,
'features' => $features,
]);
$request = (new AnnotateVideoRequest())
->setInputUri($uri)
->setFeatures($features);
$operation = $video->annotateVideo($request);

# Wait for the request to complete.
$operation->pollUntilComplete([
Expand Down
11 changes: 6 additions & 5 deletions video/src/analyze_text_detection_file.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
namespace Google\Cloud\Samples\VideoIntelligence;

// [START video_detect_text]
use Google\Cloud\VideoIntelligence\V1\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\AnnotateVideoRequest;
use Google\Cloud\VideoIntelligence\V1\Client\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\Feature;

/**
Expand All @@ -36,10 +37,10 @@ function analyze_text_detection_file(string $path, int $pollingIntervalSeconds =

# Execute a request.
$features = [Feature::TEXT_DETECTION];
$operation = $video->annotateVideo([
'inputContent' => $inputContent,
'features' => $features,
]);
$request = (new AnnotateVideoRequest())
->setInputContent($inputContent)
->setFeatures($features);
$operation = $video->annotateVideo($request);

# Wait for the request to complete.
$operation->pollUntilComplete([
Expand Down
15 changes: 8 additions & 7 deletions video/src/analyze_transcription.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
namespace Google\Cloud\Samples\VideoIntelligence;

// [START video_speech_transcription_gcs]
use Google\Cloud\VideoIntelligence\V1\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\AnnotateVideoRequest;
use Google\Cloud\VideoIntelligence\V1\Client\VideoIntelligenceServiceClient;
use Google\Cloud\VideoIntelligence\V1\Feature;
use Google\Cloud\VideoIntelligence\V1\VideoContext;
use Google\Cloud\VideoIntelligence\V1\SpeechTranscriptionConfig;
use Google\Cloud\VideoIntelligence\V1\VideoContext;

/**
* @param string $uri The cloud storage object to analyze (gs://your-bucket-name/your-object-name)
Expand All @@ -42,11 +43,11 @@ function analyze_transcription(string $uri, int $pollingIntervalSeconds = 0)

# execute a request.
$features = [Feature::SPEECH_TRANSCRIPTION];
$operation = $client->annotateVideo([
'inputUri' => $uri,
'videoContext' => $videoContext,
'features' => $features,
]);
$request = (new AnnotateVideoRequest())
->setInputUri($uri)
->setVideoContext($videoContext)
->setFeatures($features);
$operation = $client->annotateVideo($request);

print('Processing video for speech transcription...' . PHP_EOL);
# Wait for the request to complete.
Expand Down