java - Android: cant play the mp3 file from the given url -


I want to know about Android Media Player. I have created a media player as it will take the URL and when I I do test in my tablet so when I select the play button it is not working, if I select the button, it will not play or will not make an error, neither is the accident.

I have a question about whether certification is needed, such as during the research, for example I have Android DRM etc because I am adding the URL to the server

Anybody can help me in this

I have posted the code in which I have also used the logic description . The logic will tell about the GPU, so I have tested in my tablet and I can still listen to the MP3 file

  the expansion of the public class MainActivity activity (static final string AUDIO_PATH = "url "; Override public zeros on the private mediaplayer media player; @Create (bundled saved instainstate) {super.naught (savedinstenstate); setContentView (R.layout.main);} Public Zero doClick (View View) {Switch (view.getId ()} {case R.D.play: try {playAudio (AUDIO_PATH);} grip (exception e) {e.printStackTrace ();} breakdown; R.id.stop: if (mediaPlayer ! = Null) {mediaPlayer.stop (); break;}} Private Zero Play Audio (string URL) throws exceptions {killMediaPlayer (); mediaplayer = new media player (); mediaPlayer.setDataSource (url); mediaPlayer.prepare (); MediaPlayer.start ();} Override Protected Zero Destost () {Super. OneStore (); killMediaPlayer ();} Private Wide KillMedia Player (if {(Mediaplayer! = Faucet}} {try {mediaplayer.release ()}} Grip (Exception e) {e.printStackTrace (); }}}}   

The main. The XML file is shown below

   And lieutenant; ImageButton Android: ID = "@ + ID / ButtonPlayPoint1" Android: Layout_Width = "Wrap-content" Android: Layout_Height = "Wrap-content" Android: src = "@Drawable / Play" /> & Lt; SeekBar Android: id = "@ + id / SeekBarTestPlay" Android: layout_width = "match_parent" Android: layout_height = "wrap_content" />   

There is no error in the logcat, such as GPU Enter image details here

  Media Player Mediaplayer = new Media Player (); Mp.setDataSource (Reference, Uri.parse ("http://www.domian.com/ola.mp3")); mp.setAudioStreamType (AudioManager.STREAM_MUSIC); Mp.prepare (); Mp.setOnPreparedListener (New OnPreed Listener () {@ Override Public Wide On Pepere (Media Player) {mp.start ();}}); Mediaplayer.setOnErrorListener (New OwnListener) {@ Override Public Boolean on Error (Mediaplayer MP, Ant Key, et Extra) {// Display Error Return False;}});    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -