|
35 | 35 | import com.google.cloud.videointelligence.v1p1beta1.VideoIntelligenceServiceClient; |
36 | 36 | import com.google.cloud.videointelligence.v1p1beta1.WordInfo; |
37 | 37 | import java.io.IOException; |
| 38 | +import java.util.concurrent.TimeUnit; |
38 | 39 |
|
39 | 40 | public class Detect { |
40 | 41 | /** |
@@ -117,7 +118,8 @@ public static void analyzeFacesBoundingBoxes(String gcsUri) throws Exception { |
117 | 118 | System.out.println("Waiting for operation to complete..."); |
118 | 119 | boolean faceFound = false; |
119 | 120 | // Display the results |
120 | | - for (VideoAnnotationResults results : response.get().getAnnotationResultsList()) { |
| 121 | + for (VideoAnnotationResults results : response.get(900, TimeUnit.SECONDS) |
| 122 | + .getAnnotationResultsList()) { |
121 | 123 | int faceCount = 0; |
122 | 124 | // Display the results for each face |
123 | 125 | for (FaceDetectionAnnotation faceAnnotation : results.getFaceDetectionAnnotationsList()) { |
@@ -194,7 +196,8 @@ public static void analyzeFaceEmotions(String gcsUri) throws Exception { |
194 | 196 | System.out.println("Waiting for operation to complete..."); |
195 | 197 | boolean faceFound = false; |
196 | 198 | // Display the results |
197 | | - for (VideoAnnotationResults results : response.get().getAnnotationResultsList()) { |
| 199 | + for (VideoAnnotationResults results : response.get(600, TimeUnit.SECONDS) |
| 200 | + .getAnnotationResultsList()) { |
198 | 201 | int faceCount = 0; |
199 | 202 | // Display the results for each face |
200 | 203 | for (FaceDetectionAnnotation faceAnnotation : results.getFaceDetectionAnnotationsList()) { |
@@ -271,7 +274,8 @@ public static void speechTranscription(String gcsUri) throws Exception { |
271 | 274 |
|
272 | 275 | System.out.println("Waiting for operation to complete..."); |
273 | 276 | // Display the results |
274 | | - for (VideoAnnotationResults results : response.get().getAnnotationResultsList()) { |
| 277 | + for (VideoAnnotationResults results : response.get(180, TimeUnit.SECONDS) |
| 278 | + .getAnnotationResultsList()) { |
275 | 279 | for (SpeechTranscription speechTranscription : results.getSpeechTranscriptionsList()) { |
276 | 280 | try { |
277 | 281 | // Print the transcription |
|
0 commit comments