This repository was archived by the owner on Sep 16, 2023. It is now read-only.
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 2828import com .google .cloud .videointelligence .v1p3beta1 .StreamingVideoIntelligenceServiceClient ;
2929import com .google .cloud .videointelligence .v1p3beta1 .VideoSegment ;
3030import com .google .protobuf .ByteString ;
31+ import io .grpc .StatusRuntimeException ;
3132import java .io .IOException ;
3233import java .nio .file .Files ;
3334import java .nio .file .Path ;
3435import java .nio .file .Paths ;
3536import java .util .Arrays ;
37+ import java .util .concurrent .TimeoutException ;
3638
3739class StreamingShotChangeDetection {
3840
3941 // Perform streaming video detection for shot changes
40- static void streamingShotChangeDetection (String filePath ) {
42+ static void streamingShotChangeDetection (String filePath )
43+ throws IOException , TimeoutException , StatusRuntimeException {
4144 // String filePath = "path_to_your_video_file";
4245
4346 try (StreamingVideoIntelligenceServiceClient client =
@@ -92,8 +95,6 @@ static void streamingShotChangeDetection(String filePath) {
9295 System .out .format ("Shot: %fs to %fs\n " , startTimeOffset , endTimeOffset );
9396 }
9497 }
95- } catch (IOException e ) {
96- e .printStackTrace ();
9798 }
9899 }
99100}
Original file line number Diff line number Diff line change 1818
1919import static com .google .common .truth .Truth .assertThat ;
2020
21+ import io .grpc .StatusRuntimeException ;
2122import java .io .ByteArrayOutputStream ;
23+ import java .io .IOException ;
2224import java .io .PrintStream ;
25+ import java .util .concurrent .TimeoutException ;
2326import org .junit .After ;
2427import org .junit .Before ;
2528import org .junit .Test ;
2629import org .junit .runner .RunWith ;
2730import org .junit .runners .JUnit4 ;
2831
29- /** Integration (system) tests for {@link StreamingShotChangeDetection}. */
32+ /**
33+ * Integration (system) tests for {@link StreamingShotChangeDetection}.
34+ */
3035@ RunWith (JUnit4 .class )
3136@ SuppressWarnings ("checkstyle:abbreviationaswordinname" )
3237public class StreamingShotChangeDetectionIT {
38+
3339 private ByteArrayOutputStream bout ;
3440 private PrintStream out ;
3541 private PrintStream originalPrintStream ;
@@ -50,7 +56,8 @@ public void tearDown() {
5056 }
5157
5258 @ Test
53- public void testStreamingShotChangeDetection () {
59+ public void testStreamingShotChangeDetection ()
60+ throws IOException , TimeoutException , StatusRuntimeException {
5461 StreamingShotChangeDetection .streamingShotChangeDetection ("resources/cat.mp4" );
5562 String got = bout .toString ();
5663
You can’t perform that action at this time.
0 commit comments