fix recording videos on some SD cards

This commit is contained in:
tibbi 2020-04-22 09:49:08 +02:00
parent af049de119
commit 7c0924b2fd
2 changed files with 5 additions and 2 deletions

View File

@ -57,5 +57,5 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.26.18'
implementation 'com.simplemobiletools:commons:5.26.19'
}

View File

@ -773,7 +773,10 @@ class CameraPreview : ViewGroup, TextureView.SurfaceTextureListener, MyPreview {
val videoSize = getCurrentResolution()
mLastVideoPath = mActivity.getOutputMediaFile(false)
val uri = if (context.isPathOnSD(mLastVideoPath)) {
context.getDocumentFile(mLastVideoPath.getParentPath())?.createFile("video/mp4", mLastVideoPath.getFilenameFromPath())!!.uri
val parentDocumentFile = context.getDocumentFile(mLastVideoPath.getParentPath())
val documentFile = parentDocumentFile?.createFile("video/mp4", mLastVideoPath.getFilenameFromPath())
?: mActivity.getDocumentFile(mLastVideoPath)
documentFile!!.uri
} else {
Uri.fromFile(File(mLastVideoPath))
}