Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-029
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
0
Merge Requests
0
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
2023-029
2023-029
Commits
c565bb29
Commit
c565bb29
authored
Aug 27, 2023
by
Ridma Dilshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the Video detection Frontend
parent
a47e9457
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
8 deletions
+68
-8
Project/Frontend/SignConnectPlus/src/pages/emotion-detection/emotion-audio-detection/list/list.tsx
...s/emotion-detection/emotion-audio-detection/list/list.tsx
+4
-2
Project/Frontend/SignConnectPlus/src/pages/emotion-detection/emotion-video-detection/list/list.tsx
...s/emotion-detection/emotion-video-detection/list/list.tsx
+64
-6
No files found.
Project/Frontend/SignConnectPlus/src/pages/emotion-detection/emotion-audio-detection/list/list.tsx
View file @
c565bb29
...
...
@@ -3,6 +3,8 @@ import MainCard from 'components/MainCard';
import
ScrollX
from
'
components/ScrollX
'
;
import
Grid
from
'
@mui/material/Grid
'
;
import
Button
from
'
@mui/material/Button
'
;
// import KeyboardVoiceIcon from '@mui/icons-material/KeyboardVoice';
import
UploadOutlined
from
'
@ant-design/icons/lib/icons/UploadOutlined
'
;
// import MicIcon from '@mui/icons-material/Mic'; // Import MicIcon from the correct path
// import CloudUploadOutlinedIcon from '@mui/icons-material/CloudUploadOutlined'; // Import CloudUploadOutlinedIcon from the correct path
...
...
@@ -20,14 +22,14 @@ const List = () => {
<
Button
variant=
"contained"
color=
"primary"
// startIcon={<CloudUploadOutlinedIcon
/>}
startIcon=
{
<
UploadOutlined
/>
}
>
Upload
</
Button
>
<
Button
variant=
"contained"
color=
"primary"
// startIcon={<
CloudUploadOutlined
Icon />}
// startIcon={<
KeyboardVoice
Icon />}
>
Record
</
Button
>
...
...
Project/Frontend/SignConnectPlus/src/pages/emotion-detection/emotion-video-detection/list/list.tsx
View file @
c565bb29
import
React
,
{
useState
,
useRef
}
from
'
react
'
;
import
MainCard
from
'
components/MainCard
'
;
import
ScrollX
from
'
components/ScrollX
'
;
import
Grid
from
'
@mui/material/Grid
'
;
import
Button
from
'
@mui/material/Button
'
;
// import MicIcon from '@mui/icons-material/Mic'; // Import MicIcon from the correct path
// import CloudUploadOutlinedIcon from '@mui/icons-material/CloudUploadOutlined'; // Import CloudUploadOutlinedIcon from the correct path
import
VideoCameraOutlined
from
'
@ant-design/icons/lib/icons/VideoCameraOutlined
'
;
import
UploadOutlined
from
'
@ant-design/icons/lib/icons/UploadOutlined
'
;
// import WebcamOutlinedIcon from '@mui/icons-material/WebcamOutlined';
const
List
=
()
=>
{
const
[
selectedFile
,
setSelectedFile
]
=
useState
<
File
|
null
>
(
null
);
const
[
isLive
,
setIsLive
]
=
useState
(
false
);
const
fileInputRef
=
useRef
<
HTMLInputElement
|
null
>
(
null
);
const
videoRef
=
useRef
<
HTMLVideoElement
|
null
>
(
null
);
const
handleFileChange
=
(
event
:
React
.
ChangeEvent
<
HTMLInputElement
>
)
=>
{
if
(
event
.
target
.
files
&&
event
.
target
.
files
[
0
])
{
setSelectedFile
(
event
.
target
.
files
[
0
]);
}
};
const
handleUploadButtonClick
=
()
=>
{
if
(
fileInputRef
.
current
)
{
fileInputRef
.
current
.
click
();
}
};
const
handleLiveButtonClick
=
async
()
=>
{
try
{
const
stream
=
await
navigator
.
mediaDevices
.
getUserMedia
({
video
:
true
});
if
(
videoRef
.
current
)
{
videoRef
.
current
.
srcObject
=
stream
;
videoRef
.
current
.
play
();
// Start playing the live camera feed
}
setIsLive
(
true
);
}
catch
(
error
)
{
console
.
error
(
'
Error accessing camera:
'
,
error
);
}
};
return
(
<
MainCard
content=
{
false
}
>
<
ScrollX
>
...
...
@@ -16,18 +49,43 @@ const List = () => {
<
h2
>
Upload or Live
</
h2
>
<
MainCard
>
<
div
style=
{
{
textAlign
:
'
center
'
}
}
>
<
h2
>
Upload Your Files
</
h2
>
<
input
type=
"file"
accept=
"video/*"
ref=
{
fileInputRef
}
onChange=
{
handleFileChange
}
style=
{
{
display
:
'
none
'
}
}
/>
{
isLive
?
(
<
video
ref=
{
videoRef
}
autoPlay
playsInline
width=
"100%"
/>
)
:
(
selectedFile
&&
(
<
video
controls
width=
"100%"
src=
{
URL
.
createObjectURL
(
selectedFile
)
}
/>
)
)
}
<
Button
variant=
"contained"
color=
"primary"
// startIcon={<CloudUploadOutlinedIcon />}
startIcon=
{
<
UploadOutlined
/>
}
onClick=
{
handleUploadButtonClick
}
>
Upload
</
Button
>
<
Button
variant=
"contained"
color=
"primary"
// startIcon={<CloudUploadOutlinedIcon />}
startIcon=
{
<
VideoCameraOutlined
/>
}
onClick=
{
handleLiveButtonClick
}
>
Live
</
Button
>
...
...
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