我有一个摄像头记录的意图,当结果是好的,我尝试此视频为byte []转换为发送web服务:录像为byte []
Im做这样的:
if (resultCode == RESULT_OK) {
// Video guardado
videoUri = data.getData();
if (videoUri != null) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
FileInputStream fichero_codificar = null;
try {
fichero_codificar = new FileInputStream(
videoUri.getPath());
byte[] buf = new byte[1024];
int n;
while (-1 != (n = fichero_codificar.read(buf))) {
out.write(buf, 0, n);
}
byte[] videoByte = out.toByteArray();
strBase64 = Base64.encode(videoByte);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
但fichero_codificar =新的FileInputStream( videoUri.getPath())
logcat的说我的文件不存在,或补丁心不是propertly。
任何人都有我的问题的例子吗? 谢谢
您是否验证过videoUri实际上是一个文件(文件:前缀)而不是“content:”URI? – tiguchi