Skip to content

Invalid after MediaStoreOutputOptions is set #542

Description

@PeOS-China

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}")
                }

        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions