根据hashost字段 显示 视频
This commit is contained in:
@@ -53,6 +53,7 @@ import { useSelector } from 'react-redux';
|
||||
import { RootState } from '@/src/store/index.ts';
|
||||
import { useWebRTCPlayer } from '../useWebRTCStream.tsx';
|
||||
import VideoPlayer from '../VideoPlayer.tsx';
|
||||
import AgrtcRoomRobot from '../AgrtcRoomRobot';
|
||||
import DeviceController from './DeviceController';
|
||||
import { DatePicker } from 'antd';
|
||||
import dayjs from 'dayjs';
|
||||
@@ -66,6 +67,7 @@ const { RangePicker } = DatePicker;
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
|
||||
export default function DeviceStatusPage() {
|
||||
const { t } = useTranslation();
|
||||
const { userInfo } = useSelector((state: RootState) => 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' ? (
|
||||
<div style={{ width: '100%', height: '100%' }}>
|
||||
<MowerAllView
|
||||
serialNumber={device?.serialNumber}
|
||||
robotVideo={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
robotVideo ? (
|
||||
<div style={{ width: '100%', height: '100%' }}>
|
||||
<MowerAllView
|
||||
serialNumber={device?.serialNumber}
|
||||
robotVideo={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
</div>
|
||||
) : null
|
||||
) : mowerView === 'front' ? (
|
||||
<div style={{ position: 'relative', width: '100%', height: '100%' }}>
|
||||
{device?.hasHost ? (
|
||||
<AgrtcRoomRobot CHANNEL={device?.serialNumber || ''} />
|
||||
) : robotVideo ? (
|
||||
<VideoPlayer
|
||||
deviceId={device?.serialNumber}
|
||||
idx={1}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
) : (
|
||||
<div style={{ position: 'relative', width: '100%', height: '100%' }}>
|
||||
<VideoPlayer
|
||||
deviceId={device?.serialNumber}
|
||||
idx={
|
||||
mowerView === 'front' ? 1
|
||||
: mowerView === 'back' ? 2
|
||||
: mowerView === 'left' ? 3
|
||||
: 4
|
||||
mowerView === 'back' ? 2
|
||||
: mowerView === 'left' ? 3
|
||||
: 4
|
||||
}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
@@ -1249,7 +1268,7 @@ export default function DeviceStatusPage() {
|
||||
)}
|
||||
|
||||
{/* 视频未加载 / 停止播放的占位 */}
|
||||
{(!robotVideo || !isVideoPlaying) && (
|
||||
{(!robotVideo && !isVideoPlaying) && (
|
||||
<div style={{
|
||||
width: '100%', height: '100%',
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
||||
@@ -1265,7 +1284,6 @@ export default function DeviceStatusPage() {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 单视频(非全景)模式状态叠加层:始终渲染,和视频层解耦 */}
|
||||
{mowerView !== 'all' && (
|
||||
<div style={{
|
||||
|
||||
Reference in New Issue
Block a user