1
サーバからmp3ファイルをダウンロードしようとしています。 ファイルを正常に作成しましたが、ファイルを再生できますが、アーティスト名やアルバム名などのサムネイルやファイル情報はありません。Android AsyncTaskをダウンロードする.mp3ファイル - 情報とサムネイル
私がchromeから直接ファイルをダウンロードしているときは、上記の情報がダウンロードされます。 アイデアを得るにはどのようなアイデアですか?ここで
は私のコードです:
URL url = new URL(urlDwn+urlVid);
HttpURLConnection connection =(HttpURLConnection) url.openConnection();
connection.connect();
//file length
int lengthOfFile = connection.getContentLength();
//intput - read file
InputStream inputStream = new BufferedInputStream(url.openStream(), 8192);
//output - write file
if(true) {
System.out.println("Downloading");
OutputStream outputStream = new FileOutputStream(root+"/"+fileName);
System.out.println(root+"/"+fileName);
byte data[] = new byte[1024];
long total = 0;
while ((count = inputStream.read(data)) != -1) {
total += count;
//progress
publishProgress((int) ((total * 100)/lengthOfFile));
//writing to file
outputStream.write(data,0, count);
}
outputStream.flush();
outputStream.close();
inputStream.close();
サムネイルと情報を取得するのに問題がありますか? –
どのように取得できますか? –
あなたはそれをChrome経由でダウンロードするときに何らかの方法で取得します。 –