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

  • SEARCH
  • Home
  • 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 8870157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:39:11+00:00 2026-06-14T17:39:11+00:00

I am trying to make a mediaplayer in android streaming songs from Amazon S3.

  • 0

I am trying to make a mediaplayer in android streaming songs from Amazon S3.
I made the songs in my bucket public and it works fine when I stream them with the bowser.
But when it come to android, it throws me an exception like that.

11-20 01:28:37.720: W/System.err(736): java.io.FileNotFoundException: /https:/s3.amazonaws.com/soul-media/mp3s/1234.mp3: open failed: ENOENT (No such file or directory)

here is my code for the player

    MediaPlayer mid= new MediaPlayer();
    try {
        FileInputStream fid= new FileInputStream("https://s3.amazonaws.com/soul-media/mp3s/1234.mp3");
        mid.setDataSource(fid.getFD());
        mid.prepare();
        mid.start();
    } catch (IllegalArgumentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IllegalStateException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

It worked with android 4.1 but did not work with 2.2, can that be the issue?
I also tried some urls other than Amazon S3, it works. So is that something with Amazon?

  • 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-14T17:39:12+00:00Added an answer on June 14, 2026 at 5:39 pm

    Is there any reason you can’t just skip creating the FileInputStream and call mid.setDataSource("https://s3.amazonaws.com/...") via this overload? Does that work?

    Edit:
    Apparently, instead of calling prepare for streams, you should be calling prepareAsync which should return immediately, like so:

    MediaPlayer mid = new MediaPlayer();
    try {
        mid.setDataSource("http://soul-media.s3.amazonaws.com/mp3s/1234.mp3");
        mid.setOnPreparedListener(new OnPreparedListener() {
            @Override
            public void onPrepared(MediaPlayer mp) {
                mp.start();
            }
        });
        mid.setOnErrorListener(new OnErrorListener() {
            @Override
            public boolean onError(MediaPlayer mp, int what, int extra) {
                return false;
            }
        });
        mid.prepareAsync();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (IllegalStateException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    

    Does that help?

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

Sidebar

Related Questions

I'm trying to make an app that plays live http streaming on android (i
Trying to make the infamous checkall checkbox for dynamically created rows from a MySQL
Trying to make a cross protocol, same domain request from https to http. I
I am trying to make an Android music player. To make things easier, I
im trying make one replace in string from a array but this dont work
I'm new at android developing. I'm trying to make a simple drumset app, when
I'm trying to make an Android app written in Java, to work on Playbook
I'm trying to spoof the android player. I want MediaPlayer (I'm using the VideoView
I am trying to get the Android mediaplayer to stop playing a sound in
I'm am trying to make my App play a Default android Sound Once my

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.