我想创建一个播放服务器声音的应用。 从互联网接收和播放工作,但我的JMF-Programm不起作用(错误(-38,0))。
这是我在应用中的代码片段:
MediaPlayer mPlayer = new MediaPlayer();
// String url
// ="http://programmerguru.com/android-tutorial/wp-content/uploads/2013/04/hosannatelugu.mp3";
String url = "rtp://192.168.32.29:22222/audio/16";
mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
AudioManager audioManager = (AudioManager) this
.getSystemService(Context.AUDIO_SERVICE);
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, volume, volume);
try {
mPlayer.setDataSource(url);
} catch (IllegalArgumentException e) {
Toast.makeText(getApplicationContext(),
"You might not set the URI correctly!", Toast.LENGTH_LONG)
.show();
} catch (SecurityException e) {
Toast.makeText(getApplicationContext(),
"You might not set the URI correctly!", Toast.LENGTH_LONG)
.show();
} catch (IllegalStateException e) {
Toast.makeText(getApplicationContext(),
"You might not set the URI correctly!", Toast.LENGTH_LONG)
.show();
} catch (IOException e) {
e.printStackTrace();
}
try {
mPlayer.prepare();
} catch (IllegalStateException e) {
Toast.makeText(getApplicationContext(),
"You might not set the URI correctly!", Toast.LENGTH_LONG)
.show();
} catch (IOException e) {
Toast.makeText(getApplicationContext(),
"You might not set the URI correctly!", Toast.LENGTH_LONG)
.show();
}
mPlayer.start();
当我使用" http://programmerguru.com/android-tutorial/wp-content/uploads/2013/04/hosannatelugu.mp3"它有效,但" rtp://192.168.32.29:22222 / audio / 16"发给我错误(-38,0)
有人能帮助我吗? 感谢