Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ jobs:
- name: Run tests
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
mvn clean test -DargLine="-Daws.accessKeyId=${AWS_ACCESS_KEY_ID} -Daws.secretKey=${AWS_SECRET_ACCESS_KEY} -Daws.sessionToken=${AWS_SESSION_TOKEN} -Djava.library.path=src/main/resources/lib/ubuntu/ -Dlog4j.configurationFile=log4j2.xml"
mvn clean test -DargLine="-Daws.accessKeyId=${AWS_ACCESS_KEY_ID} -Daws.secretAccessKey=${AWS_SECRET_ACCESS_KEY} -Daws.sessionToken=${AWS_SESSION_TOKEN} -Djava.library.path=src/main/resources/lib/ubuntu/ -Dlog4j.configurationFile=log4j2.xml"
elif [ "$RUNNER_OS" == "Windows" ]; then
mvn clean test -DargLine="-Daws.accessKeyId=${AWS_ACCESS_KEY_ID} -Daws.secretKey=${AWS_SECRET_ACCESS_KEY} -Daws.sessionToken=${AWS_SESSION_TOKEN} -Djava.library.path=src/main/resources/lib/windows/ -Dlog4j.configurationFile=log4j2.xml"
mvn clean test -DargLine="-Daws.accessKeyId=${AWS_ACCESS_KEY_ID} -Daws.secretAccessKey=${AWS_SECRET_ACCESS_KEY} -Daws.sessionToken=${AWS_SESSION_TOKEN} -Djava.library.path=src/main/resources/lib/windows/ -Dlog4j.configurationFile=log4j2.xml"
elif [ "$RUNNER_OS" == "macOS" ]; then
mvn clean test -DargLine="-Daws.accessKeyId=${AWS_ACCESS_KEY_ID} -Daws.secretKey=${AWS_SECRET_ACCESS_KEY} -Daws.sessionToken=${AWS_SESSION_TOKEN} -Djava.library.path=src/main/resources/lib/mac/ -Dlog4j.configurationFile=log4j2.xml"
mvn clean test -DargLine="-Daws.accessKeyId=${AWS_ACCESS_KEY_ID} -Daws.secretAccessKey=${AWS_SECRET_ACCESS_KEY} -Daws.sessionToken=${AWS_SESSION_TOKEN} -Djava.library.path=src/main/resources/lib/mac/ -Dlog4j.configurationFile=log4j2.xml"
else
echo "$RUNNER_OS not supported"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion log4j2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</Appenders>

<Loggers>
<Root level="WARN">
<Root level="TRACE">
<AppenderRef ref="ConsoleAppender"/>
<AppenderRef ref="RollingFile"/>
</Root>
Expand Down
50 changes: 38 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,41 @@
</licenses>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-bom</artifactId>
<version>1.11.602</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/software.amazon.awssdk/bom -->
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.26.16</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<!-- https://mvnrepository.com/artifact/software.amazon.awssdk/sdk-core -->
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sdk-core</artifactId>
<version>2.26.16</version>
</dependency>
<!-- https://mvnrepository.com/artifact/software.amazon.awssdk/kinesisvideo -->
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>kinesisvideo</artifactId>
<version>2.26.16</version>
</dependency>
<!-- https://mvnrepository.com/artifact/software.amazon.awssdk/http-auth-aws -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<groupId>software.amazon.awssdk</groupId>
<artifactId>http-auth-aws</artifactId>
<version>2.26.16</version>
</dependency>
<!-- https://mvnrepository.com/artifact/software.amazon.awssdk/apache-client -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-kinesisvideo</artifactId>
<groupId>software.amazon.awssdk</groupId>
<artifactId>apache-client</artifactId>
<version>2.26.16</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
Expand Down Expand Up @@ -153,7 +170,16 @@
<artifactId>log4j-api</artifactId>
<version>2.17.1</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.16</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.16</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package com.amazonaws.kinesisvideo.demoapp;

import com.amazonaws.auth.AWSCredentialsProvider;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import com.amazonaws.kinesisvideo.client.KinesisVideoClient;
import software.amazon.awssdk.services.kinesisvideo.model.DescribeStreamRequest;
import software.amazon.awssdk.services.kinesisvideo.model.DescribeStreamResponse;
import software.amazon.awssdk.services.kinesisvideo.model.GetDataEndpointRequest;
import com.amazonaws.kinesisvideo.client.KinesisVideoClientConfiguration;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -15,19 +19,15 @@
import com.amazonaws.kinesisvideo.java.service.CachedInfoMultiAuthServiceCallbacksImpl;
import com.amazonaws.kinesisvideo.java.service.JavaKinesisVideoServiceClient;
import com.amazonaws.kinesisvideo.storage.DefaultStorageCallbacks;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.kinesisvideo.AmazonKinesisVideo;
import com.amazonaws.services.kinesisvideo.AmazonKinesisVideoClientBuilder;
import com.amazonaws.services.kinesisvideo.model.APIName;
import com.amazonaws.services.kinesisvideo.model.DescribeStreamRequest;
import com.amazonaws.services.kinesisvideo.model.DescribeStreamResult;
import com.amazonaws.services.kinesisvideo.model.GetDataEndpointRequest;
import com.amazonaws.services.kinesisvideo.model.GetDataEndpointResult;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import software.amazon.awssdk.services.kinesisvideo.model.GetDataEndpointResponse;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

import static software.amazon.awssdk.regions.Region.US_WEST_2;
import static software.amazon.awssdk.services.kinesisvideo.model.APIName.PUT_MEDIA;

/**
* Demo Java Producer with Cached Stream Information to lower start latency.
*/
Expand Down Expand Up @@ -56,9 +56,9 @@ public static void main(final String[] args) {
try {
final ScheduledExecutorService executor = Executors.newScheduledThreadPool(NUMBER_OF_THREADS_IN_POOL,
new ThreadFactoryBuilder().setNameFormat("KVS-JavaClientExecutor-%d").build());
final AWSCredentialsProvider awsCredentialsProvider = AuthHelper.getSystemPropertiesCredentialsProvider();
final AwsCredentialsProvider awsCredentialsProvider = AuthHelper.getSystemPropertiesCredentialsProvider();
final KinesisVideoClientConfiguration configuration = KinesisVideoClientConfiguration.builder()
.withRegion(Regions.US_WEST_2.getName())
.withRegion(US_WEST_2.toString())
.withCredentialsProvider(new JavaCredentialsProviderImpl(awsCredentialsProvider))
.withStorageCallbacks(new DefaultStorageCallbacks())
.build();
Expand Down Expand Up @@ -147,22 +147,23 @@ private static MediaSource createImageFileMediaSource(String streamName) {

private static void addCachedStreamInfoWithCredentialsProvider(CachedInfoMultiAuthServiceCallbacksImpl serviceCallbacks,
String streamName,
AWSCredentialsProvider credentialsProvider,
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)
software.amazon.awssdk.services.kinesisvideo.KinesisVideoClient kvsClient = software.amazon.awssdk.services.kinesisvideo.KinesisVideoClient.builder()
.region(Region.of(region))
.credentialsProvider(credentialsProvider)
.build();
DescribeStreamResult streamInfo = kvsClient.describeStream(new DescribeStreamRequest().withStreamName(streamName));

DescribeStreamResponse streamInfo = kvsClient.describeStream(DescribeStreamRequest.builder().streamName(streamName).build());
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());
GetDataEndpointResponse dataEndpoint =
kvsClient.getDataEndpoint(GetDataEndpointRequest.builder().apiName(PUT_MEDIA).streamName(streamName).build());
serviceCallbacks.addStreamingEndpointToCache(streamName, dataEndpoint.dataEndpoint());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import com.amazonaws.kinesisvideo.java.mediasource.file.AudioVideoFileMediaSourceConfiguration;
import com.amazonaws.kinesisvideo.java.mediasource.file.ImageFileMediaSource;
import com.amazonaws.kinesisvideo.java.mediasource.file.ImageFileMediaSourceConfiguration;
import com.amazonaws.regions.Regions;

import static com.amazonaws.kinesisvideo.util.StreamInfoConstants.ABSOLUTE_TIMECODES;
import static software.amazon.awssdk.regions.Region.US_WEST_2;

/**
* Demo Java Producer.
Expand Down Expand Up @@ -40,7 +40,7 @@ public static void main(final String[] args) {
// create Kinesis Video high level client
final KinesisVideoClient kinesisVideoClient = KinesisVideoJavaClientFactory
.createKinesisVideoClient(
Regions.US_WEST_2,
US_WEST_2,
AuthHelper.getSystemPropertiesCredentialsProvider());

// create a media source. this class produces the data and pushes it into
Expand Down
129 changes: 0 additions & 129 deletions src/main/demo/com/amazonaws/kinesisvideo/demoapp/PutMediaDemo.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.amazonaws.kinesisvideo.demoapp.auth;

import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.SystemPropertiesCredentialsProvider;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;
import software.amazon.awssdk.auth.credentials.SystemPropertyCredentialsProvider;

public final class AuthHelper {
public static AWSCredentialsProvider getSystemPropertiesCredentialsProvider() {
return new SystemPropertiesCredentialsProvider();
public static AwsCredentialsProvider getSystemPropertiesCredentialsProvider() {
return SystemPropertyCredentialsProvider.create();
}

private AuthHelper() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.amazonaws.kinesisvideo.client.signing;

import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.kinesisvideo.config.ClientConfiguration;
import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider;

/**
* This is an extended class of {@link KinesisVideoAWS4Signer} which decides whether to
Expand All @@ -14,19 +14,10 @@
*/
public class AWSKinesisVideoV4Signer extends KinesisVideoAWS4Signer {

private final boolean mIsStreamingPayload;

public AWSKinesisVideoV4Signer(
final AWSCredentialsProvider credentialsProvider,
final ClientConfiguration config,
final boolean isStreamingPayload) {
final AwsCredentialsProvider credentialsProvider,
final ClientConfiguration config) {
super(credentialsProvider, config);
mIsStreamingPayload = isStreamingPayload;
}

@Override
protected boolean shouldAddContentUnsignedPayloadInHeader(final String httpMethodName) {
return mIsStreamingPayload;
}
}

Loading