-1

我正在尝试保存录制视频:

File videoFile;
File sampleDir =new File(Environment.getExternalStorageDirectory().getAbsolutePath()
                     + File.separator + "DCIM/Camera/");
try
{ 
    videoFile = File.createTempFile("ibm", ".mp4", sampleDir);
}
catch (IOException e) 
{
    Log.e(TAG,"sdcard access error");
    return;
}
Log.i(TAG,"name file: "+videoFile.getAbsolutePath());
mMediaRecorder.setOutputFile(videoFile.getAbsolutePath());

mMediaRecorder.prepare();
mMediaRecorder.start();

通话后:

mMediaRecorder.stop();
mMediaRecorder.reset();     
mMediaRecorder.release();

在 dcim 文件夹中,我的视频文件已出...怎么了?

4

2 回答 2

0

由于最新固件版本中的新错误,您可能会遇到问题,请检查http://code.google.com/p/google-glass-api/issues/detail?id=578看看是否错误与您有关。就我而言,我可以看到已创建但为空的文件。

于 2014-07-31T00:00:08.780 回答
0

您是否请求写入外部存储的权限?android.permission.WRITE_EXTERNAL_STORAGE

另一种选择是使用Context#getExternalFilesDir()代替,您应该能够使用它而无需请求写入外部存储的权限。这是 Google Glass 正在运行的 KitKat(Android 4.4,API 级别 19)中的新功能。

于 2014-07-17T13:56:47.307 回答