+
+
+ ##### Constructor
+ |
+
+
+ Creates new instance of the AudioRecorder. It is preferred to create only a single instance of the AudioRecorder class for the best performance, memory and battery consumption reasons. While idle recorder has minimal impact on anything mentioned, switching between separate recorder instances might have an noticeable impact on the device.
+
+ ```tsx
+ import { AudioRecorder } from 'react-native-audio-api';
+
+ const audioRecorder = new AudioRecorder();
+ ```
+ |
+
+
+
+ ##### start
+ |
+
+
+ Starts the stream of system audio input device.
+
+ ```tsx
+ const result = audioRecorder.start();
+
+ if (result.status === 'success') {
+ const openedFilePath = result.path;
+ } else if (result.status === 'error') {
+ console.error(result.message);
+ }
+ ```
+ |
+
+
+
+
+ ##### stop
+ |
+
+
+ Stops the input stream and cleans up each input access method.
+
+ ```tsx
+ const result = audioRecorder.stop();
+
+ if (result.status === 'success') {
+ const { path, duration, size } = result;
+ } else if (result.status === 'error') {
+ console.error(result.message);
+ }
+ ```
+ |
+
+
+
+
+ ##### pause
+ |
+
+
+ Pauses the recording. This is useful when recording to file is active, but you don't want to finalize the file.
+
+ ```tsx
+ audioRecorder.pause();
+ ```
+ |
+
+
+
+
+ ##### resume
+ |
+
+
+ Resumes the recording if it was previously paused, otherwise does nothing.
+
+ ```tsx
+ audioRecorder.resume();
+ ```
+ |
+
+
+
+
+ ##### isRecording
+ |
+
+
+ Returns `true` if recorder is in active/recording state
+
+ ```tsx
+ const isRecording = audioRecorder.isRecording();
+ ```
+ |
+
+
+
+
+ ##### isPaused
+ |
+
+
+ Returns `true` if recorder is in paused state.
+
+ ```tsx
+ const isPaused = audioRecorder.isPaused();
+ ```
+ |
+
+
+
+
+ ##### onError
+ |
+
+
+ Sets an error callback for any possible internal error that might happen during file writing, callback invocation or adapter access.
+
+ for details check: [OnRecorderErrorEventType](#onrecordererroreventtype)
+
+ ```tsx
+ audioRecorder.onError((error: OnRecorderErrorEventType) => {
+ console.log(error);
+ });
+ ```
+ |
+
+
+
+
+ ##### clearOnError
+ |
+
+
+ Removes the error callback.
+
+ ```tsx
+ audioRecorder.clearOnError();
+ ```
+ |
+
+
+