File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 28
28
import com .google .cloud .videointelligence .v1p3beta1 .StreamingVideoIntelligenceServiceClient ;
29
29
import com .google .cloud .videointelligence .v1p3beta1 .VideoSegment ;
30
30
import com .google .protobuf .ByteString ;
31
+ import io .grpc .StatusRuntimeException ;
31
32
import java .io .IOException ;
32
33
import java .nio .file .Files ;
33
34
import java .nio .file .Path ;
34
35
import java .nio .file .Paths ;
35
36
import java .util .Arrays ;
37
+ import java .util .concurrent .TimeoutException ;
36
38
37
39
class StreamingShotChangeDetection {
38
40
39
41
// Perform streaming video detection for shot changes
40
- static void streamingShotChangeDetection (String filePath ) {
42
+ static void streamingShotChangeDetection (String filePath )
43
+ throws IOException , TimeoutException , StatusRuntimeException {
41
44
// String filePath = "path_to_your_video_file";
42
45
43
46
try (StreamingVideoIntelligenceServiceClient client =
@@ -92,8 +95,6 @@ static void streamingShotChangeDetection(String filePath) {
92
95
System .out .format ("Shot: %fs to %fs\n " , startTimeOffset , endTimeOffset );
93
96
}
94
97
}
95
- } catch (IOException e ) {
96
- e .printStackTrace ();
97
98
}
98
99
}
99
100
}
Original file line number Diff line number Diff line change 18
18
19
19
import static com .google .common .truth .Truth .assertThat ;
20
20
21
+ import io .grpc .StatusRuntimeException ;
21
22
import java .io .ByteArrayOutputStream ;
23
+ import java .io .IOException ;
22
24
import java .io .PrintStream ;
25
+ import java .util .concurrent .TimeoutException ;
23
26
import org .junit .After ;
24
27
import org .junit .Before ;
25
28
import org .junit .Test ;
26
29
import org .junit .runner .RunWith ;
27
30
import org .junit .runners .JUnit4 ;
28
31
29
- /** Integration (system) tests for {@link StreamingShotChangeDetection}. */
32
+ /**
33
+ * Integration (system) tests for {@link StreamingShotChangeDetection}.
34
+ */
30
35
@ RunWith (JUnit4 .class )
31
36
@ SuppressWarnings ("checkstyle:abbreviationaswordinname" )
32
37
public class StreamingShotChangeDetectionIT {
38
+
33
39
private ByteArrayOutputStream bout ;
34
40
private PrintStream out ;
35
41
private PrintStream originalPrintStream ;
@@ -50,7 +56,8 @@ public void tearDown() {
50
56
}
51
57
52
58
@ Test
53
- public void testStreamingShotChangeDetection () {
59
+ public void testStreamingShotChangeDetection ()
60
+ throws IOException , TimeoutException , StatusRuntimeException {
54
61
StreamingShotChangeDetection .streamingShotChangeDetection ("resources/cat.mp4" );
55
62
String got = bout .toString ();
56
63
You can’t perform that action at this time.
0 commit comments