Closed samjoshi26 closed 4 years ago
@samjoshi26 did you use the endpoint from getDataEndpoint
? You need to something like,
final String dataEndpoint = frontendClient.getDataEndpoint(
new GetDataEndpointRequest()
.withStreamName(STREAM_NAME)
.withAPIName("PUT_MEDIA")).getDataEndpoint();
final URI uri = URI.create(dataEndpoint + PUT_MEDIA_API);
final AmazonKinesisVideoPutMedia dataClient = AmazonKinesisVideoPutMediaClient.builder()
.withRegion(DEFAULT_REGION)
.withEndpoint(URI.create(dataEndpoint)) // <-- notice here the endpoint is from getDataEndpoint
.withCredentials(AuthHelper.getSystemPropertiesCredentialsProvider())
.withConnectionTimeoutInMillis(CONNECTION_TIMEOUT_IN_MILLIS)
.build();
@lherman-cs . Thank you for your reply. Yes I have done it exactly as you have pointed out. I want to know what is the purpose of this line final URI uri = URI.create(dataEndpoint + PUT_MEDIA_API); as uri object is not being used anywhere in the demo code as well
String endPoint = client.getDataEndpoint(newGetDataEndpointRequest().withStreamName(streamName).withAPIName(APIName.PUT_MEDIA)) .getDataEndpoint();
Later to this String endPoint , I append "/putMedia" endPoint = endPoint + "/putMedia";
Then I use it as follows AmazonKinesisVideoPutMediaClient.builder().withRegion(region).withEndpoint(URI.create(endPoint)) .withCredentials(new AWSStaticCredentialsProvider(credentials)).build(); I have not included my credentials details. Please let me know if I am doing anything wrong.
Thank you again!
I have removed the line endPoint = endPoint + "/putMedia"; and everything works now! Thank you for your reply
@samjoshi26 hey, sorry, you're right, final URI uri = URI.create(dataEndpoint + PUT_MEDIA_API);
is not needed.
@samjoshi26 In this case, would you mind to close the issue?
I create a stream in us-east-1 region using aws access key and write to it. I keep getting the following error
onFailure: * null (Service: AmazonKinesisVideoMedia; Status Code: 403; Error Code: null; Request ID: f9b10ee1-fa12-dd8c-aecd-b1315f760526)
This happens with my java code. I use the same access keys in PutMedia.java demo class and it is able to write to the stream without any issue. Just to double check, I created another set of keys today and tried but am not able to get rid of the issue. Any help would be appreciated.