I want to stream music from url and record it but for some reason i keep getting an err when i use this line InputStream is = conn.getInputStream(); here is by code. why is not working?
InputStream is = conn.getInputStream();
BufferedInputStream in = new BufferedInputStream(is);
OutputStream out = new BufferedOutputStream(new FileOutputStream(new File("/mnt/sdcard/Download/output.mp3")));
byte[] buf = new byte[256];
int n = 0;
while ((n=in.read(buf))>=0) {
out.write(buf, 0, n);
}
out.flush();
out.close();
Actually the url is just an html file. When you click on the link for the stream you get redirected where you need to login - after you have paid and registered.