设备状态界面机器人实时轨迹
This commit is contained in:
50
src/components/VideoPlayer.tsx
Normal file
50
src/components/VideoPlayer.tsx
Normal 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;
|
||||
Reference in New Issue
Block a user