[英]java.io.IOException:setdatasource failed status = 0xFFF
I am trying to get duration of .amr file by using MediaMetadataRetriever.Bur Every time I use, It give me the Error. 我试图通过使用MediaMetadataRetriever.Bur来获取.amr文件的持续时间,每次使用时,它都会给我错误。 Following Is the code to calculate the Duration.
以下是用于计算持续时间的代码。 But it gives Error at SETDATASOURCE.newfile is the file i have created at runtime.
但是它在SETDATASOURCE.Newfile上给出了错误。我在运行时创建了该文件。
MediaMetadataRetriever mmr = new MediaMetadataRetriever();
mmr.setDataSource(newfile.toString());
int duration =
Integer.parseInt(mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION));
int durSec = duration;
durSec = durSec/1000;
int durHour = durSec/3600;
durSec = durSec%3600;
int durMin = durSec/60;
durSec = durSec%60;
String Time = durHour+":"+durMin+":"+durSec;
tv_duration.setText(""+Time);
mmr.release();
I don't think you want "newFile.toString()" try using java.io.File.getAbsolutePath() . 我不认为您想要“ newFile.toString()”尝试使用java.io.File.getAbsolutePath() 。 I'm not sure what "newFile" is so I'm grasping at this one.
我不确定“ newFile”是什么,因此我正在掌握这一点。 .toString() will use the method on the object which may not necessarily provide a concise path.
.toString()将在对象上使用该方法,该方法不一定提供简洁的路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.