mirror of
https://github.com/azaion/ui.git
synced 2026-04-22 23:56:34 +00:00
add stop button
This commit is contained in:
Generated
+9
@@ -18,6 +18,7 @@
|
|||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
"react-dropzone": "^14.3.8",
|
"react-dropzone": "^14.3.8",
|
||||||
|
"react-icons": "^5.5.0",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"web-vitals": "^2.1.4"
|
"web-vitals": "^2.1.4"
|
||||||
}
|
}
|
||||||
@@ -14371,6 +14372,14 @@
|
|||||||
"integrity": "sha512-SN/U6Ytxf1QGkw/9ve5Y+NxBbZM6Ht95tuXNMKs8EJyFa/Vy/+Co3stop3KBHARfn/giv+Lj1uUnTfOJ3moFEQ==",
|
"integrity": "sha512-SN/U6Ytxf1QGkw/9ve5Y+NxBbZM6Ht95tuXNMKs8EJyFa/Vy/+Co3stop3KBHARfn/giv+Lj1uUnTfOJ3moFEQ==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/react-icons": {
|
||||||
|
"version": "5.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-icons/-/react-icons-5.5.0.tgz",
|
||||||
|
"integrity": "sha512-MEFcXdkP3dLo8uumGI5xN3lDFNsRtrjbOEKDLD7yv76v4wpnEq2Lt2qeHaQOr34I/wPN3s3+N08WkQ+CW37Xiw==",
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/react-is": {
|
"node_modules/react-is": {
|
||||||
"version": "17.0.2",
|
"version": "17.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
"react-dropzone": "^14.3.8",
|
"react-dropzone": "^14.3.8",
|
||||||
|
"react-icons": "^5.5.0",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"web-vitals": "^2.1.4"
|
"web-vitals": "^2.1.4"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.control-btn {
|
.control-btn {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
padding: 10px 20px;
|
padding: 10px 20px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
margin: 0 5px;
|
margin: 0 5px;
|
||||||
@@ -41,6 +44,10 @@
|
|||||||
background: #e0e0e0;
|
background: #e0e0e0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.stop-btn {
|
||||||
|
background: #e8a1a5;
|
||||||
|
}
|
||||||
|
|
||||||
.save-btn {
|
.save-btn {
|
||||||
background: #8ad4ff;
|
background: #8ad4ff;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,18 @@
|
|||||||
import { Slider } from '@mui/material';
|
import { Slider } from '@mui/material';
|
||||||
|
import { FaStop } from "react-icons/fa";
|
||||||
import './AnnotationControls.css';
|
import './AnnotationControls.css';
|
||||||
|
|
||||||
function AnnotationControls({ videoRef, currentTime, setCurrentTime, onFrameBackward, onPlayPause, isPlaying, onFrameForward, onSaveAnnotation, onDelete }) {
|
function AnnotationControls({
|
||||||
|
videoRef,
|
||||||
|
currentTime,
|
||||||
|
setCurrentTime,
|
||||||
|
onFrameBackward,
|
||||||
|
onPlayPause, isPlaying,
|
||||||
|
onFrameForward,
|
||||||
|
onSaveAnnotation,
|
||||||
|
onStop,
|
||||||
|
onDelete
|
||||||
|
}) {
|
||||||
|
|
||||||
function formatDuration(value) {
|
function formatDuration(value) {
|
||||||
if (Number.isNaN(value)) {
|
if (Number.isNaN(value)) {
|
||||||
@@ -57,6 +68,13 @@ function AnnotationControls({ videoRef, currentTime, setCurrentTime, onFrameBack
|
|||||||
>
|
>
|
||||||
⏭️
|
⏭️
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
className='control-btn stop-btn'
|
||||||
|
onClick={onStop}
|
||||||
|
title='Stop'
|
||||||
|
>
|
||||||
|
<FaStop /> Stop
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
className='control-btn save-btn'
|
className='control-btn save-btn'
|
||||||
onClick={onSaveAnnotation}
|
onClick={onSaveAnnotation}
|
||||||
|
|||||||
@@ -131,6 +131,11 @@ function AnnotationMain() {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleStop = () => {
|
||||||
|
setIsPlaying(prev => !prev);
|
||||||
|
setCurrentTime(0);
|
||||||
|
};
|
||||||
|
|
||||||
const handleFrameForward = () => {
|
const handleFrameForward = () => {
|
||||||
if (videoRef.current) {
|
if (videoRef.current) {
|
||||||
videoRef.current.currentTime += 1 / 30;
|
videoRef.current.currentTime += 1 / 30;
|
||||||
@@ -220,6 +225,7 @@ function AnnotationMain() {
|
|||||||
isPlaying={isPlaying}
|
isPlaying={isPlaying}
|
||||||
onFrameForward={handleFrameForward}
|
onFrameForward={handleFrameForward}
|
||||||
onSaveAnnotation={handleAnnotationSave}
|
onSaveAnnotation={handleAnnotationSave}
|
||||||
|
onStop={handleStop}
|
||||||
onDelete={handleDelete}
|
onDelete={handleDelete}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user