Skip to content

Commit 4b6eb04

Browse files
sirknightjtjleing
andauthored
Update user pool and identity pool instructions, bump gradle version (#351)
* Update user pool and identity pool instructions, bump gradle version * Update AmazonKinesisVideoDemoApp/README.md Co-authored-by: Thomas Leing <[email protected]> * Cleanup readme --------- Co-authored-by: Thomas Leing <[email protected]>
1 parent c439456 commit 4b6eb04

File tree

4 files changed

+23
-51
lines changed

4 files changed

+23
-51
lines changed

AmazonKinesisVideoDemoApp/README.md

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,14 @@
11
# Running AmazonKinesisVideoStreaming Sample
22

3-
More information: [https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/producer-sdk-android.html](https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/producer-sdk-android.html)
3+
## 1. Provision and setup
44

5-
## 1. Create a user pool
6-
* Go to https://console.aws.amazon.com/cognito/
7-
* Click `Manage your User Pools`
8-
* Click `Create a user pool`
9-
* Fill-in `Pool name`
10-
* Click `Review defaults`
11-
* Click `Create user pool`
12-
* Copy `Pool Id` :clipboard:
13-
* Select `App clients` in the left nav.
14-
* Click `Add an app client`
15-
* Fill-in `App client name`
16-
* Click `Create app client`
17-
* Click `Show details` and copy `App client id` and `App client secret` :clipboard:
18-
* ![Shows show details button](screenshots/click_show_details.png) `-->` ![](screenshots/copy_app_client_id_and_secret.png)
5+
Follow the documentation to provision the AWS resources required to run this sample, and assign the appropriate permissions to the IAM role: [https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/producersdk-android-prerequisites.html](https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/producersdk-android-prerequisites.html)
196

20-
## 2. Create an identity pool
21-
* Go to https://console.aws.amazon.com/cognito/
22-
* Click `Manage Federated Identities`
23-
* Click `Create new identity pool`
24-
* Fill-in `Identity pool name`
25-
* ![Shows field for inputting identity pool name](screenshots/pool_name.png)
26-
* Under the heading `Authentication providers`, in the `Cognito` tab, fill-in the `User Pool Id` and `App client id` from the user pools step.
27-
![Shows field for inputting identity pool name](screenshots/fill_in_user_pool.png)
28-
* Click `Create create`
29-
* There will be details for 2 roles. Look at the one for `authenticated identities` and click `Edit` next to the policy document and your policy should look like this:
30-
```
31-
{
32-
"Version": "2012-10-17",
33-
"Statement": [
34-
{
35-
"Effect": "Allow",
36-
"Action": [
37-
"cognito-identity:*",
38-
"kinesisvideo:*"
39-
],
40-
"Resource": [
41-
"*"
42-
]
43-
}
44-
]
45-
}
46-
```
47-
* Click `Allow`
48-
* Copy the `Identity Pool Id` from the code snippets on the screen. :clipboard:
7+
* Amazon Cognito user pool
8+
* Amazon Cognito identity pool
499

50-
## 3. Paste
51-
* You will need all the information from the above steps that have :clipboard: and paste them into this file on your local copy [awsconfiguration.json](src/main/res/raw/awsconfiguration.json). Here's what it should look like when you're done:
10+
## 2. Paste
11+
* You will need all the information from the step above that you have obtained, and paste them into your local copy of [awsconfiguration.json](src/main/res/raw/awsconfiguration.json). Here's what it should look like when you're done:
5212
```json
5313
{
5414
"Version": "1.0",

AmazonKinesisVideoDemoApp/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildscript {
55
}
66

77
dependencies {
8-
classpath 'com.android.tools.build:gradle:3.2.1'
8+
classpath 'com.android.tools.build:gradle:7.2.2'
99
}
1010
}
1111

@@ -49,7 +49,7 @@ repositories {
4949

5050

5151
dependencies {
52-
def aws_version = '2.52.+'
52+
def aws_version = '2.71.+'
5353

5454
implementation ("com.amazonaws:aws-android-sdk-kinesisvideo:$aws_version@aar") { transitive = true }
5555
implementation ("com.amazonaws:aws-android-sdk-mobile-client:$aws_version@aar") { transitive = true }
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Wed Jul 12 16:15:38 PDT 2023
12
distributionBase=GRADLE_USER_HOME
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
24
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip
4-
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6+
zipStoreBase=GRADLE_USER_HOME

AmazonKinesisVideoDemoApp/src/main/java/com/amazonaws/kinesisvideo/demoapp/fragment/StreamConfigurationFragment.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.amazonaws.kinesisvideo.demoapp.ui.adapter.ToStrings;
2626
import com.amazonaws.kinesisvideo.demoapp.ui.widget.StringSpinnerWidget;
2727
import com.amazonaws.kinesisvideo.producer.StreamInfo;
28+
import com.amazonaws.mobile.client.AWSMobileClient;
2829
import com.amazonaws.mobileconnectors.kinesisvideo.client.KinesisVideoAndroidClientFactory;
2930
import com.amazonaws.mobileconnectors.kinesisvideo.data.MimeType;
3031
import com.amazonaws.mobileconnectors.kinesisvideo.mediasource.android.AndroidCameraMediaSourceConfiguration;
@@ -72,12 +73,22 @@ public View onCreateView(final LayoutInflater inflater,
7273

7374
final View view = inflater.inflate(R.layout.fragment_stream_configuration, container, false);
7475

76+
final Thread thread = new Thread(() -> {
77+
try {
78+
((AWSMobileClient) KinesisVideoDemoApp.getCredentialsProvider()).getAWSCredentials();
79+
} catch (final Exception e) {
80+
Log.e(TAG, "Exception while fetching credentials", e);
81+
}
82+
});
83+
thread.start();
84+
7585
try {
86+
thread.join();
7687
mKinesisVideoClient = KinesisVideoAndroidClientFactory.createKinesisVideoClient(
7788
getActivity(),
7889
KinesisVideoDemoApp.KINESIS_VIDEO_REGION,
7990
KinesisVideoDemoApp.getCredentialsProvider());
80-
} catch (KinesisVideoException e) {
91+
} catch (final InterruptedException | KinesisVideoException e) {
8192
Log.e(TAG, "Failed to create Kinesis Video client", e);
8293
}
8394

0 commit comments

Comments
 (0)