php - How to stream mp3 file in local server to android? -


i can data local server(php) android post/get method connecting both devices same wifi , using lap's ip address in android app.is there ways stream mp3 files (stored in lap) instead of post/get/downloding , playing in android device? php sufficient stream? or there other platform better php , easy use?

you can use intent:

uri mp3uri = uri.parse("http://local.ip/folder/music.mp3"); intent intent = new intent(android.content.intent.action_view);  intent.setdataandtype(mp3uri, "audio/mpeg3");  startactivity(intent); 

the above intent trigger choose prompt available apps can play mp3.


update:

based on comment:

uri myuri = uri.parse("http://local.ip/folder/music.mp3");             try {           mediaplayer = new mediaplayer();           mediaplayer.setdatasource(this, myuri);           mediaplayer.setaudiostreamtype(audiomanager.stream_music);           mediaplayer.prepare(); //don't use prepareasync mp3 playback       } catch (ioexception e) {                      e.printstacktrace();       }  

Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -