Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8804729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:40:54+00:00 2026-06-14T01:40:54+00:00

I use aws-android-sdk-1.4.3/samples/S3_SimpleDB_SNS_SQS_Demo to preview my files stored on Amazon (Amazon Simple Storage Service).

  • 0

I use aws-android-sdk-1.4.3/samples/S3_SimpleDB_SNS_SQS_Demo to preview my files stored on Amazon (Amazon Simple Storage Service). Looking through code I saw that they use this, to acces the files:

com.amazonaws.demo.s3.S3.getDataForObject (line 130)

 public static String getDataForObject( String bucketName, String objectName ) {
        return read( getInstance().getObject( bucketName, objectName ).getObjectContent() );
    }


protected static String read( InputStream stream ) {
    try {
        ByteArrayOutputStream baos = new ByteArrayOutputStream( 8196 );
        byte[] buffer = new byte[1024];
        int length = 0;
        while ( ( length = stream.read( buffer ) ) > 0 ) {
            baos.write( buffer, 0, length );
        }

        return baos.toString();
    }
    catch ( Exception exception ) {
        return exception.getMessage();

    }
}

}

Well, I have modified this methods to return ByteArrayOutputStream instead then I easily transform it to String or Bitmap (applying ByteArrayOutputStream.toByteArray() then using
BitmapFactory.decodeByteArray(byte[] data, int offset, int length, Options opts)).

So, it works on text-files and pictures. My problem is when I try to access videos. So, my questions are:

1.Using the method provided above, how could I get a video from ByteArrayOutputStream (ByteArrayOutputStream.toString()) and play it in a VideoView or using MediaPlayer or an approach… ?

2 . Does anybody know any other solution to this problem of preview videos stored on Amazon ? (I heard that on their sdk for IOS they use URLs to access files…)

PS: Supplying the file URL and open it in browser does not make sense, because this URLs expire after a wile.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T01:40:57+00:00Added an answer on June 14, 2026 at 1:40 am

    First we have to provide the name of our bucket and the object (see aws-android-sdk-1.4.3/samples/S3_SimpleDB_SNS_SQS_Demo for a complet guide) we want to open then get the URL to our object:

        AWSCredentials myCredentials = new BasicAWSCredentials("YOUR_AMAZON_ACCESS_KEY_ID", "YOUR_AMAZON_SECRET_KEY_ID");
        AmazonS3 s3client = new AmazonS3Client(myCredentials);
        GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucketName, objectName);
        URL objectURL = s3client.generatePresignedUrl(request);
    

    Now, just play the video in a video view, supplying the URL obtained:

        getWindow().setFormat(PixelFormat.TRANSLUCENT);
        mediaCtrl = new MediaController(this);
        mediaCtrl.setMediaPlayer(videoView);
        videoView.setMediaController(mediaCtrl);
        Uri clip = Uri.parse(objectURL.toString());
        videoView.setVideoURI(clip);
        videoView.requestFocus();
        videoView.start();
    

    I want to give thanks to @CommonsWare for

    • indicating me through REST API (even the code I used is from aws-sdk reading the REST API documentation helped me and show also other ways of requesting Amazon objects)

    • indicating me to use generatePresignedUrl()

    • the code for playing the video is also inspired from his materials.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to use AWS and especially Amazon Simple Email Service (SES) in
I'm trying to understand amazon php sdk for AWS but I really can't use
I am trying to use http://code.google.com/p/amazon-s3-php-class/ to force-dowload files from AWS S3. I have
I tried to use Amazon-SDK(Java) sample code S3TransferProgressSample.java to upload large files to Amazon-S3
I would like to use the Amazon AWS SDK for PHP in my Yii
We upload files to Amazon AWS S3 server and use the file url in
I am trying to use the aws sdk for php to create temporary credentials
We use Amazon S3 for storing large files, so we use direct upload from
Amazon Cloud Services (AWS) has provided the ready to use Library to make calls
I use a subclass of NSOperation to upload large files to AWS S3 using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.