in code_examples/java_examples/stored_video/java-rek-video.java [181:222]
private static void GetResultsLabels() throws Exception{
int maxResults=10;
String paginationToken=null;
GetLabelDetectionResult labelDetectionResult=null;
do {
if (labelDetectionResult !=null){
paginationToken = labelDetectionResult.getNextToken();
}
GetLabelDetectionRequest labelDetectionRequest= new GetLabelDetectionRequest()
.withJobId(startJobId)
.withSortBy(LabelDetectionSortBy.TIMESTAMP)
.withMaxResults(maxResults)
.withNextToken(paginationToken);
labelDetectionResult = rek.getLabelDetection(labelDetectionRequest);
VideoMetadata videoMetaData=labelDetectionResult.getVideoMetadata();
System.out.println("Format: " + videoMetaData.getFormat());
System.out.println("Codec: " + videoMetaData.getCodec());
System.out.println("Duration: " + videoMetaData.getDurationMillis());
System.out.println("FrameRate: " + videoMetaData.getFrameRate());
//Show labels, confidence and detection times
List<LabelDetection> detectedLabels= labelDetectionResult.getLabels();
for (LabelDetection detectedLabel: detectedLabels) {
long seconds=detectedLabel.getTimestamp();
System.out.print("Millisecond: " + Long.toString(seconds) + " ");
System.out.println("\t" + detectedLabel.getLabel().getName() +
" \t" +
detectedLabel.getLabel().getConfidence().toString());
System.out.println();
}
} while (labelDetectionResult !=null && labelDetectionResult.getNextToken() != null);
}