【问题标题】:Video not saving in DCIM folder视频未保存在 DCIM 文件夹中
【发布时间】:2014-07-17 13:47:44
【问题描述】:

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

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 文件夹中,我的视频文件已出...怎么了?

【问题讨论】:

    标签: android google-glass mediarecorder internal-storage


    【解决方案1】:

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

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

    【讨论】:

    • 是的,我要添加所有权限-
    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多