Skip to content

Commit 5d51c60

Browse files
committed
Update to published version of client library.
1 parent 15d9f42 commit 5d51c60

File tree

2 files changed

+29
-38
lines changed

2 files changed

+29
-38
lines changed

video/cloud-client/pom.xml

+4-26
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
</dependency>
4343
<dependency>
4444
<groupId>com.google.cloud</groupId>
45-
<artifactId>google-cloud-videointelligence-grpc</artifactId>
46-
<version>0.1.1-0</version>
45+
<artifactId>google-cloud</artifactId>
46+
<version>0.18.0-alpha</version>
4747
<exclusions>
4848
<exclusion> <!-- exclude an old version of Guava -->
4949
<groupId>com.google.guava</groupId>
@@ -53,30 +53,8 @@
5353
</dependency>
5454
<dependency>
5555
<groupId>com.google.cloud</groupId>
56-
<artifactId>google-cloud-videointelligence-proto</artifactId>
57-
<version>0.1.1-0</version>
58-
<exclusions>
59-
<exclusion> <!-- exclude an old version of Guava -->
60-
<groupId>com.google.guava</groupId>
61-
<artifactId>guava-jdk5</artifactId>
62-
</exclusion>
63-
</exclusions>
64-
</dependency>
65-
<dependency>
66-
<groupId>com.google.cloud</groupId>
67-
<artifactId>google-cloud-videointelligence</artifactId>
68-
<version>0.1.1-0</version>
69-
<exclusions>
70-
<exclusion> <!-- exclude an old version of Guava -->
71-
<groupId>com.google.guava</groupId>
72-
<artifactId>guava-jdk5</artifactId>
73-
</exclusion>
74-
</exclusions>
75-
</dependency>
76-
<dependency>
77-
<groupId>com.google.api</groupId>
78-
<artifactId>gax</artifactId>
79-
<version>0.0.29</version>
56+
<artifactId>google-cloud-video-intelligence</artifactId>
57+
<version>0.18.0-alpha</version>
8058
<exclusions>
8159
<exclusion> <!-- exclude an old version of Guava -->
8260
<groupId>com.google.guava</groupId>

video/cloud-client/src/main/java/com/example/video/Detect.java

+25-12
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,15 @@ public static void analyzeFaces(String gcsUri) throws ExecutionException,
105105
VideoIntelligenceServiceSettings.defaultBuilder().build();
106106
VideoIntelligenceServiceClient client = VideoIntelligenceServiceClient.create(settings);
107107

108+
108109
// Create an operation that will contain the response when the operation completes.
109-
ArrayList<Feature> detectFeatures = new ArrayList<Feature>();
110-
detectFeatures.add(Feature.FACE_DETECTION);
110+
AnnotateVideoRequest request = AnnotateVideoRequest.newBuilder()
111+
.setInputUri(gcsUri)
112+
.addFeatures(Feature.FACE_DETECTION)
113+
.build();
114+
111115
OperationFuture<AnnotateVideoResponse> operation =
112-
client.annotateVideoAsync(gcsUri, detectFeatures);
116+
client.annotateVideoAsync(request);
113117

114118
System.out.println("Waiting for operation to complete...");
115119
for (VideoAnnotationResults result : operation.get().getAnnotationResultsList()) {
@@ -143,10 +147,13 @@ public static void analyzeLabels(String gcsUri) throws
143147
VideoIntelligenceServiceClient client = VideoIntelligenceServiceClient.create(settings);
144148

145149
// Create an operation that will contain the response when the operation completes.
146-
ArrayList<Feature> detectFeatures = new ArrayList<Feature>();
147-
detectFeatures.add(Feature.LABEL_DETECTION);
150+
AnnotateVideoRequest request = AnnotateVideoRequest.newBuilder()
151+
.setInputUri(gcsUri)
152+
.addFeatures(Feature.LABEL_DETECTION)
153+
.build();
154+
148155
OperationFuture<AnnotateVideoResponse> operation =
149-
client.annotateVideoAsync(gcsUri, detectFeatures);
156+
client.annotateVideoAsync(request);
150157

151158
System.out.println("Waiting for operation to complete...");
152159
for (VideoAnnotationResults result : operation.get().getAnnotationResultsList()) {
@@ -233,10 +240,13 @@ public static void analyzeShots(String gcsUri)
233240
VideoIntelligenceServiceClient client = VideoIntelligenceServiceClient.create(settings);
234241

235242
// Create an operation that will contain the response when the operation completes.
236-
ArrayList<Feature> detectFeatures = new ArrayList<Feature>();
237-
detectFeatures.add(Feature.SHOT_CHANGE_DETECTION);
243+
AnnotateVideoRequest request = AnnotateVideoRequest.newBuilder()
244+
.setInputUri(gcsUri)
245+
.addFeatures(Feature.SHOT_CHANGE_DETECTION)
246+
.build();
247+
238248
OperationFuture<AnnotateVideoResponse> operation =
239-
client.annotateVideoAsync(gcsUri, detectFeatures);
249+
client.annotateVideoAsync(request);
240250

241251
System.out.println("Waiting for operation to complete...");
242252

@@ -270,10 +280,13 @@ public static void analyzeSafeSearch(String gcsUri)
270280
VideoIntelligenceServiceClient client = VideoIntelligenceServiceClient.create(settings);
271281

272282
// Create an operation that will contain the response when the operation completes.
273-
ArrayList<Feature> detectFeatures = new ArrayList<Feature>();
274-
detectFeatures.add(Feature.SAFE_SEARCH_DETECTION);
283+
AnnotateVideoRequest request = AnnotateVideoRequest.newBuilder()
284+
.setInputUri(gcsUri)
285+
.addFeatures(Feature.SAFE_SEARCH_DETECTION)
286+
.build();
287+
275288
OperationFuture<AnnotateVideoResponse> operation =
276-
client.annotateVideoAsync(gcsUri, detectFeatures);
289+
client.annotateVideoAsync(request);
277290

278291
System.out.println("Waiting for operation to complete...");
279292

0 commit comments

Comments
 (0)