java - Android MediaPlayer loading from localhost but not from online server -
android mediaplayer loading files localhost not online server.
as told android developers guide
string url = "http://10.0.2.2/music.mp3"; // works string url = "http://example.com/audios/music.mp3"; // not works mediaplayer mediaplayer = new mediaplayer(); mediaplayer.setaudiostreamtype(audiomanager.stream_music); mediaplayer.setdatasource(url); mediaplayer.prepare(); mediaplayer.start();
logs show:
05-28 20:31:20.403 942-2444/? e/nucachedsource2: source returned error -1, 10 retries left 05-28 20:31:24.308 942-2444/? e/nucachedsource2: source returned error -1, 9 retries left 05-28 20:31:28.231 942-2444/? e/nucachedsource2: source returned error -1, 8 retries left 05-28 20:31:32.150 942-2444/? e/nucachedsource2: source returned error -1, 7 retries left 05-28 20:31:36.061 942-2444/? e/nucachedsource2: source returned error -1, 6 retries left 05-28 20:31:39.974 942-2444/? e/nucachedsource2: source returned error -1, 5 retries left 05-28 20:31:43.937 942-2444/? e/nucachedsource2: source returned error -1, 4 retries left 05-28 20:31:47.858 942-2444/? e/nucachedsource2: source returned error -1, 3 retries left 05-28 20:31:51.798 942-2444/? e/nucachedsource2: source returned error -1, 2 retries left 05-28 20:31:55.740 942-2444/? e/nucachedsource2: source returned error -1, 1 retries left 05-28 20:32:00.258 2405-2405/? w/system.err: java.io.ioexception: prepare failed.: status=0x1
and anr error.
please help. thanx in advance!
Comments
Post a Comment