android / android/camera-samples

Invalid after MediaStoreOutputOptions is set

Open
#542 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
5.5k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

The format MP4 and name of the captured video are set through MediaStoreOutputOptions, but the format of the video captured by CameraX is 3gp, and it is not the name of the setting
My Android system is AndroidP, SDK is 28,CameraX Version is 1.2.2
*************************************************************************************
```
videoCapture?.let { vc ->
val name = "Video_${System.currentTimeMillis()}.mp4"
val contentValues = ContentValues().apply {
put(MediaStore.Video.Media.DISPLAY_NAME, name)
put(MediaStore.MediaColumns.MIME_TYPE, "video/mp4")
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
put(MediaStore.Video.Media.RELATIVE_PATH, "Movies/Videos")
}
}
val mediaStoreOutput = MediaStoreOutputOptions.Builder(
requireActivity().contentResolver, MediaStore.Video.Media.EXTERNAL_CONTENT_URI
)
.setContentValues(contentValues)
.build()

recording = vc.output
.prepareRecording(requireContext(), mediaStoreOutput)
.withAudioEnabled()
.start(
ContextCompat.getMainExecutor(requireContext())
) {
Logger.d("testCamera", "camera recording event: ${it.recordingStats}")
}

}
```

Contributor guide

Open the contributing guide

Research direction

Start with the MediaStoreOutputOptions and videoCapture output flow shown in the issue, then reproduce it on Android P with CameraX 1.2.2 using the provided ContentValues. Check the resulting video format and display name; done means determining why the configured MP4 type and name are not reflected, or documenting the limitation if the behavior is expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.