Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-J 18
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23-J 18
22_23-J 18
Commits
1d969e81
Commit
1d969e81
authored
Apr 20, 2023
by
salukadev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setup camera
parent
7c11f7cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
App/Frontend/App.js
App/Frontend/App.js
+3
-0
App/Frontend/screens/SpeechTherapyScreen.js
App/Frontend/screens/SpeechTherapyScreen.js
+27
-0
No files found.
App/Frontend/App.js
View file @
1d969e81
import
React
from
'
react
'
;
import
{
LogBox
}
from
'
react-native
'
;
LogBox
.
ignoreAllLogs
(
true
);
import
{
createStackNavigator
}
from
'
react-navigation-stack
'
;
import
{
createAppContainer
}
from
'
react-navigation
'
;
import
{
ToastProvider
}
from
'
react-native-toast-message
'
;
import
LoginScreen
from
'
./screens/LoginScreen
'
;
import
HomeScreen
from
'
./screens/HomeScreen
'
;
import
ObjectExploreScreen
from
'
./screens/ObjectExploreScreen
'
;
...
...
App/Frontend/screens/SpeechTherapyScreen.js
View file @
1d969e81
...
...
@@ -13,11 +13,14 @@ 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
'
;
import
{
Camera
}
from
'
expo-camera
'
;
import
{
useRef
}
from
'
react
'
;
const
SpeechTherapyScreen
=
({
navigation
})
=>
{
const
[
sound
,
setSound
]
=
useState
(
null
);
const
[
progress
,
setProgress
]
=
useState
(
0
);
const
[
hasPermission
,
setHasPermission
]
=
useState
(
null
);
const
text
=
"
I go to school
"
;
const
audioPath
=
'
./assets/ST/content/school_sentence.m4a
'
;
...
...
@@ -27,6 +30,7 @@ const SpeechTherapyScreen = ({ navigation }) => {
const
recordingIconPath
=
'
./assets/ST/recording_icon.png
'
;
const
[
recording
,
setRecording
]
=
useState
(
null
);
const
[
receivedText
,
setReceivedText
]
=
useState
(
''
);
const
cameraRef
=
useRef
(
null
);
const
startRecording
=
async
()
=>
{
...
...
@@ -164,6 +168,12 @@ const SpeechTherapyScreen = ({ navigation }) => {
};
},
[
recording
]);
useEffect
(()
=>
{
(
async
()
=>
{
const
{
status
}
=
await
Camera
.
requestPermissionsAsync
();
setHasPermission
(
status
===
'
granted
'
);
})();
},
[]);
const
updatePlaybackStatus
=
(
status
)
=>
{
if
(
status
.
isLoaded
)
{
...
...
@@ -214,6 +224,14 @@ const SpeechTherapyScreen = ({ navigation }) => {
{
recording
&&
<
Image
source
=
{
require
(
recordingIconPath
)}
style
=
{
styles
.
recordingIcon
}
/>
}
<
/View
>
<
/TouchableWithoutFeedback
>
{
hasPermission
&&
(
<
Camera
style
=
{
styles
.
camera
}
type
=
{
Camera
.
Constants
.
Type
.
front
}
ref
=
{
cameraRef
}
ratio
=
"
1:1
"
/>
)}
<
Toast
ref
=
{(
ref
)
=>
Toast
.
setRef
(
ref
)}
/
>
<
/View
>
);
...
...
@@ -288,6 +306,15 @@ const styles = StyleSheet.create({
fontSize
:
35
,
color
:
'
red
'
,
// Change the text color to white
},
camera
:
{
position
:
'
absolute
'
,
top
:
39
,
right
:
6
,
width
:
140
,
height
:
120
,
overflow
:
'
hidden
'
,
borderRadius
:
5
,
}
});
export
default
SpeechTherapyScreen
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment