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 7057279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:58:01+00:00 2026-05-28T03:58:01+00:00

I am trying to play an url but its not playing and the code

  • 0

I am trying to play an url but its not playing and the code i used is below..the logcat is showing Mediaplayer error(1,-1002), start state is 0 and error(-38, 0) why…? where i am going wrong……can u help me out how to play……..

       import java.io.IOException;

       import android.app.Activity;
       import android.media.AudioManager;
       import android.media.MediaPlayer;
         import android.os.Bundle;
      import android.view.View;
      import android.widget.ImageButton;
       import android.widget.TextView;

        public class BacaFatihahActivity extends Activity {



        final String songs_urIs= "http://stream.radiosai.net:8002/";
           // private TextView txt_song_title;
        private MediaPlayer mediaplayer;
        @Override
         public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  ImageButton btn_play = (ImageButton) findViewById(R.id.button_play);
  ImageButton btn_pause = (ImageButton) findViewById(R.id.button_pause);
  ImageButton btn_next = (ImageButton) findViewById(R.id.button_next);
  ImageButton btn_previous = (ImageButton) findViewById(R.id.button_Previous);
  //txt_song_title = (TextView) findViewById(R.id.txt_song_title);

  mediaplayer = new MediaPlayer();
  mediaplayer.setAudioStreamType(AudioManager.STREAM_MUSIC);


  btn_play.setOnClickListener(new View.OnClickListener() {

    public void onClick(View v) {
        try {
            mediaplayer.setDataSource(songs_urIs);
        } 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();
        }
          try {
            mediaplayer.prepare();
        } catch (IllegalStateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
         mediaplayer.start();   
    }
       });


        }
       }
  • 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-05-28T03:58:01+00:00Added an answer on May 28, 2026 at 3:58 am

    right code but wrong api level~

    it’s not every api level supports this way to play a media,http live streaming ,may be you need api level 10 or higher

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

Sidebar

Related Questions

I am trying to play audio in a Java applet but it is not
So, I'm trying to get a video to play from an HTTP url. To
I'm trying to play a sound file from an iPhone program. Here's the code:
I'm trying to play with inter-process communication and since I could not figure out
I am trying to find the best way to play a URL of an
I'm trying to play Audio URL (streaming URL) in MPMoviePlayerController. (I'm aware of AVAudioFramework
I have been trying this for so long, but was not able to implement
I'm trying to play around with URL rewrites and can't get it to work.
I am trying to play a sound file using : gst-launch playbin uri=some URL
I am trying to play video(.mp4) in my app using following code. NSString *doc

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.