diff --git a/app/build.gradle b/app/build.gradle
index f93d579..4826e23 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -36,7 +36,11 @@ dependencies {
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.exoplayer:exoplayer:2.18.1'
- implementation("io.minio:minio:8.4.3")
+ // BEGIN AWS DEPENDENCIES
+ def aws_version = "2.16.+"
+ implementation "com.amazonaws:aws-android-sdk-s3:$aws_version"
+ implementation ("com.amazonaws:aws-android-sdk-mobile-client:$aws_version") { transitive = true }
+ // END AWS DEPENDENCIES
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
diff --git a/app/src/main/java/asgardius/page/s3manager/MainActivity.java b/app/src/main/java/asgardius/page/s3manager/MainActivity.java
index e6994fe..ba0298d 100644
--- a/app/src/main/java/asgardius/page/s3manager/MainActivity.java
+++ b/app/src/main/java/asgardius/page/s3manager/MainActivity.java
@@ -1,5 +1,9 @@
package asgardius.page.s3manager;
+import static com.amazonaws.regions.RegionUtils.getRegion;
+import static com.amazonaws.regions.Regions.US_EAST_1;
+import static com.amazonaws.services.s3.S3ClientOptions.DEFAULT_PATH_STYLE_ACCESS;
+
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
@@ -7,8 +11,20 @@ import android.os.Bundle;
import android.view.View;
import android.widget.Button;
+import com.amazonaws.auth.AWSCredentials;
+import com.amazonaws.auth.BasicAWSCredentials;
+import com.amazonaws.regions.Region;
+import com.amazonaws.services.s3.AmazonS3;
+import com.amazonaws.services.s3.AmazonS3Client;
+import com.amazonaws.services.s3.S3ClientOptions;
+import com.amazonaws.services.s3.model.GeneratePresignedUrlRequest;
+
+import java.net.URL;
+
public class MainActivity extends AppCompatActivity {
+ static boolean DEFAULT_PATH_STYLE_ACCESS = true;
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -19,11 +35,28 @@ public class MainActivity extends AppCompatActivity {
@Override
public void onClick(View view) {
//buttonaction
- videoplayer("https://video.asgardius.company/download/videos/41780585-a935-4d53-84c8-45ce97141231-480.mp4");
+ s3test();
+ //videoplayer("https://video.asgardius.company/download/videos/41780585-a935-4d53-84c8-45ce97141231-480.mp4");
}
});
}
+ private void s3test() {
+
+ Region region = Region.getRegion(US_EAST_1);
+ S3ClientOptions s3ClientOptions = S3ClientOptions.builder().build();
+ s3ClientOptions.setPathStyleAccess(true);
+ AWSCredentials myCredentials = new BasicAWSCredentials(getResources().getString(R.string.access_key), getResources().getString(R.string.secret_key));
+ AmazonS3 s3client = new AmazonS3Client(myCredentials, region);
+ s3client.setEndpoint(getResources().getString(R.string.endpoint_url));
+ s3client.setS3ClientOptions(s3ClientOptions);
+ //s3client.setRegion(getRegion("asteroid"));
+ GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(getResources().getString(R.string.bucketname), getResources().getString(R.string.objectname));
+ URL objectURL = s3client.generatePresignedUrl(request);
+ videoplayer(objectURL.toString());
+
+ }
+
private void videoplayer(String url) {
Intent intent = new Intent(this, VideoPlayer.class);
@@ -31,4 +64,5 @@ public class MainActivity extends AppCompatActivity {
startActivity(intent);
}
+
}
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index f089f4f..1ca12ee 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -5,6 +5,8 @@
s3server
username
password
+ bucket
+ object
Video Test
Cannot load media file
Dummy Button