com.amazonaws.services.kinesisvideo.AmazonKinesisVideoClientBuilder Java Examples

The following examples show how to use com.amazonaws.services.kinesisvideo.AmazonKinesisVideoClientBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DemoAppCachedInfo.java    From amazon-kinesis-video-streams-producer-sdk-java with Apache License 2.0 6 votes vote down vote up
private static void addCachedStreamInfoWithCredentialsProvider(CachedInfoMultiAuthServiceCallbacksImpl serviceCallbacks,
                                                               String streamName,
                                                               AWSCredentialsProvider credentialsProvider,
                                                               String region) {
    // Set up credentials provider for the stream name
    serviceCallbacks.addCredentialsProviderToCache(streamName, credentialsProvider);

    // Set up stream info for the stream name
    AmazonKinesisVideo kvsClient = AmazonKinesisVideoClientBuilder.standard()
            .withRegion(region)
            .withCredentials(credentialsProvider)
            .build();
    DescribeStreamResult streamInfo = kvsClient.describeStream(new DescribeStreamRequest().withStreamName(streamName));
    serviceCallbacks.addStreamInfoToCache(streamName, streamInfo);

    // Set up endpoint for the stream name
    GetDataEndpointResult dataEndpoint =
            kvsClient.getDataEndpoint(new GetDataEndpointRequest().withAPIName(APIName.PUT_MEDIA).withStreamName(streamName));
    serviceCallbacks.addStreamingEndpointToCache(streamName, dataEndpoint.getDataEndpoint());
}
 
Example #2
Source File: KinesisVideoGStreamerPiperExample.java    From amazon-kinesis-video-streams-parser-library with Apache License 2.0 6 votes vote down vote up
@Builder
private KinesisVideoGStreamerPiperExample(Regions region,
        String streamName,
        AWSCredentialsProvider credentialsProvider,
        InputStream inputVideoStream,
        String gStreamerPipelineArgument) {
    super(region, credentialsProvider, streamName);
    final AmazonKinesisVideoClientBuilder builder = AmazonKinesisVideoClientBuilder.standard();
    configureClient(builder);
    this.amazonKinesisVideo = builder.build();
    this.inputStream = inputVideoStream;
    this.streamOps = new StreamOps(region,  streamName, credentialsProvider);
    this.executorService = Executors.newFixedThreadPool(2);
    this.gStreamerPipelineArguments = new ArrayList<>();
    addGStreamerPipelineArguments(gStreamerPipelineArgument);
}
 
Example #3
Source File: App.java    From djl-demo with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)
        throws IOException, ModelNotFoundException, MalformedModelException {
    AmazonKinesisVideoClientBuilder amazonKinesisVideoBuilder =
            AmazonKinesisVideoClientBuilder.standard();
    amazonKinesisVideoBuilder.setRegion(REGION.getName());
    amazonKinesisVideoBuilder.setCredentials(new SystemPropertiesCredentialsProvider());
    AmazonKinesisVideo amazonKinesisVideo = amazonKinesisVideoBuilder.build();

    File outDir = Paths.get("build/out").toFile();
    if (!outDir.exists()) {
        outDir.mkdir();
    }

    for (File outFile : outDir.listFiles()) {
        outFile.delete();
    }

    FrameVisitor frameVisitor = FrameVisitor.create(new DjlImageVisitor());

    ExecutorService executorService = Executors.newFixedThreadPool(1);

    GetMediaWorker getMediaWorker =
            GetMediaWorker.create(
                    REGION,
                    new SystemPropertiesCredentialsProvider(),
                    STREAM_NAME,
                    new StartSelector().withStartSelectorType(StartSelectorType.NOW),
                    amazonKinesisVideo,
                    frameVisitor);
    executorService.submit(getMediaWorker);
}
 
Example #4
Source File: StreamOps.java    From amazon-kinesis-video-streams-parser-library with Apache License 2.0 5 votes vote down vote up
@Builder
public StreamOps(Regions region,
                 String streamName, AWSCredentialsProvider credentialsProvider) {
    super(region, credentialsProvider, streamName);
    this.streamName = streamName;
    final AmazonKinesisVideoClientBuilder builder = AmazonKinesisVideoClientBuilder.standard();
    configureClient(builder);
    this.amazonKinesisVideo = builder.build();
}
 
Example #5
Source File: KinesisVideoExample.java    From amazon-kinesis-video-streams-parser-library with Apache License 2.0 5 votes vote down vote up
@Builder
private KinesisVideoExample(Regions region,
                            String streamName,
                            AWSCredentialsProvider credentialsProvider,
                            InputStream inputVideoStream,
                            boolean noSampleInputRequired) {
    super(region, credentialsProvider, streamName);
    final AmazonKinesisVideoClientBuilder builder = AmazonKinesisVideoClientBuilder.standard();
    configureClient(builder);
    this.amazonKinesisVideo = builder.build();
    this.inputStream = inputVideoStream;
    this.streamOps = new StreamOps(region,  streamName, credentialsProvider);
    this.executorService = Executors.newFixedThreadPool(2);
    this.noSampleInputRequired = noSampleInputRequired;
}
 
Example #6
Source File: KinesisInventoryUtil.java    From pacbot with Apache License 2.0 4 votes vote down vote up
public static Map<String,List<VideoStreamVH>> fetchVideoStreamInfo(BasicSessionCredentials temporaryCredentials, String skipRegions,String accountId,String accountName) {
    
    Map<String,List<VideoStreamVH>> videoStream = new LinkedHashMap<>();
    AmazonKinesisVideo amazonKinesisVideo;
    String expPrefix = InventoryConstants.ERROR_PREFIX_CODE+accountId + "\",\"Message\": \"Exception in fetching info for resource\" ,\"type\": \"videoStream\" " ;
    for(Region region : RegionUtils.getRegions()) { 
        try{
            if(!skipRegions.contains(region.getName()) && region.isServiceSupported(AmazonKinesisVideo.ENDPOINT_PREFIX)){
                amazonKinesisVideo = AmazonKinesisVideoClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(temporaryCredentials)).withRegion(region.getName()).build();
                List<StreamInfo> videoStreamListTemp = new ArrayList<>();
                com.amazonaws.services.kinesisvideo.model.ListStreamsResult listStreamsResult;
                String nextToken = null;
                do{
                    listStreamsResult = amazonKinesisVideo.listStreams(new ListStreamsRequest().withNextToken(nextToken));
                    videoStreamListTemp.addAll(listStreamsResult.getStreamInfoList());
                    nextToken = listStreamsResult.getNextToken();
                }while(nextToken!=null);
                
                List<VideoStreamVH> videoStreamList = new ArrayList<>();
                for(StreamInfo streamInfo : videoStreamListTemp) {
                    List<Attribute> tags = new ArrayList<>();
                    for(Entry<String, String> entry: amazonKinesisVideo.listTagsForStream(new com.amazonaws.services.kinesisvideo.model.ListTagsForStreamRequest()
                            .withStreamARN(streamInfo.getStreamARN())).getTags().entrySet()) {
                        tags.add(new Attribute(entry.getKey(), entry.getValue()));
                    }
                    videoStreamList.add(new VideoStreamVH(streamInfo,tags));
                }
                
                if( !videoStreamList.isEmpty() ) {
                    log.debug(InventoryConstants.ACCOUNT + accountId +" Type : VideoStream "+region.getName() + " >> "+videoStreamList.size());
                    videoStream.put(accountId+delimiter+accountName+delimiter+region.getName(),videoStreamList);
                }
            }
        } catch(Exception e){
            log.warn(expPrefix+ region.getName()+InventoryConstants.ERROR_CAUSE +e.getMessage()+"\"}");
            ErrorManageUtil.uploadError(accountId, region.getName(),"videoStream",e.getMessage());
           
        }
    }
    return videoStream;
}