无人机摄像头封装成功
This commit is contained in:
@@ -34,8 +34,7 @@ import {
|
||||
} from '@ant-design/icons';
|
||||
|
||||
import XboxController from './XboxController';
|
||||
import DroneLivePlayer from '../VolcRtcPlayer.jsx';
|
||||
import { getLiveStream } from '../../api/device.ts';
|
||||
import DroneVideoPlayer from './DroneVideoPlayer';
|
||||
import CesiumMap from '../Map.jsx';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { RootState } from '@/src/store/index.ts';
|
||||
@@ -59,7 +58,6 @@ export default function DeviceStatusPage({
|
||||
|
||||
const controllerRef = useRef<DeviceController | null>(null);
|
||||
|
||||
const [planeVideo, setPlaneVideo] = useState([]);
|
||||
const [isControlled, setIsControlled] = useState(false);
|
||||
const [hasControlRight, setHasControlRight] = useState(false);
|
||||
const [connecting, setConnecting] = useState(false);
|
||||
@@ -146,36 +144,6 @@ export default function DeviceStatusPage({
|
||||
controllerRef.current.connectDevice(device);
|
||||
}, [device]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!device?.gateway_sn) {
|
||||
setPlaneVideo([]);
|
||||
return;
|
||||
}
|
||||
|
||||
const loadVideo = async () => {
|
||||
try {
|
||||
const data = {
|
||||
getway_sn: device.gateway_sn,
|
||||
drone_sn: device.device_sn,
|
||||
getway_camera_list: device.gateway_camera_list ?? [],
|
||||
drone_camera_list: device.drone_camera_list ?? [],
|
||||
video_expire: 7200,
|
||||
quality_type: 'adaptive',
|
||||
};
|
||||
|
||||
const res = await getLiveStream(data);
|
||||
|
||||
if (res.code === 200) {
|
||||
setPlaneVideo(res.data || []);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
};
|
||||
|
||||
loadVideo();
|
||||
}, [device]);
|
||||
|
||||
const mapDevices = useMemo(() => {
|
||||
if (!device) return [];
|
||||
|
||||
@@ -328,24 +296,12 @@ export default function DeviceStatusPage({
|
||||
}}
|
||||
>
|
||||
{isUAV ? (
|
||||
planeVideo.length > 0 ? (
|
||||
planeVideo.map((s, i) => (
|
||||
<div
|
||||
key={i}
|
||||
style={{
|
||||
position: 'relative',
|
||||
flex: 1,
|
||||
height: '100%',
|
||||
}}
|
||||
>
|
||||
<DroneLivePlayer streamData={s} />
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<div style={{ color: '#ccc', margin: 'auto' }}>
|
||||
暂无视频
|
||||
</div>
|
||||
)
|
||||
<DroneVideoPlayer
|
||||
device={device}
|
||||
height={450}
|
||||
showSourceSelect={true}
|
||||
defaultSource="drone"
|
||||
/>
|
||||
) : robotVideo ? (
|
||||
// 全景模式 = 4 分屏
|
||||
mowerView === 'all' ? (
|
||||
|
||||
Reference in New Issue
Block a user