最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ios - Cannot get expo-audio (newer audio library) metering property at all - Stack Overflow

programmeradmin0浏览0评论

I am creating an Expo, react-native application that records your audio as an audio file.

I'm having problems getting the 'metering' property from the RecorderState, which is preventing my implementation of monitoring if a user is speaking or not.

Here is a snippet of my audio recorder & monitoring function:

const audioRecorder = useAudioRecorder(RecordingPresets.HIGH_QUALITY);
const startMonitoring = () => {
    if (!isMonitoringRef.current) return;
    console.log('Starting monitoring, timestamp:', Date.now());
    intervalRef.current = setInterval(async () => {
      const metering = audioRecorder.metering ?? -50;
      console.log('Metering raw value:', metering, 'isRecording:', audioRecorder.isRecording, 'timestamp:', Date.now()); // Fixed typo
      // Silence detection bypassed; stop via mic press
    }, 100);
  };

Basically, the audio.Recorder.metering is null, although the Recorder successfully records the audio. I know this is true because I am successfully able to transcribe the audio using the audio captured from Recorder.

I know with expo-av, I was able to capture the meter property, but I had to move on from expo-av library due to some other issues with it.

Anyone else have a similar issue and possibly have a fix/advice for it?

发布评论

评论列表(0)

  1. 暂无评论