cubesoft
cubesoft

Reputation: 3550

CameraX VideoCapture use case. Access underlying AudioRecord object to display voice visualization

I need to display input audio level graph for pending video recording. I am using CameraX SDK and VideoCapture use case. Is it possible to access such a low level API for video recording?

Upvotes: 0

Views: 424

Answers (2)

Pablo Martinez
Pablo Martinez

Reputation: 1639

When you start recording in camerax 1.3.0 you can receive different events. One of them is VideoRecordEvent.Status where it contains audioamplitude

val pendingRecording = recorder.prepareRecording(activity, options).withAudioEnabled()

pendingRecording.start(cameraExecutor) { event ->
  when (event) {
     is VideoRecordEvent.Status -> {
      event.recordingStats.audioStats.audioAmplitude
     }
  }
}

Upvotes: 0

ToMaTo_0
ToMaTo_0

Reputation: 26

Probably not, at least I didn't find any options to do it

I have same problem as u, to resolve it I use camera2 and MediaRecorder U can use MediaRecorder.maxAmplitude to get info about "volume"

Also u can try this, but anyway u need to use MediaRecorder There is also spoken about reflection, but I didn't got how to get volume in that way

If u find how to do it with cameraX, please comment me

Upvotes: 1

Related Questions