react-native-audio-recorder-player icon indicating copy to clipboard operation
react-native-audio-recorder-player copied to clipboard

setVolume occurs error in iOS

Open cleandevcode opened this issue 3 years ago • 3 comments

Version of react-native-audio-recorder-player

^3.5.0 and 3.3.4

Version of React Native

0.68.1

Platforms you faced the error (IOS or Android or both?)

iOS

Expected behavior

I tried to record sound using this library but the recorded sound volume was so low. So I tried to set volume 1.0 manually this way.

const startRecording = async () => {
const audioSet: AudioSet = {
  AVFormatIDKeyIOS: AVEncodingOption.aac,
  AVNumberOfCHannelsKeyIOS: 2,
  AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.max,
  AVModeIOS: AVModeIOSOption.measurement
}
await recordingObj.startRecorder(undefined, audioSet);
await recording.setVolume(1.0); //here

}

Actual behavior

By the way, when trying to run on the real device (iOS 15.4.1), then it occurs error from swift code. It was only compiled successfully without setVolume function.

fatal error unexpectedly found nil while implicitly unwrapping an optional value image

Regards,

cleandevcode avatar May 20 '22 08:05 cleandevcode

Currently, the volume should be set after playing audio. I think this is a good issue though. I'll think about this.

hyochan avatar May 28 '22 13:05 hyochan

@hyochan i am facing the same issue, any update on this?

AlkanV avatar Aug 23 '22 07:08 AlkanV

@hyochan hello, we have put the rule if audio is not playing, we have disabled setting the volume. however this is not the user experience which audio player users of mobile devices used to use. so is there any way for us to 'fool the system' which would help us to setVolume even if an user is not playing audio.

AlkanV avatar Sep 27 '22 14:09 AlkanV