Open calren opened 1 year ago
Thanks for the request. We will look into it. For the current implementation, we are writing data using MediaMuxer
which means it will be necessary to map onto a path or file descriptor eventually (used here).
Is there any update about this request? I set outfile path to that of Download directory instead of cache. Its not getting saved for me in latest 1.3.1 version
....
outputFile = createExternalDirectoryFile("transformer-output-" + Clock.DEFAULT.elapsedRealtime() + ".mp4")
private fun createExternalDirectoryFile(fileName: String): File {
val downloadsDirectory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
val file = File(downloadsDirectory, fileName)
check(!(file.exists() && !file.delete())) { "Could not delete the previous export output file" }
check(file.createNewFile()) { "Could not create the export output file" }
return file
}
Do I need to get storage permissions ?
Yes, you need storage permissions to save the output file. But that would also be the case even if MediaStoreOutputOptions
was used instead.
Was this working for you before the 1.3.1 version?
Yes, you need storage permissions to save the output file. But that would also be the case even if
MediaStoreOutputOptions
was used instead.Was this working for you before the 1.3.1 version?
I updated my code base yesterday to bump version to 1.3.1 (touching it after few months). Output is never saved in Downloads directory now. Previously in Dec 2023, I was able to save. Let me also double check my code as with storage permissions it was giving me permission denied error
https://github.com/hassanabidpk/Media3Sample/blob/devfest-2023/app/src/main/java/com/hassan/media3sample/TransformerActivity.kt
I was using it to demo at Devfest 2023 events.
main
Thanks for testing and reporting back, I'll see if I can reproduce.
@hassanabidpk We haven't been able to reproduce this.
Would you be able to see if it's still reproducible on the latest demo-transformer
sample with the main
branch?
When working with Media3 Transformer, a transformation on a video is started by
transformer.start(editedMediaItem, outputPath)
, but it would be more convenient iftransformer.start()
was also able to take inMediaStoreOutputOptions
instead of aString outputPath
.This would be similar to how CameraX starts video recordings (https://developer.android.com/training/camerax/video-capture#configure-and-create-recording):
If this request is not prioritized, it would be useful to know what the best way is to work with a filepath and
MediaStoreOutput
. As in, how can the app take the file path and feed that intoMediaStore
so that the newly created file is also stored with the other media items of the app?