设备状态界面机器人实时轨迹

This commit is contained in:
mmc
2026-06-15 13:57:41 +08:00
parent 3fd82e2fd9
commit 1b0890eaab
6 changed files with 22 additions and 10 deletions

View File

@@ -0,0 +1,50 @@
import React, { useState, useEffect } from 'react';
import Empty from './Empty';
import VideoCanvas from './VideoCanvas';
interface VideoPlayerProps {
deviceId: string;
idx: number;
title?: string;
className?: string;
noCrop?: boolean;
video?: HTMLVideoElement;
error?: boolean;
ready?: boolean;
}
const VideoPlayer: React.FC<VideoPlayerProps> = ({
deviceId,
idx,
title,
className = '',
noCrop,
video, error, ready
}) => {
const viewTitles = ['前视图', '后视图', '左视图', '右视图'];
const currentTitle = title || viewTitles[idx - 1];
if (!deviceId || error) {
return <Empty message="视频源连接失败" />;
}
if (!ready || !video) {
return <Empty message="视频加载中..." />;
}
return (
<VideoCanvas
key={`canvas-${deviceId}-${idx}`}
video={video}
idx={idx}
title={currentTitle}
className={className}
noCrop={noCrop}
/>
);
};
export default VideoPlayer;