Jump to content

Streaming Radio


jerem.ram

Recommended Posts

Bonjour,

je voudrais faire un programme pour lire une radio en streaming. Mais avec un objet MediaPlayer, ca ne fonctionne pas, les seuls formats qui sont acceptés ne sont pas des formats de flux.

Est-ce que vous savez comment faire pour lire un fichier asx / m3u ?!

Link to comment
Share on other sites

  • 1 month later...

Bonjour. Est-ce que vous avez donné des permissions particulières sur le manifest.xml ?

J'ai fait un test pour faire du streaming mais ça ne marche pas.

Mon code:

package com.radio.fm;

import java.io.IOException;

import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;

public class home extends Activity {
   /** Called when the activity is first created. */

   MediaPlayer mp = new MediaPlayer();
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);
       try {
		mp.setDataSource("http://www.radiofm.net/listen.asx");
	} 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 {
		mp.prepare();
	} catch (IllegalStateException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
       mp.start();
   }
}

Merci

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...