fix #2565, try fixing the video editor
This commit is contained in:
parent
41697d6a46
commit
997f7e3ba8
1 changed files with 13 additions and 18 deletions
|
@ -36,7 +36,6 @@ import ly.img.android.pesdk.ui.panels.item.PersonalStickerAddItem
|
|||
import ly.img.android.pesdk.ui.panels.item.ToggleAspectItem
|
||||
import java.io.File
|
||||
import java.io.InputStream
|
||||
import java.io.OutputStream
|
||||
|
||||
class NewVideoEditActivity : SimpleActivity() {
|
||||
private val VESDK_EDIT_VIDEO = 1
|
||||
|
@ -107,6 +106,7 @@ class NewVideoEditActivity : SimpleActivity() {
|
|||
val extras = resultData?.extras
|
||||
val resultPath = extras?.get(RESULT_URI)?.toString() ?: ""
|
||||
val sourcePath = Uri.decode(extras?.get(SOURCE_URI)?.toString() ?: "")
|
||||
|
||||
val settings = extras?.getParcelable<SettingsList>(SETTINGS_LIST)
|
||||
if (settings != null) {
|
||||
val brush = settings.getSettingsModel(BrushSettings::class.java)
|
||||
|
@ -137,15 +137,14 @@ class NewVideoEditActivity : SimpleActivity() {
|
|||
sourceFileLastModified = File(source).lastModified()
|
||||
|
||||
handleFileOverwriting(destinationFilePath) {
|
||||
var inputStream: InputStream? = null
|
||||
var outputStream: OutputStream? = null
|
||||
try {
|
||||
inputStream = contentResolver.openInputStream(Uri.parse(resultPath))
|
||||
outputStream = getFileOutputStreamSync(destinationFilePath, destinationFilePath.getMimeType())
|
||||
inputStream!!.copyTo(outputStream!!)
|
||||
outputStream.flush()
|
||||
inputStream.close()
|
||||
outputStream.close()
|
||||
val inputStream = contentResolver.openInputStream(Uri.parse(resultPath))
|
||||
val outputStream = getFileOutputStreamSync(destinationFilePath, destinationFilePath.getMimeType())
|
||||
inputStream?.use {
|
||||
outputStream?.use {
|
||||
inputStream.copyTo(outputStream)
|
||||
}
|
||||
}
|
||||
|
||||
if (config.keepLastModified) {
|
||||
// add 1 s to the last modified time to properly update the thumbnail
|
||||
|
@ -153,18 +152,15 @@ class NewVideoEditActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
val paths = arrayListOf(destinationFilePath)
|
||||
rescanPaths(arrayListOf(destinationFilePath)) {
|
||||
rescanPaths(paths) {
|
||||
fixDateTaken(paths, false)
|
||||
}
|
||||
|
||||
setResult(Activity.RESULT_OK, intent)
|
||||
toast(R.string.file_edited_successfully)
|
||||
finish()
|
||||
setResult(Activity.RESULT_OK)
|
||||
toast(R.string.file_edited_successfully)
|
||||
finish()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
showErrorToast(e)
|
||||
} finally {
|
||||
inputStream?.close()
|
||||
outputStream?.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -285,7 +281,6 @@ class NewVideoEditActivity : SimpleActivity() {
|
|||
getSettingsModel(UiConfigTheme::class.java).theme = theme
|
||||
|
||||
configure<VideoEditorSaveSettings> {
|
||||
it.allowFastTrim = true
|
||||
it.allowOrientationMatrixMetadata = true
|
||||
it.setOutputToTemp()
|
||||
it.outputMode = OutputMode.EXPORT_IF_NECESSARY
|
||||
|
|
Loading…
Reference in a new issue