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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:08:10+00:00 2026-05-23T04:08:10+00:00

I’m currently have a media player that is streaming an mp3 file. When that

  • 0

I’m currently have a media player that is streaming an mp3 file. When that file is done, what is the code so that it goes to the next url/mp3?

And also, is there code to get the name of the file and display it? how would I go about doing that?

thanks

EDIT

see my code below:

package com.example.m3uplayer;

import android.app.Activity;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.media.MediaPlayer.OnCompletionListener;

public class m3uPlayer extends Activity implements MediaPlayer.OnCompletionListener {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        //

        //http://dl.dropbox.com/u/24535120/AfroJack-UMF11-clip2.mp3

        //http://dl.dropbox.com/u/24535120/Avicii%20clip%201.mp3


        Uri myUri = Uri.parse("http://dl.dropbox.com/u/24535120/AfroJack-UMF11-clip2.mp3");

        MediaPlayer sdrPlayer = new MediaPlayer();

        try {
            sdrPlayer.setDataSource(this, myUri);//"http://mp1.somafm.com:8032");
            sdrPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
            sdrPlayer.prepare(); //don't use prepareAsync for mp3 playback
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        sdrPlayer.start();
    }

    @Override
    public void onCompletion(MediaPlayer sdrPlayer) {
        Uri myUri5 = Uri.parse("http://dl.dropbox.com/u/24535120/Avicii%20clip%201.mp3");

        try {
            sdrPlayer.setDataSource(this, myUri5);
            sdrPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
            sdrPlayer.prepare(); //don't use prepareAsync for mp3 playback
        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (SecurityException 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();
        }

        sdrPlayer.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-23T04:08:11+00:00Added an answer on May 23, 2026 at 4:08 am

    You can register an OnCompletionListener with the media player. When it receives its callback notification, you need to call reset(), setDataSource, and prepare() on the media player for the next URL.

    I don’t believe there is anything in the api to tell you what data source a media player is using. You need to keep track of that yourself.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a reasonable size flat file database of text documents mostly saved in
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.