@@ -105,11 +105,15 @@ public static void analyzeFaces(String gcsUri) throws ExecutionException,
105
105
VideoIntelligenceServiceSettings .defaultBuilder ().build ();
106
106
VideoIntelligenceServiceClient client = VideoIntelligenceServiceClient .create (settings );
107
107
108
+
108
109
// 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
+
111
115
OperationFuture <AnnotateVideoResponse > operation =
112
- client .annotateVideoAsync (gcsUri , detectFeatures );
116
+ client .annotateVideoAsync (request );
113
117
114
118
System .out .println ("Waiting for operation to complete..." );
115
119
for (VideoAnnotationResults result : operation .get ().getAnnotationResultsList ()) {
@@ -143,10 +147,13 @@ public static void analyzeLabels(String gcsUri) throws
143
147
VideoIntelligenceServiceClient client = VideoIntelligenceServiceClient .create (settings );
144
148
145
149
// 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
+
148
155
OperationFuture <AnnotateVideoResponse > operation =
149
- client .annotateVideoAsync (gcsUri , detectFeatures );
156
+ client .annotateVideoAsync (request );
150
157
151
158
System .out .println ("Waiting for operation to complete..." );
152
159
for (VideoAnnotationResults result : operation .get ().getAnnotationResultsList ()) {
@@ -233,10 +240,13 @@ public static void analyzeShots(String gcsUri)
233
240
VideoIntelligenceServiceClient client = VideoIntelligenceServiceClient .create (settings );
234
241
235
242
// 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
+
238
248
OperationFuture <AnnotateVideoResponse > operation =
239
- client .annotateVideoAsync (gcsUri , detectFeatures );
249
+ client .annotateVideoAsync (request );
240
250
241
251
System .out .println ("Waiting for operation to complete..." );
242
252
@@ -270,10 +280,13 @@ public static void analyzeSafeSearch(String gcsUri)
270
280
VideoIntelligenceServiceClient client = VideoIntelligenceServiceClient .create (settings );
271
281
272
282
// 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
+
275
288
OperationFuture <AnnotateVideoResponse > operation =
276
- client .annotateVideoAsync (gcsUri , detectFeatures );
289
+ client .annotateVideoAsync (request );
277
290
278
291
System .out .println ("Waiting for operation to complete..." );
279
292
0 commit comments