Reputation: 1503
I want to live stream Android microphone which can be heard using a VLC player etc.
Playstore have mainly IP Camera apps but these are over the internal network. I want to stream over the internet.
Is it possible?
I tried the following code snippet but it is not working at the moment:
public void audiostream()
{
MediaPlayer mp = new MediaPlayer();
try {
mp.setDataSource(getBaseContext(),Uri.parse("http://192.168.1.3"));
mp.prepare();
} 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();
}
mp.start();
}
Over at the VLC player, I tried listening (Media -> Stream -> set 192.168.1.3 as IP) but couldn't get anything.
Is there any other way?
Upvotes: 1
Views: 637
Reputation: 3731
MediaPlayer.setDataSource sets where the MediaPlayer will stream from, right now MediaPlayer is trying to play from that IP Address.
You need to implement some sort of Audio streaming server on top of android, something similar to this if i understand your question correctly.
Do have in mind that question seems to be using a custom protocol, hence the custom java program he mentions. You would need to research on audio streaming protocols to implement a known standard that works with VLC.
Upvotes: 1