Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 11 视频录制BUG #60

Open
liu743 opened this issue Oct 9, 2021 · 2 comments
Open

Android 11 视频录制BUG #60

liu743 opened this issue Oct 9, 2021 · 2 comments

Comments

@liu743
Copy link

liu743 commented Oct 9, 2021

没有申请访问所有文件权限,视频录制失败
E/^_^RecordHelper=============: [002] RecordHelper.getTempFilePath(RecordHelper.java:461)====================================> 文件夹创建失败:/storage/emulated/0/Record/
Android11 默认不能访问外部存储,pcm缓存文件创建不了

@zhaolewei
Copy link
Owner

是在自己项目中引入lib进行测试的吗? 可以修改下文件目录,或者对外部存储做下适配。参考:https://developer.android.com/training/data-storage/use-cases?hl=zh-cn

@liu743
Copy link
Author

liu743 commented Oct 9, 2021

使用gradle引入的
已经使用 RecordManager.getInstance().changeRecordDir(picPath);修改了文件目录
但是你内部代码
/**
* 根据当前的时间生成相应的文件名
* 实例 record_20160101_13_15_12
*/
private String getTempFilePath() {
String fileDir = String.format(Locale.getDefault(), "%s/Record/", Environment.getExternalStorageDirectory().getAbsolutePath());
if (!FileUtils.createOrExistsDir(fileDir)) {
Logger.e(TAG, "文件夹创建失败:%s", fileDir);
}
String fileName = String.format(Locale.getDefault(), "record_tmp_%s", FileUtils.getNowString(new SimpleDateFormat("yyyyMMdd_HH_mm_ss", Locale.SIMPLIFIED_CHINESE)));
return String.format(Locale.getDefault(), "%s%s.pcm", fileDir, fileName);
}
这里回去生成文件,这里失败了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants