Skip to content

Commit

Permalink
Merge pull request #107 from awslabs/okhttp
Browse files Browse the repository at this point in the history
Replace Tyrus with OkHttp
  • Loading branch information
niyatim23 authored Apr 17, 2024
2 parents 3469b7e + 49efe7f commit ea44a59
Show file tree
Hide file tree
Showing 15 changed files with 300 additions and 343 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: AWS KVS WebRTC Android SDK CI

on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
java: [11, 17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: ${{ matrix.java }}

- name: Download libwebrtc
run: wget -O app/libs/libwebrtc-115.0.0.aar https://github.com/rno/WebRTC/releases/download/115.0.0/libwebrtc-115.0.0.aar

- name: Build with Gradle
run: ./gradlew build

- name: Run tests
run: ./gradlew test
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
app/libs/libwebrtc-*
app/src/main/res/raw/awsconfiguration.json
app/build

10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ However, in the case that it needs to be disabled, locate the RTCConfiguration p
PeerConnection.RTCConfiguration rtcConfig = new PeerConnection.RTCConfiguration();
rtcConfig.continualGatheringPolicy = PeerConnection.ContinualGatheringPolicy.GATHER_CONTINUALLY;
```
## 7. Testing
This SDK has been tested with Java 11, 17 to build the Gradle dependencies and Java 8, 11, and, 17 in the compile options in build.gradle

```agsl
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
```
For more details about the different Java versions, please check [Java versions in Android builds](https://developer.android.com/build/jdks#jdk-config-in-studio)

## License

Expand Down
2 changes: 0 additions & 2 deletions app/.gitignore

This file was deleted.

14 changes: 7 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ android {
compileSdk 33

defaultConfig {
namespace("com.amazonaws.kinesisvideo.demoapp")

applicationId "com.amazonaws.kinesisvideo.webrtc_sdk_android"
minSdk 29
targetSdk 33
Expand All @@ -32,7 +34,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])

def aws_version = '2.73.0'
def aws_version = '2.75.0'
implementation("com.amazonaws:aws-android-sdk-kinesisvideo:$aws_version@aar") { transitive = true }
implementation("com.amazonaws:aws-android-sdk-kinesisvideo-signaling:$aws_version@aar") { transitive = true }
implementation("com.amazonaws:aws-android-sdk-kinesisvideo-webrtcstorage:$aws_version@aar") { transitive = true }
Expand All @@ -43,22 +45,20 @@ dependencies {
implementation 'org.awaitility:awaitility:4.2.0'
implementation 'org.json:json:20190722'
implementation 'com.google.guava:guava:28.1-android'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'org.apache.commons:commons-lang3:3.9'
implementation('org.glassfish.tyrus.bundles:tyrus-standalone-client:1.21') {
exclude module: 'javax.inject'
}
implementation("com.squareup.okhttp3:okhttp:4.12.0")

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

// Check that libwebrtc is present during build
task checkForLibWebRTC() {
tasks.register('checkForLibWebRTC') {
doLast {
boolean webrtcFound = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
import android.util.Log;

import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.kinesisvideo.common.logging.LogLevel;
import com.amazonaws.kinesisvideo.common.logging.OutputChannel;
import com.amazonaws.mobile.client.AWSMobileClient;
import com.amazonaws.mobile.config.AWSConfiguration;
import com.amazonaws.mobileconnectors.kinesisvideo.util.AndroidLogOutputChannel;

import org.json.JSONException;
import org.json.JSONObject;
Expand All @@ -17,9 +14,6 @@ public class KinesisVideoWebRtcDemoApp extends Application {
private static final String TAG = KinesisVideoWebRtcDemoApp.class.getSimpleName();

public static AWSCredentialsProvider getCredentialsProvider() {
final OutputChannel outputChannel = new AndroidLogOutputChannel();
final com.amazonaws.kinesisvideo.common.logging.Log log =
new com.amazonaws.kinesisvideo.common.logging.Log(outputChannel, LogLevel.VERBOSE, TAG);
return AWSMobileClient.getInstance();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,36 +30,30 @@ protected void onCreate(Bundle savedInstanceState) {
final AppCompatActivity thisActivity = this;
supportFinishAfterTransition();

AsyncTask.execute(new Runnable() {
@Override
public void run() {
if (auth.isSignedIn()) {
ActivityUtils.startActivity(thisActivity, SimpleNavActivity.class);
} else {
auth.showSignIn(thisActivity,
SignInUIOptions.builder()
.logo(R.mipmap.kinesisvideo_logo)
.backgroundColor(Color.WHITE)
.nextActivity(SimpleNavActivity.class)
.build(),
new Callback<UserStateDetails>() {
@Override
public void onResult(UserStateDetails result) {
Log.d(TAG, "onResult: User signed-in " + result.getUserState());
}
AsyncTask.execute(() -> {
if (auth.isSignedIn()) {
ActivityUtils.startActivity(thisActivity, SimpleNavActivity.class);
} else {
auth.showSignIn(thisActivity,
SignInUIOptions.builder()
.logo(R.mipmap.kinesisvideo_logo)
.backgroundColor(Color.WHITE)
.nextActivity(SimpleNavActivity.class)
.build(),
new Callback<UserStateDetails>() {
@Override
public void onResult(UserStateDetails result) {
Log.d(TAG, "onResult: User signed-in " + result.getUserState());
}

@Override
public void onError(final Exception e) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Log.e(TAG, "onError: User sign-in error", e);
Toast.makeText(StartUpActivity.this, "User sign-in error: " + e.getMessage(), Toast.LENGTH_LONG).show();
}
});
}
});
}
@Override
public void onError(final Exception e) {
runOnUiThread(() -> {
Log.e(TAG, "onError: User sign-in error", e);
Toast.makeText(StartUpActivity.this, "User sign-in error: " + e.getMessage(), Toast.LENGTH_LONG).show();
});
}
});
}
});
}
Expand Down
Loading

0 comments on commit ea44a59

Please sign in to comment.