안드로이드 개발 질문/답변
(글 수 45,052)
class fileDownLoadTask extends Thread {InputStream is = null;
@Override
public void run() { file = new File("/sdcard/1.mp3"); try { ftp.setFileType(FTP.BINARY_FILE_TYPE);
fos = new FileOutputStream(file);
is = ftp.retrieveFileStream("1.mp3");int downloadedSize = 0;
int totalSize = 9036974;
OutputStream os = new FileOutputStream(file);
byte[] buf = new byte[2048];
int len = 0;
while((len = is.read(buf)) > 0) {os.write(buf, 0, len);
downloadedSize += len;
if (!mp.isPlaying()) { if ((totalSize/5) < downloadedSize) { loadAudio();
play();
}
}
Log.d("ftp", Integer.toString(downloadedSize)); }
os.close();
is.close();
} catch (Exception e) { System.out.println("IO Exception DownLoadTask : " + e.getMessage());FTPdownError = e.getMessage();
mHandler.sendEmptyMessage(5);
}
mHandler.post(new Runnable() {@Override
public void run() { download.setText("Download Complete");pb.setVisibility(ProgressBar.INVISIBLE);
}
});
}
}
이런식으로 파일을 가져와서 플레이 시키는데요
이게 말이죠 플레이 될 당시에 파일 크기만 가지고 그동안만 플레이가 됩니다. ㅠ
플레이 되기 전에 30초 정도 다운을 받았다면 30초만 플레이 되는거죠 파일은 전부 다운로드 받았는데두요
이것을 다운로드 받으면서 끝까지 재생시킬수는 없는건가요 ㅠ
여럿 고수분들의 답변을 부탁드릴께요



