String url = "http://23.101.29.94:1111/text1.mp3";
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
try {
mediaPlayer.setDataSource(url);
} catch (IOException e) {
e.printStackTrace();
}
try {
mediaPlayer.prepare();
} catch (IOException e) {
e.printStackTrace();
}
mediaPlayer.start();
When it run:
2019-11-04 20:55:31.221 13816-13816/com.example.loginlogout E/MediaPlayerNative: start called in state 0, mPlayer(0xe9a85440)
2019-11-04 20:55:31.221 13816-13816/com.example.loginlogout E/MediaPlayerNative: error (-38, 0)
2019-11-04 20:55:31.235 13816-13816/com.example.loginlogout E/MediaPlayer: Error (-38,0)
but this url (http://23.101.29.94:1111/text1.mp3) run well in browser, How I fix that