Commit 7c11f7cb authored by salukadev's avatar salukadev

show debug msg for audio

parent 95c5b194
......@@ -28,6 +28,7 @@
"react-native-screens": "~3.20.0",
"react-native-svg": "13.4.0",
"react-native-swiper": "^1.6.0",
"react-native-toast-message": "^2.1.6",
"react-navigation": "^4.4.4",
"react-navigation-stack": "^2.10.4"
},
......@@ -12866,6 +12867,15 @@
"prop-types": "^15.5.10"
}
},
"node_modules/react-native-toast-message": {
"version": "2.1.6",
"resolved": "https://registry.npmjs.org/react-native-toast-message/-/react-native-toast-message-2.1.6.tgz",
"integrity": "sha512-VctXuq20vmRa9AE13acaNZhrLcS3FaBS2zEevS3+vhBsnVZYG0FIlWIis9tVnpnNxUb3ART+BWtwQjzSttXTng==",
"peerDependencies": {
"react": "*",
"react-native": "*"
}
},
"node_modules/react-native-windows": {
"version": "0.71.6",
"resolved": "https://registry.npmjs.org/react-native-windows/-/react-native-windows-0.71.6.tgz",
......@@ -24943,6 +24953,12 @@
"prop-types": "^15.5.10"
}
},
"react-native-toast-message": {
"version": "2.1.6",
"resolved": "https://registry.npmjs.org/react-native-toast-message/-/react-native-toast-message-2.1.6.tgz",
"integrity": "sha512-VctXuq20vmRa9AE13acaNZhrLcS3FaBS2zEevS3+vhBsnVZYG0FIlWIis9tVnpnNxUb3ART+BWtwQjzSttXTng==",
"requires": {}
},
"react-native-windows": {
"version": "0.71.6",
"resolved": "https://registry.npmjs.org/react-native-windows/-/react-native-windows-0.71.6.tgz",
......@@ -15,6 +15,7 @@
"axios": "^1.3.6",
"expo": "~48.0.9",
"expo-av": "~13.2.1",
"expo-camera": "~13.2.1",
"expo-file-system": "~15.2.2",
"expo-screen-orientation": "~5.1.1",
"expo-status-bar": "~1.4.4",
......@@ -29,6 +30,7 @@
"react-native-screens": "~3.20.0",
"react-native-svg": "13.4.0",
"react-native-swiper": "^1.6.0",
"react-native-toast-message": "^2.1.6",
"react-navigation": "^4.4.4",
"react-navigation-stack": "^2.10.4"
},
......
......@@ -12,6 +12,7 @@ import { Audio } from 'expo-av';
import * as ScreenOrientation from 'expo-screen-orientation';
import * as FileSystem from 'expo-file-system';
import axios from 'axios';
import Toast from 'react-native-toast-message';
const SpeechTherapyScreen = ({ navigation }) => {
......@@ -25,6 +26,7 @@ const SpeechTherapyScreen = ({ navigation }) => {
const owlPath = './assets/ST/owl.png';
const recordingIconPath = './assets/ST/recording_icon.png';
const [recording, setRecording] = useState(null);
const [receivedText, setReceivedText] = useState('');
const startRecording = async () => {
......@@ -80,13 +82,22 @@ const SpeechTherapyScreen = ({ navigation }) => {
name: 'recording.mp3', // Replace with 'recording.m4a' if using iOS
});
const response = await axios.post('http://192.168.10.243:5000/api/upload-audio', formData, {
const response = await axios.post('http://192.168.1.42:5000/api/upload-audio', formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
});
console.log('Audio sent:', response.data);
//setReceivedText(response.data); // Update the receivedText state
// Show the toast message
Toast.show({
type: 'success',
text1: response.data,
autoHide: true,
visibilityTime: 4000,
});
} catch (error) {
console.error('Error while sending audio:', error);
}
......@@ -203,7 +214,7 @@ const SpeechTherapyScreen = ({ navigation }) => {
{recording && <Image source={require(recordingIconPath)} style={styles.recordingIcon} />}
</View>
</TouchableWithoutFeedback>
<Toast ref={(ref) => Toast.setRef(ref)} />
</View>
);
......@@ -263,7 +274,20 @@ const styles = StyleSheet.create({
right: 22,
width:45,
height: 45,
}
},
rreceivedTextContainer: {
position: 'absolute',
bottom: 0,
paddingHorizontal: 10,
paddingVertical: 5,
alignItems: 'center',
justifyContent: 'center',
// backgroundColor: 'rgba(0, 0, 0, 0.6)', // Remove this line
},
receivedText: {
fontSize:35,
color: 'red', // Change the text color to white
},
});
export default SpeechTherapyScreen;
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment