Das ist für mich gearbeitet:
public void setupMediaPlayer(){
// Setup Media Player and Prepare to Play
media = new MediaPlayer();
media.setAudioStreamType(AudioManager.STREAM_MUSIC);
// Authdata
String username = "username";
String password = "password";
// encrypt Authdata
byte[] toEncrypt = (username + ":" + password).getBytes();
String encoded = Base64.encodeToString(toEncrypt, Base64.DEFAULT);
// create header
Map<String, String> headers = new HashMap<>();
headers.put("Authorization","Basic "+encoded);
Uri uri = Uri.parse("http://your.full.url:port");
try {
media.setDataSource(this,uri,headers);
} catch (IOException e) {
Log.e(TAG,"Exception "+e.getMessage());
}
media.prepareAsync();
media.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
mp.start();
}
});
}
Haben Sie eine Lösung? Ich stehe vor demselben Problem. –