forked from 77media/video-flow
Merge branch 'dev' of https://git.qikongjian.com/77media/video-flow into dev
This commit is contained in:
commit
320dc7bc21
@ -45,6 +45,7 @@ type Props = {
|
|||||||
videoSrc?: string;
|
videoSrc?: string;
|
||||||
detections: PersonDetection[];
|
detections: PersonDetection[];
|
||||||
triggerScan: boolean;
|
triggerScan: boolean;
|
||||||
|
triggerSuccess: boolean;
|
||||||
onScanStart?: (currentTime?: number) => void;
|
onScanStart?: (currentTime?: number) => void;
|
||||||
onScanTimeout?: () => void;
|
onScanTimeout?: () => void;
|
||||||
onScanExit?: () => void; // 扫描退出回调
|
onScanExit?: () => void; // 扫描退出回调
|
||||||
@ -59,6 +60,7 @@ export const PersonDetectionScene: React.FC<Props> = ({
|
|||||||
videoSrc,
|
videoSrc,
|
||||||
detections,
|
detections,
|
||||||
triggerScan,
|
triggerScan,
|
||||||
|
triggerSuccess,
|
||||||
onScanStart,
|
onScanStart,
|
||||||
onScanTimeout,
|
onScanTimeout,
|
||||||
onScanExit,
|
onScanExit,
|
||||||
@ -375,8 +377,8 @@ export const PersonDetectionScene: React.FC<Props> = ({
|
|||||||
|
|
||||||
{/* 人物识别框和浮签 */}
|
{/* 人物识别框和浮签 */}
|
||||||
<AnimatePresence>
|
<AnimatePresence>
|
||||||
{detections.length === 0 && (
|
{detections.length === 0 && triggerSuccess && (
|
||||||
<div className="absolute inset-0 flex items-center justify-center">
|
<div className="absolute inset-0 flex items-center justify-center bg-black/40 backdrop-blur-sm">
|
||||||
<span className="text-white text-sm">未识别出人像</span>
|
<span className="text-white text-sm">未识别出人像</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -37,7 +37,7 @@ export function ShotTabContent({
|
|||||||
const [selectedIndex, setSelectedIndex] = useState(currentSketchIndex);
|
const [selectedIndex, setSelectedIndex] = useState(currentSketchIndex);
|
||||||
|
|
||||||
const [detections, setDetections] = useState<PersonDetection[]>([]);
|
const [detections, setDetections] = useState<PersonDetection[]>([]);
|
||||||
const [scanState, setScanState] = useState<'idle' | 'scanning' | 'detected'>('idle');
|
const [scanState, setScanState] = useState<'idle' | 'scanning' | 'detected' | 'failed' | 'timeout'>('idle');
|
||||||
const [isScanFailed, setIsScanFailed] = useState(false);
|
const [isScanFailed, setIsScanFailed] = useState(false);
|
||||||
const [isLoadingLibrary, setIsLoadingLibrary] = useState(false);
|
const [isLoadingLibrary, setIsLoadingLibrary] = useState(false);
|
||||||
const [isReplaceLibraryOpen, setIsReplaceLibraryOpen] = useState(false);
|
const [isReplaceLibraryOpen, setIsReplaceLibraryOpen] = useState(false);
|
||||||
@ -82,10 +82,10 @@ export function ShotTabContent({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理扫描超时/失败
|
// 处理扫描超时
|
||||||
const handleScanTimeout = () => {
|
const handleScanTimeout = () => {
|
||||||
setIsScanFailed(true);
|
setIsScanFailed(true);
|
||||||
setScanState('detected');
|
setScanState('timeout');
|
||||||
setDetections([]);
|
setDetections([]);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -97,9 +97,10 @@ export function ShotTabContent({
|
|||||||
|
|
||||||
// 处理检测到结果
|
// 处理检测到结果
|
||||||
const handleDetectionsChange = (newDetections: PersonDetection[]) => {
|
const handleDetectionsChange = (newDetections: PersonDetection[]) => {
|
||||||
if (newDetections.length > 0 && scanState === 'scanning') {
|
// console.log('handleDetectionsChange', newDetections);
|
||||||
setScanState('detected');
|
// if (newDetections.length > 0 && scanState === 'scanning') {
|
||||||
}
|
// setScanState('detected');
|
||||||
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理人物点击 打开角色库
|
// 处理人物点击 打开角色库
|
||||||
@ -317,6 +318,7 @@ export function ShotTabContent({
|
|||||||
videoSrc={shotData[selectedIndex]?.videoUrl[0]}
|
videoSrc={shotData[selectedIndex]?.videoUrl[0]}
|
||||||
detections={detections}
|
detections={detections}
|
||||||
triggerScan={scanState === 'scanning'}
|
triggerScan={scanState === 'scanning'}
|
||||||
|
triggerSuccess={scanState === 'detected'}
|
||||||
onScanTimeout={handleScanTimeout}
|
onScanTimeout={handleScanTimeout}
|
||||||
onScanExit={handleScanExit}
|
onScanExit={handleScanExit}
|
||||||
onDetectionsChange={handleDetectionsChange}
|
onDetectionsChange={handleDetectionsChange}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user