androidx / androidx/media

Media3 Transformer: Support `mediaStoreOutputOptions ` when calling `transformer.start()`

Open
#504 7 comments 1 reaction 1 assignee View on GitHub

Nobody has claimed this yet.

editing enhancement
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

When working with Media3 Transformer, a transformation on a video is started by transformer.start(editedMediaItem, outputPath), but it would be more convenient if transformer.start() was also able to take in MediaStoreOutputOptions instead of a String outputPath.

This would be similar to how CameraX starts video recordings (https://developer.android.com/training/camerax/video-capture#configure-and-create-recording):

// Create MediaStoreOutputOptions for our recorder
val name = "CameraX-recording-" +
        SimpleDateFormat(FILENAME_FORMAT, Locale.US)
                .format(System.currentTimeMillis()) + ".mp4"
val contentValues = ContentValues().apply {
   put(MediaStore.Video.Media.DISPLAY_NAME, name)
}
val mediaStoreOutput = MediaStoreOutputOptions.Builder(this.contentResolver,
                              MediaStore.Video.Media.EXTERNAL_CONTENT_URI)
                              .setContentValues(contentValues)
                              .build()

// 2. Configure Recorder and Start recording to the mediaStoreOutput.
val recording = videoCapture.output
                .prepareRecording(context, mediaStoreOutput)
                .withAudioEnabled()
                .start(ContextCompat.getMainExecutor(this), captureListener)

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 into MediaStore so that the newly created file is also stored with the other media items of the app?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.