Please fill the template to help you out. Also, please try the Example project compare before submiting the issue when you have certain issue with your project setup.
It should start recording, but throws this error: index.ts:243 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'startRecorder')
app.js
import React from 'react';
import { View, TouchableOpacity, Text} from 'react-native';
import AudioRecorderPlayer from 'react-native-audio-recorder-player';
const audioRecorderPlayer = new AudioRecorderPlayer();
Platforms: Android and web
It should start recording, but throws this error: index.ts:243 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'startRecorder')
app.js import React from 'react'; import { View, TouchableOpacity, Text} from 'react-native'; import AudioRecorderPlayer from 'react-native-audio-recorder-player';
const audioRecorderPlayer = new AudioRecorderPlayer();
export default function App(){ audioRecorderPlayer?console.log(audioRecorderPlayer):console.log('False') const onStartRecord = async () => { await audioRecorderPlayer.startRecorder(); audioRecorderPlayer.addRecordBackListener(e => { console.log('Recording . . . ', e.current_position); return; }); };
const onStopRecord = async () => { const audio = await audioRecorderPlayer.stopRecorder(); audioRecorderPlayer.removeRecordBackListener(); };
return ( <View style={{flex: 1, justifyContent: 'center', alignItems: 'space-between'}}>
); };
package.json
{ "name": "voice-recorder", "version": "1.0.0", "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web" }, "dependencies": { "@expo/webpack-config": "^18.1.1", "axios": "^1.4.0", "cors": "^2.8.5", "expo": "~48.0.18", "expo-av": "~13.2.1", "expo-file-system": "~15.2.2", "expo-status-bar": "~1.4.4", "express": "^4.18.2", "jsonwebtoken": "^9.0.1", "mongoose": "^7.3.4", "morgan": "^1.10.0", "multer": "^1.4.5-lts.1", "network": "^0.6.1", "nodemon": "^3.0.1", "path": "^0.12.7", "react": "18.2.0", "react-dom": "18.2.0", "react-native": "0.71.8", "react-native-audio-recorder-player": "^3.5.3", "react-native-web": "~0.18.10" }, "devDependencies": { "@babel/core": "^7.20.0" }, "private": true }