aws / amazon-kinesis-video-streams-parser-library

Amazon Kinesis Video Streams parser library is for developers to include in their applications that makes it easy to work with the output of video streams such as retrieving frame-level objects, metadata for fragments, and more.
Apache License 2.0
103 stars 52 forks source link

Amazon Connect voice live stream #171

Open zhangyuezhong opened 1 year ago

zhangyuezhong commented 1 year ago

I'm building a solution to download the Amazon Connect voice live stream, each call will have different streamARN and startFragment number.

AmazonKinesisVideo amazonKinesisVideo = (AmazonKinesisVideo) AmazonKinesisVideoClientBuilder.standard(). build();
String endpoint = amazonKinesisVideo.getDataEndpoint(new GetDataEndpointRequest().withAPIName(APIName.GET_MEDIA).withStreamName(streamName)).getDataEndpoint();

AmazonKinesisVideoMediaClientBuilder amazonKinesisVideoMediaClientBuilder = AmazonKinesisVideoMediaClientBuilder
        .standard()
        .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endPoint, region.getName()))
        .withCredentials(awsCredentialsProvider);
AmazonKinesisVideoMedia amazonKinesisVideoMedia = amazonKinesisVideoMediaClientBuilder.build();

there will be 3400 calls over the day, I need to loop over and download them.

The question is how can i reuse amazonKinesisVideoMedia object (it is AmazonWebServiceClient), the endpoint could be different for each stream. (should i use Map to track the endpoint and client?)

it seems AmazonKinesisVideo and AmazonKinesisVideoMedia have separate HTTP Client and connection pool, they are not sharing the connection pool.

i can have single instance of AmazonKinesisVideo for my application and shutdown it before exit.

However, i have to create 3400 instance of AmazonKinesisVideoMedia ,

also are AmazonKinesisVideo and AmazonKinesisVideoMedia threadsafe ?