diff --git a/src/components/AgrtcRoomRobot.tsx b/src/components/AgrtcRoomRobot.tsx index 92d0c3e..a473d79 100644 --- a/src/components/AgrtcRoomRobot.tsx +++ b/src/components/AgrtcRoomRobot.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useRef, useState } from "react"; import AgoraRTC, { IAgoraRTCClient, IRemoteVideoTrack } from "agora-rtc-sdk-ng"; -import { Card, Badge, message, Space } from "antd"; +import { Badge, message } from "antd"; const APP_ID = "875f6494d87548e783fefbf33f598c97"; const TOKEN = "007eJxTYIjPuZr09PC0znd6+z0MMyL6ZHb68OetXW+kO1vHU2ZNtYECg4W5aZqZiaVJCpBhYpFqbmGclpqWlGZsnGZqaZFsaT6pZH5WQyAjA7e+LysjAwSC+JwMxmYlqcUlugZGDAwAbuYeJg=="; @@ -195,23 +195,25 @@ export default function AgrtcRoomRobot({ CHANNEL }) { c.leave(); clientRef.current = null; }; - }, [uid]); + }, [uid, CHANNEL]); return ( - - -
当前 UID:{uid}
- - +
+
+ + -
-

远端视频(上位机画面)

-
-
- - + 频道:{CHANNEL} +
+
+
); } diff --git a/src/components/devices/DeviceOverviewPage.tsx b/src/components/devices/DeviceOverviewPage.tsx index 88afea9..287b91a 100644 --- a/src/components/devices/DeviceOverviewPage.tsx +++ b/src/components/devices/DeviceOverviewPage.tsx @@ -17,15 +17,13 @@ import { } from '@ant-design/icons'; import { useNavigate } from 'react-router-dom'; -// 组件内 - - - import DroneLivePlayer from '../VolcRtcPlayer.jsx'; import DroneVideoPlayer from './DroneVideoPlayer'; import AgoraTextTest from '../AgoraRtc.tsx'; import { useWebRTCPlayer } from '../useWebRTCStream.tsx'; import VideoPlayer from '../VideoPlayer.tsx'; + +import AgrtcRoomRobot from '../AgrtcRoomRobot'; import CesiumMap from '../Map.jsx'; import DeviceParamModal from './DeviceParamModal'; import { getUAVState, getSiteDevice, getSiteUAVList, getsinglePlan, getRobotTaskList, getDeviceTotalData, updateDeviceAliasApi, hasPermission } from '@/api/device.ts'; @@ -423,7 +421,7 @@ export default function DeviceOverviewPage() { // 机器人视频 // 机器人视频:只有 robotPlayActive = true 才真正拉流 const { video: robotVideo, error, ready } = useWebRTCPlayer( - (!isUAV && robotPlayActive) ? (selectedDevice?.serialNumber || '') : '', + (!isUAV && robotPlayActive && !selectedDevice?.hasHost) ? (selectedDevice?.serialNumber || '') : '', (!isUAV && robotPlayActive) ? `webrtc://1.95.137.212/live/livestream/${selectedDevice?.serialNumber}` : '' @@ -878,7 +876,11 @@ export default function DeviceOverviewPage() { /> ) : ( robotPlayActive ? ( - robotVideo ? ( + selectedDevice?.hasHost ? ( +
+ +
+ ) : robotVideo ? ( state.user); @@ -406,13 +408,14 @@ export default function DeviceStatusPage() { ? base : { ...base, + ...device?.locationMessage, ...wsDeviceInfo, ...locationInfo }; }, [device, wsDeviceInfo, isUAV, locationInfo]); const { video: robotVideo, error, ready } = useWebRTCPlayer( - (!isUAV && isVideoPlaying) ? (device?.serialNumber || '') : '', + (!isUAV && isVideoPlaying && !device?.hasHost) ? (device?.serialNumber || '') : '', (!isUAV && isVideoPlaying) ? `webrtc://1.95.137.212/live/livestream/${device?.serialNumber}` : '' @@ -1219,25 +1222,41 @@ export default function DeviceStatusPage() { {/* 视频层:停止时不渲染 / 未播放时为空,不影响状态面板 */} - {robotVideo && isVideoPlaying && ( + {isVideoPlaying && ( mowerView === 'all' ? ( -
- + robotVideo ? ( +
+ +
+ ) : null + ) : mowerView === 'front' ? ( +
+ {device?.hasHost ? ( + + ) : robotVideo ? ( + + ) : null}
) : (
)} - {/* 单视频(非全景)模式状态叠加层:始终渲染,和视频层解耦 */} {mowerView !== 'all' && (