声网视频组件完成 总览界面和 任务规划界面 都显示 了 根据机器配备的几路视频 显示
This commit is contained in:
@@ -1,281 +1,346 @@
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import AgoraRTC, { IAgoraRTCClient, IRemoteVideoTrack } from "agora-rtc-sdk-ng";
|
||||
import { Badge, message } from "antd";
|
||||
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import AgoraRTC, { IAgoraRTCClient, IRemoteVideoTrack } from 'agora-rtc-sdk-ng';
|
||||
import { Badge, message } from 'antd';
|
||||
|
||||
AgoraRTC.setLogLevel(2); // 2=只输出warning/error,屏蔽debug日志
|
||||
// 日志等级:2=仅 warning/error,屏蔽 debug 噪点
|
||||
AgoraRTC.setLogLevel(2);
|
||||
|
||||
const APP_ID = "5afc6f096ddf433aa690df6f251274a4";
|
||||
const TOKEN = "007eJxTYHj/XqzNYP1utbUqvUkLly0/ypRz8liNgdKBqBeqqzX3+WgqMJgmpiWbpRlYmqWkpJkYGycmmlkapKSZpRmZGhqZmySaRH37ndUQyMjgu3k5KyMDBIL47AzJiblGuobmDAwA6vwg4g==";
|
||||
const APP_ID = '5afc6f096ddf433aa690df6f251274a4';
|
||||
const TOKEN =
|
||||
'007eJxTYHj/XqzNYP1utbUqvUkLly0/ypRz8liNgdKBqBeqqzX3+WgqMJgmpiWbpRlYmqWkpJkYGycmmlkapKSZpRmZGhqZmySaRH37ndUQyMjgu3k5KyMDBIL47AzJiblGuobmDAwA6vwg4g==';
|
||||
|
||||
export default function AgrtcRoomRobot({ CHANNEL }: { CHANNEL: string }) {
|
||||
const [uid] = useState(() => Number(Math.floor(Math.random() * 100000)));
|
||||
/**
|
||||
* 每路摄像头在 Agora 频道内用固定 UID 区分:
|
||||
* 101 = cam0 (GMSL A) = 前视
|
||||
* 102 = cam1 (GMSL B) = 左视
|
||||
* 103 = cam2 (GMSL C) = 后视
|
||||
* 104 = cam3 (GMSL D) = 右视
|
||||
*/
|
||||
/** 按摄像头路数选默认 UID:2 路时优先前+后 */
|
||||
export const DEFAULT_UIDS_BY_COUNT: Record<number, number[]> = {
|
||||
1: [101],
|
||||
2: [101, 103],
|
||||
3: [101, 102, 103],
|
||||
4: [101, 102, 103, 104],
|
||||
};
|
||||
export const DEFAULT_CAMERA_UIDS = [101, 102, 103, 104];
|
||||
export const CAMERA_UID_LABEL: Record<number, string> = {
|
||||
101: '前视',
|
||||
102: '左视',
|
||||
|
||||
103: '后视',
|
||||
104: '右视',
|
||||
};
|
||||
|
||||
interface AgrtcRoomRobotProps {
|
||||
/** 机器人 SN → 一个 Agora 频道 */
|
||||
channel?: string;
|
||||
/** 向后兼容:channel 的别名 */
|
||||
CHANNEL?: string;
|
||||
/** 当前机器人有几路摄像头(从 deviceRunParamSelectByDeviceId 的 cameraNum 字段取),1-4 */
|
||||
cameraCount?: number;
|
||||
/**
|
||||
* 显式指定本次只订阅哪些 UID(单路视图模式:front/back/left/right 各传一个 UID;all/grid 不传则按 cameraCount 取前 N 个默认 UID)
|
||||
* 留空时取 DEFAULT_CAMERA_UIDS.slice(0, cameraCount)
|
||||
*/
|
||||
slotUids?: number[];
|
||||
}
|
||||
|
||||
interface SlotRuntime {
|
||||
uid: number;
|
||||
containerRef: React.RefObject<HTMLDivElement>;
|
||||
track: IRemoteVideoTrack | null;
|
||||
subscribedUid: number | null;
|
||||
hasVideo: boolean;
|
||||
unpublishTimer: NodeJS.Timeout | null;
|
||||
}
|
||||
|
||||
export default function AgrtcRoomRobot(props: AgrtcRoomRobotProps) {
|
||||
const channel = "cam2-17" || props.channel || props.CHANNEL || '';
|
||||
const cameraCount = Math.max(1, Math.min(4, Number(props.cameraCount) || 1));
|
||||
|
||||
// 订阅 UID 列表:外部显式 slotUids > 默认按 cameraCount 截断
|
||||
const slotUids = useMemo(() => {
|
||||
if (Array.isArray(props.slotUids) && props.slotUids.length > 0) {
|
||||
return props.slotUids.filter((n) => Number.isFinite(n) && n >= 1);
|
||||
}
|
||||
return DEFAULT_UIDS_BY_COUNT[cameraCount] || [101];
|
||||
}, [props.slotUids, cameraCount]);
|
||||
|
||||
const [mountKey, setMountKey] = useState(0);
|
||||
const [connected, setConnected] = useState(false);
|
||||
const [joined, setJoined] = useState(false);
|
||||
const [hasRemoteVideo, setHasRemoteVideo] = useState(false);
|
||||
|
||||
const remoteVideoRef = useRef<HTMLDivElement>(null);
|
||||
const clientRef = useRef<IAgoraRTCClient | null>(null);
|
||||
const remoteVideoTrackRef = useRef<IRemoteVideoTrack | null>(null);
|
||||
const joiningRef = useRef(false);
|
||||
const reconnectTimerRef = useRef<NodeJS.Timeout | null>(null);
|
||||
const subscribedUidRef = useRef<number | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const client = AgoraRTC.createClient({
|
||||
mode: "live",
|
||||
codec: "h264",
|
||||
});
|
||||
clientRef.current = client;
|
||||
client.setClientRole("audience");
|
||||
// ========= 删掉了 setParameters,Web NG不支持!========
|
||||
setMountKey((k) => k + 1);
|
||||
}, [channel, slotUids.join(',')]);
|
||||
|
||||
let isUnmounted = false;
|
||||
let videoWatchDogTimer: NodeJS.Timeout | null = null;
|
||||
let unpublishTimer: NodeJS.Timeout | null = null;
|
||||
if (!channel) {
|
||||
return (
|
||||
<div style={{ width: '100%', height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#aaa', background: '#000', borderRadius: 8 }}>
|
||||
无可订阅频道
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const clearRemoteVideo = () => {
|
||||
if (remoteVideoTrackRef.current) {
|
||||
return (
|
||||
<AgrtcSingleChannel
|
||||
key={mountKey}
|
||||
channel={channel}
|
||||
slotUids={slotUids}
|
||||
onConnect={setConnected}
|
||||
onJoin={setJoined}
|
||||
>
|
||||
{(renderProps) => {
|
||||
const gridStyle = pickGridStyle(slotUids.length);
|
||||
return (
|
||||
<div style={{ width: '100%', height: '100%', display: 'flex', flexDirection: 'column', borderRadius: 8, overflow: 'hidden', background: '#000' }}>
|
||||
<div style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center', gap: 12, padding: '4px 8px', background: 'rgba(255,255,255,0.08)', flexShrink: 0, flexWrap: 'wrap' }}>
|
||||
<Badge
|
||||
color={connected ? 'green' : 'red'}
|
||||
text={connected ? 'RTC已连接' : 'RTC未连接'}
|
||||
style={{ content: { color: '#ffffff' } }}
|
||||
className={'badge-rtc-connected'}
|
||||
/>
|
||||
|
||||
<Badge
|
||||
color={joined ? 'green' : 'orange'}
|
||||
text={joined ? '已加入频道' : '未加入频道'}
|
||||
styles={{ content: { color: '#ffffff' } }}
|
||||
className={'badge-rtc-connected'}
|
||||
|
||||
/>
|
||||
<span style={{ fontSize: 11, color: '#888' }}>共 {slotUids.length} 路</span>
|
||||
</div>
|
||||
<div style={{ flex: 1, width: '100%', minHeight: 0, position: 'relative', padding: 4 }}>
|
||||
<div style={{ width: '100%', height: '100%', ...gridStyle }}>
|
||||
{slotUids.map((uid) => {
|
||||
const slot = renderProps.slotsByUid.get(uid);
|
||||
const hasVideo = slot?.hasVideo || false;
|
||||
const label = CAMERA_UID_LABEL[uid] || `UID ${uid}`;
|
||||
return (
|
||||
<div key={uid} style={{ position: 'relative', width: '100%', height: '100%', background: '#000', borderRadius: 6, overflow: 'hidden' }}>
|
||||
<div style={{ position: 'absolute', top: 4, left: 6, zIndex: 3, fontSize: 11, color: '#fff', background: 'rgba(0,0,0,0.5)', padding: '2px 6px', borderRadius: 4, maxWidth: '80%', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
|
||||
{label}
|
||||
</div>
|
||||
<div ref={slot?.containerRef} style={{ position: 'absolute', inset: 0, width: '100%', height: '100%', zIndex: 1 }} />
|
||||
{!hasVideo && (
|
||||
<div style={{ position: 'absolute', inset: 0, display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#aaa', fontSize: 12, background: '#000', zIndex: 2 }}>
|
||||
等待推流 (UID {uid})…
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
</AgrtcSingleChannel>
|
||||
);
|
||||
}
|
||||
|
||||
function pickGridStyle(count: number): React.CSSProperties {
|
||||
if (count <= 1) return { display: 'grid', gridTemplateColumns: '1fr', gridTemplateRows: '1fr', gap: 4 };
|
||||
if (count === 2) return { display: 'grid', gridTemplateColumns: '1fr', gridTemplateRows: '1fr 1fr', gap: 4 };
|
||||
return { display: 'grid', gridTemplateColumns: '1fr 1fr', gridTemplateRows: '1fr 1fr', gap: 4 };
|
||||
}
|
||||
|
||||
interface AgrtcSingleChannelProps {
|
||||
channel: string;
|
||||
slotUids: number[];
|
||||
onConnect: (c: boolean) => void;
|
||||
onJoin: (j: boolean) => void;
|
||||
children: (renderProps: { slotsByUid: Map<number, SlotRuntime> }) => React.ReactNode;
|
||||
}
|
||||
|
||||
function AgrtcSingleChannel({ channel, slotUids, onConnect, onJoin, children }: AgrtcSingleChannelProps) {
|
||||
// 用 Map 做按 UID 索引的 slot,避免 React 重建循环引用
|
||||
const slotsRef = useRef<Map<number, SlotRuntime>>(new Map());
|
||||
const [, forceTick] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
const slotsByUid = new Map<number, SlotRuntime>();
|
||||
const containerKeyByUid = new Map<number, React.RefObject<HTMLDivElement>>();
|
||||
for (const uid of slotUids) {
|
||||
containerKeyByUid.set(uid, React.createRef<HTMLDivElement>());
|
||||
slotsByUid.set(uid, {
|
||||
uid,
|
||||
containerRef: containerKeyByUid.get(uid)!,
|
||||
track: null,
|
||||
subscribedUid: null,
|
||||
hasVideo: false,
|
||||
unpublishTimer: null,
|
||||
});
|
||||
}
|
||||
slotsRef.current = slotsByUid;
|
||||
forceTick((v) => v + 1);
|
||||
|
||||
const client: IAgoraRTCClient = AgoraRTC.createClient({ mode: 'live', codec: 'h264' });
|
||||
console.log('[AGRTC] init channel=' + channel + ', slotUids=' + JSON.stringify(slotUids));
|
||||
client.setClientRole('audience');
|
||||
|
||||
const localUid = Number(Math.floor(Math.random() * 100000) + 1);
|
||||
let unmounted = false;
|
||||
|
||||
const clearSlotTrack = (uid: number) => {
|
||||
const slot = slotsRef.current.get(uid);
|
||||
if (!slot) return;
|
||||
if (slot.track) {
|
||||
try {
|
||||
remoteVideoTrackRef.current.stop();
|
||||
} catch (e) {
|
||||
console.warn("stop track error", e);
|
||||
}
|
||||
remoteVideoTrackRef.current = null;
|
||||
slot.track.stop();
|
||||
} catch { }
|
||||
slot.track = null;
|
||||
}
|
||||
subscribedUidRef.current = null;
|
||||
setHasRemoteVideo(false);
|
||||
if (videoWatchDogTimer) clearInterval(videoWatchDogTimer);
|
||||
slot.subscribedUid = null;
|
||||
slot.hasVideo = false;
|
||||
if (slot.unpublishTimer) {
|
||||
clearTimeout(slot.unpublishTimer);
|
||||
slot.unpublishTimer = null;
|
||||
}
|
||||
forceTick((v) => v + 1);
|
||||
};
|
||||
|
||||
const startVideoWatchDog = () => {
|
||||
if (videoWatchDogTimer) clearInterval(videoWatchDogTimer);
|
||||
videoWatchDogTimer = setInterval(async () => {
|
||||
const track = remoteVideoTrackRef.current;
|
||||
const dom = remoteVideoRef.current;
|
||||
if (!track || !dom) return;
|
||||
const videoEl = dom.querySelector("video") as HTMLVideoElement;
|
||||
if (!videoEl) return;
|
||||
if (videoEl.readyState < 2) {
|
||||
console.warn("看门狗检测视频无画面,尝试重新play");
|
||||
try {
|
||||
await track.play(dom);
|
||||
} catch (e) {
|
||||
console.warn("看门狗play异常", e);
|
||||
}
|
||||
}
|
||||
}, 3000);
|
||||
};
|
||||
|
||||
const playRemoteTrack = async (track: IRemoteVideoTrack) => {
|
||||
const dom = remoteVideoRef.current;
|
||||
if (!dom || !track) return;
|
||||
const playIntoSlot = async (uid: number, track: IRemoteVideoTrack) => {
|
||||
const slot = slotsRef.current.get(uid);
|
||||
if (!slot || !slot.containerRef.current) return;
|
||||
try {
|
||||
await track.play(dom);
|
||||
console.log("远端视频播放成功");
|
||||
setHasRemoteVideo(true);
|
||||
startVideoWatchDog();
|
||||
await track.play(slot.containerRef.current);
|
||||
slot.track = track;
|
||||
slot.hasVideo = true;
|
||||
forceTick((v) => v + 1);
|
||||
} catch (err: any) {
|
||||
if (err.name === "AbortError") {
|
||||
console.warn("播放请求被中断 AbortError,忽略", err);
|
||||
return;
|
||||
}
|
||||
console.error("视频播放失败", err);
|
||||
message.error("视频播放失败");
|
||||
if (err?.name === 'AbortError') return;
|
||||
console.error('[AGRTC] play failed', channel, uid, err);
|
||||
}
|
||||
};
|
||||
|
||||
const doReconnect = async () => {
|
||||
if (isUnmounted || joiningRef.current) return;
|
||||
console.log("执行RTC重连(信令断开)");
|
||||
clearRemoteVideo();
|
||||
setJoined(false);
|
||||
const onUserPublished = async (user: any, mediaType: 'video' | 'audio') => {
|
||||
if (unmounted || mediaType !== 'video') return;
|
||||
const uid = Number(user.uid);
|
||||
if (!slotUids.includes(uid)) return; // 只关心我们订阅的摄像头 UID
|
||||
const slot = slotsRef.current.get(uid);
|
||||
if (!slot || slot.subscribedUid === user.uid) return;
|
||||
if (slot.unpublishTimer) {
|
||||
clearTimeout(slot.unpublishTimer);
|
||||
slot.unpublishTimer = null;
|
||||
}
|
||||
try {
|
||||
joiningRef.current = true;
|
||||
await client.join(APP_ID, CHANNEL, TOKEN, uid);
|
||||
if (isUnmounted) return;
|
||||
setJoined(true);
|
||||
message.info("RTC重连成功");
|
||||
for (const remoteUser of client.remoteUsers) {
|
||||
if (isUnmounted) break;
|
||||
if (remoteUser.hasVideo && subscribedUidRef.current !== remoteUser.uid) {
|
||||
await client.subscribe(remoteUser, "video");
|
||||
remoteVideoTrackRef.current = remoteUser.videoTrack;
|
||||
subscribedUidRef.current = remoteUser.uid;
|
||||
await playRemoteTrack(remoteUser.videoTrack!);
|
||||
}
|
||||
await client.subscribe(user, 'video');
|
||||
slot.subscribedUid = user.uid;
|
||||
if (user.videoTrack) {
|
||||
await playIntoSlot(uid, user.videoTrack);
|
||||
}
|
||||
} catch (err: any) {
|
||||
if (err?.code !== "OPERATION_ABORTED") {
|
||||
console.error("重连失败", err);
|
||||
}
|
||||
} finally {
|
||||
joiningRef.current = false;
|
||||
} catch (e) {
|
||||
console.error('[AGRTC] subscribe failed', channel, uid, e);
|
||||
}
|
||||
};
|
||||
|
||||
const onConnStateChange = (curState: string, prevState: string) => {
|
||||
if (isUnmounted) return;
|
||||
console.log("连接状态变更", prevState, "→", curState);
|
||||
setConnected(curState === "CONNECTED");
|
||||
if (curState === "DISCONNECTED") {
|
||||
clearRemoteVideo();
|
||||
if (reconnectTimerRef.current) clearTimeout(reconnectTimerRef.current);
|
||||
reconnectTimerRef.current = setTimeout(() => {
|
||||
doReconnect();
|
||||
}, 2000);
|
||||
}
|
||||
};
|
||||
|
||||
const onUserPublished = async (user: any, mediaType: "video" | "audio") => {
|
||||
if (isUnmounted) return;
|
||||
console.log("user-published", user.uid, mediaType);
|
||||
if (mediaType !== "video") return;
|
||||
if (subscribedUidRef.current === user.uid) {
|
||||
console.log("该用户已订阅,跳过");
|
||||
return;
|
||||
}
|
||||
// 取消待执行的清空定时器
|
||||
if (unpublishTimer) clearTimeout(unpublishTimer);
|
||||
|
||||
await client.subscribe(user, mediaType);
|
||||
remoteVideoTrackRef.current = user.videoTrack;
|
||||
subscribedUidRef.current = user.uid;
|
||||
await playRemoteTrack(user.videoTrack);
|
||||
};
|
||||
|
||||
const onUserUnpublished = (user: any, mediaType: "video" | "audio") => {
|
||||
if (isUnmounted) return;
|
||||
console.log("user-unpublished", user.uid, mediaType, subscribedUidRef.current);
|
||||
if (mediaType === "video" && subscribedUidRef.current === user.uid) {
|
||||
if (unpublishTimer) clearTimeout(unpublishTimer);
|
||||
// 延迟2s清空,短闪断自动恢复不黑屏
|
||||
unpublishTimer = setTimeout(() => {
|
||||
clearRemoteVideo();
|
||||
}, 2000);
|
||||
}
|
||||
const onUserUnpublished = (user: any, mediaType: 'video' | 'audio') => {
|
||||
if (unmounted || mediaType !== 'video') return;
|
||||
const uid = Number(user.uid);
|
||||
if (!slotUids.includes(uid)) return;
|
||||
const slot = slotsRef.current.get(uid);
|
||||
if (!slot || slot.subscribedUid !== user.uid) return;
|
||||
if (slot.unpublishTimer) clearTimeout(slot.unpublishTimer);
|
||||
slot.unpublishTimer = setTimeout(() => clearSlotTrack(uid), 2000);
|
||||
};
|
||||
|
||||
const onUserLeft = (user: any) => {
|
||||
if (isUnmounted) return;
|
||||
console.log("user-left", user.uid);
|
||||
if (subscribedUidRef.current === user.uid) {
|
||||
if (unpublishTimer) clearTimeout(unpublishTimer);
|
||||
clearRemoteVideo();
|
||||
if (unmounted) return;
|
||||
const uid = Number(user.uid);
|
||||
if (!slotUids.includes(uid)) return;
|
||||
const slot = slotsRef.current.get(uid);
|
||||
if (!slot || slot.subscribedUid !== user.uid) return;
|
||||
clearSlotTrack(uid);
|
||||
};
|
||||
|
||||
const onConnStateChange = (cur: string, prev: string) => {
|
||||
if (unmounted) return;
|
||||
onConnect(cur === 'CONNECTED');
|
||||
if (cur === 'CONNECTED') onJoin(true);
|
||||
else if (cur === 'DISCONNECTED') {
|
||||
onJoin(false);
|
||||
// 断线时清空所有槽位,重连成功后 onUserPublished 会重新走一遍
|
||||
for (const uid of slotUids) clearSlotTrack(uid);
|
||||
}
|
||||
};
|
||||
|
||||
const onUserJoined = (user: any) => {
|
||||
if (!isUnmounted) console.log("远端用户进入频道:", user.uid);
|
||||
};
|
||||
client.on('connection-state-change', onConnStateChange);
|
||||
client.on('user-published', onUserPublished);
|
||||
client.on('user-unpublished', onUserUnpublished);
|
||||
client.on('user-left', onUserLeft);
|
||||
|
||||
const onTokenWillExpire = () => {
|
||||
console.warn("token即将过期,请更新token");
|
||||
message.warning("Token即将过期,视频可能很快断开");
|
||||
};
|
||||
|
||||
client.on("connection-state-change", onConnStateChange);
|
||||
client.on("user-published", onUserPublished);
|
||||
client.on("user-unpublished", onUserUnpublished);
|
||||
client.on("user-left", onUserLeft);
|
||||
client.on("user-joined", onUserJoined);
|
||||
client.on("token-privilege-will-expire", onTokenWillExpire);
|
||||
|
||||
const init = async () => {
|
||||
if (joiningRef.current) return;
|
||||
joiningRef.current = true;
|
||||
const doJoin = async () => {
|
||||
try {
|
||||
await client.join(APP_ID, CHANNEL, TOKEN, uid);
|
||||
if (isUnmounted) {
|
||||
console.log("组件已卸载,丢弃join结果");
|
||||
return;
|
||||
}
|
||||
console.log("加入频道成功");
|
||||
setJoined(true);
|
||||
message.success("RTC已加入频道");
|
||||
for (const remoteUser of client.remoteUsers) {
|
||||
if (isUnmounted) break;
|
||||
console.log("发现已有远端用户:", remoteUser.uid);
|
||||
if (remoteUser.hasVideo && subscribedUidRef.current !== remoteUser.uid) {
|
||||
await client.subscribe(remoteUser, "video");
|
||||
remoteVideoTrackRef.current = remoteUser.videoTrack;
|
||||
subscribedUidRef.current = remoteUser.uid;
|
||||
await playRemoteTrack(remoteUser.videoTrack!);
|
||||
}
|
||||
console.log('[AGRTC] joining channel=' + channel + ', localUid=' + localUid + ', appId=' + APP_ID);
|
||||
console.log('[AGRTC] joined ' + channel + ', remoteUsers=', (client.remoteUsers || []).map(u => u.uid));
|
||||
await client.join(APP_ID, channel, TOKEN, localUid);
|
||||
if (unmounted) return;
|
||||
onJoin(true);
|
||||
// 加入后立刻把已在频道内的远端摄像头扫一遍,避免错过 onUserPublished
|
||||
for (const remote of client.remoteUsers) {
|
||||
if (unmounted) break;
|
||||
if (!remote.hasVideo) continue;
|
||||
const uid = Number(remote.uid);
|
||||
if (!slotUids.includes(uid)) continue;
|
||||
const slot = slotsRef.current.get(uid);
|
||||
if (!slot || slot.subscribedUid === remote.uid) continue;
|
||||
try {
|
||||
await client.subscribe(remote, 'video');
|
||||
slot.subscribedUid = remote.uid;
|
||||
if (remote.videoTrack) await playIntoSlot(uid, remote.videoTrack);
|
||||
} catch { /* ignore */ }
|
||||
}
|
||||
} catch (err: any) {
|
||||
if (err?.code === "OPERATION_ABORTED") {
|
||||
console.log("join操作被取消,忽略");
|
||||
return;
|
||||
if (err?.code !== 'OPERATION_ABORTED') {
|
||||
console.error('[AGRTC] join failed', channel, err);
|
||||
message.error(`加入 ${channel} 失败`);
|
||||
}
|
||||
console.error("加入频道失败:", err);
|
||||
if (!isUnmounted) {
|
||||
message.error("加入频道失败,请检查appid/token/channel");
|
||||
}
|
||||
} finally {
|
||||
joiningRef.current = false;
|
||||
}
|
||||
};
|
||||
doJoin();
|
||||
|
||||
init();
|
||||
// Watchdog:每 3s 检查每个 video 元素,readyState 未到 HAVE_CURRENT_DATA 时重新 .play()
|
||||
const watchdog = setInterval(() => {
|
||||
if (unmounted) return;
|
||||
for (const [uid, slot] of slotsRef.current.entries()) {
|
||||
if (!slot.track || !slot.containerRef.current) continue;
|
||||
const videoEl = slot.containerRef.current.querySelector('video') as HTMLVideoElement | null;
|
||||
if (!videoEl) continue;
|
||||
if (videoEl.readyState < 2) {
|
||||
try {
|
||||
slot.track.play(slot.containerRef.current);
|
||||
} catch (e) {
|
||||
console.warn('[AGRTC] watchdog replay error', channel, uid, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 3000);
|
||||
|
||||
return () => {
|
||||
isUnmounted = true;
|
||||
if (reconnectTimerRef.current) clearTimeout(reconnectTimerRef.current);
|
||||
if (unpublishTimer) clearTimeout(unpublishTimer);
|
||||
if (videoWatchDogTimer) clearInterval(videoWatchDogTimer);
|
||||
clearRemoteVideo();
|
||||
const c = clientRef.current;
|
||||
if (!c) return;
|
||||
c.off("connection-state-change", onConnStateChange);
|
||||
c.off("user-published", onUserPublished);
|
||||
c.off("user-unpublished", onUserUnpublished);
|
||||
c.off("user-left", onUserLeft);
|
||||
c.off("user-joined", onUserJoined);
|
||||
c.off("token-privilege-will-expire", onTokenWillExpire);
|
||||
c.leave();
|
||||
clientRef.current = null;
|
||||
unmounted = true;
|
||||
clearInterval(watchdog);
|
||||
for (const slot of slotsRef.current.values()) {
|
||||
if (slot.unpublishTimer) clearTimeout(slot.unpublishTimer);
|
||||
if (slot.track) {
|
||||
try { slot.track.stop(); } catch { }
|
||||
}
|
||||
}
|
||||
try {
|
||||
client.off('connection-state-change');
|
||||
client.off('user-published');
|
||||
client.off('user-unpublished');
|
||||
client.off('user-left');
|
||||
client.leave();
|
||||
} catch { }
|
||||
slotsRef.current.clear();
|
||||
onConnect(false);
|
||||
onJoin(false);
|
||||
};
|
||||
}, [CHANNEL]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [channel, slotUids.join(',')]);
|
||||
|
||||
return (
|
||||
<div style={{ width: "100%", height: "95%", display: "flex", flexDirection: "column", borderRadius: 8, overflow: "hidden", background: "#000" }}>
|
||||
<div style={{ display: "flex", justifyContent: "end", alignItems: "center", gap: 12, padding: "4px 8px", background: "rgba(255,255,255,0.08)", flexShrink: 0 }}>
|
||||
<Badge
|
||||
color={connected ? "green" : "red"}
|
||||
text={connected ? "RTC已连接" : "RTC未连接"}
|
||||
styles={{ content: { color: '#888' } }}
|
||||
/>
|
||||
<Badge
|
||||
color={joined ? "green" : "orange"}
|
||||
text={joined ? "已加入频道" : "未加入频道"}
|
||||
styles={{ content: { color: '#888' } }}
|
||||
/>
|
||||
<span style={{ fontSize: 11, color: "#888" }}>频道:{CHANNEL}</span>
|
||||
</div>
|
||||
<div style={{ flex: 1, width: "100%", minHeight: 0, position: "relative" }}>
|
||||
{!hasRemoteVideo && (
|
||||
<div style={{
|
||||
position: "absolute",
|
||||
inset: 0,
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
color: "#aaa",
|
||||
fontSize: 14,
|
||||
background: "#000",
|
||||
zIndex: 2
|
||||
}}>
|
||||
视频加载中,等待远端推流...
|
||||
</div>
|
||||
)}
|
||||
<div ref={remoteVideoRef} style={{
|
||||
position: "absolute",
|
||||
inset: 0,
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
zIndex: 1
|
||||
}} />
|
||||
</div>
|
||||
</div >
|
||||
);
|
||||
return <>{children({ slotsByUid: slotsRef.current })}</>;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
message,
|
||||
Modal,
|
||||
Switch,
|
||||
DatePicker
|
||||
} from 'antd';
|
||||
import {
|
||||
DashboardOutlined,
|
||||
@@ -65,7 +66,8 @@ import VideoPlayer from '../VideoPlayer.tsx';
|
||||
import SteerButton from './SteerButton';
|
||||
import AgrtcRoomRobot from '../AgrtcRoomRobot';
|
||||
import DeviceController from './DeviceController';
|
||||
import { DatePicker } from 'antd';
|
||||
|
||||
import { deviceRunParamSelectByDeviceId } from '@/api/stationManage/index';
|
||||
import dayjs from 'dayjs';
|
||||
import { MowerAllView } from './MowerAllView';
|
||||
import { useMqtt } from '@/hooks/useMqtt';
|
||||
@@ -87,15 +89,7 @@ const ConsoleBadge = ({ online, text, color }: any) => (
|
||||
{text}
|
||||
</span>
|
||||
);
|
||||
const ConsoleRow = ({ icon, label, value }: any) => (
|
||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8 }}>
|
||||
<span style={{ display: 'inline-flex', alignItems: 'center', gap: 6, fontSize: 12, color: '#8c8c8c', whiteSpace: 'nowrap' }}>
|
||||
{icon}
|
||||
{label}
|
||||
</span>
|
||||
<span style={{ fontSize: 12, color: '#262626', textAlign: 'right', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{value}</span>
|
||||
</div>
|
||||
);
|
||||
|
||||
// 暗色控制台面板(参考图样式:细边框、小圆角、蓝色竖条标题、右侧状态 badge)
|
||||
const ConsolePanel = ({ title, extra, badge, children, style, bodyStyle }: any) => (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', background: '#fff', borderRadius: 10, overflow: 'hidden', ...style }}>
|
||||
@@ -109,76 +103,7 @@ const ConsolePanel = ({ title, extra, badge, children, style, bodyStyle }: any)
|
||||
<div style={{ flex: 1, minHeight: 0, padding: 10, ...bodyStyle }}>{children}</div>
|
||||
</div>
|
||||
);
|
||||
// 方向盘功能按钮(暗色小方块,样式参考参考图)
|
||||
// SteerButton:支持长按持续发送(与 DPadControl 方向键行为一致)
|
||||
//const SteerButton = ({ icon, label, color, onPressStart, onPressEnd }: any) => {
|
||||
// const [pressed, setPressed] = useState(false);
|
||||
// const holdingRef = useRef(false);
|
||||
// const intervalRef = useRef<number | null>(null);
|
||||
// const emitEndedRef = useRef(false);
|
||||
// const stopHold = useCallback(() => {
|
||||
// if (intervalRef.current !== null) { window.clearInterval(intervalRef.current); intervalRef.current = null; }
|
||||
// if (!holdingRef.current) return;
|
||||
// holdingRef.current = false;
|
||||
// emitEndedRef.current = false;
|
||||
// setPressed(false);
|
||||
// onPressEnd?.();
|
||||
// }, [onPressEnd]);
|
||||
// const startHold = useCallback(() => {
|
||||
// if (holdingRef.current) return;
|
||||
// holdingRef.current = true;
|
||||
// emitEndedRef.current = false;
|
||||
// setPressed(true);
|
||||
// if (intervalRef.current !== null) window.clearInterval(intervalRef.current);
|
||||
// // 立即首帧 + 每 100ms 持续(DPadControl 也是 100ms)
|
||||
// onPressStart?.();
|
||||
// intervalRef.current = window.setInterval(() => {
|
||||
// if (!holdingRef.current) return;
|
||||
// onPressStart?.();
|
||||
// }, 100);
|
||||
// }, [onPressStart]);
|
||||
// useEffect(() => () => {
|
||||
// if (intervalRef.current !== null) window.clearInterval(intervalRef.current);
|
||||
// if (holdingRef.current) stopHold();
|
||||
// }, [stopHold]);
|
||||
// return (
|
||||
// <button
|
||||
// type="button"
|
||||
// aria-label={label}
|
||||
// onMouseDown={(e) => { e.preventDefault(); e.stopPropagation(); startHold(); }}
|
||||
// onMouseUp={(e) => { e.preventDefault(); e.stopPropagation(); stopHold(); }}
|
||||
// onMouseLeave={() => { if (holdingRef.current) stopHold(); }}
|
||||
// onTouchStart={(e) => { e.preventDefault(); startHold(); }}
|
||||
// onTouchEnd={(e) => { e.preventDefault(); stopHold(); }}
|
||||
// onTouchCancel={() => { if (holdingRef.current) stopHold(); }}
|
||||
// onContextMenu={(e) => e.preventDefault()}
|
||||
// onClick={(e) => e.preventDefault()}
|
||||
// style={{
|
||||
// flex: '1 1 0',
|
||||
// display: 'flex',
|
||||
// flexDirection: 'column',
|
||||
// alignItems: 'center',
|
||||
// justifyContent: 'center',
|
||||
// gap: 4,
|
||||
// minHeight: 46,
|
||||
// padding: '6px 4px',
|
||||
// borderRadius: 8,
|
||||
// background: pressed ? color + '30' : '#1e293b',
|
||||
// border: '1px solid ' + (pressed ? color : color + '55'),
|
||||
// color: color,
|
||||
// cursor: 'pointer',
|
||||
// userSelect: 'none',
|
||||
// touchAction: 'none',
|
||||
// transform: pressed ? 'scale(0.94)' : 'scale(1)',
|
||||
// boxShadow: pressed ? '0 0 14px ' + color + '66' : 'none',
|
||||
// transition: 'transform .08s, background .12s, border-color .12s, box-shadow .12s',
|
||||
// }}
|
||||
// >
|
||||
// <span style={{ display: 'inline-flex', fontSize: 16, lineHeight: 1 }}>{icon}</span>
|
||||
// <span style={{ fontSize: 11, fontWeight: 600, whiteSpace: 'nowrap' }}>{label}</span>
|
||||
// </button>
|
||||
// );
|
||||
//};
|
||||
|
||||
export default function DeviceStatusPage() {
|
||||
const { t } = useTranslation();
|
||||
const { userInfo } = useSelector((state: RootState) => state.user);
|
||||
@@ -199,9 +124,20 @@ export default function DeviceStatusPage() {
|
||||
const [messageApi, contextHolder] = message.useMessage();
|
||||
// 视频播放开关
|
||||
const [isVideoPlaying, setIsVideoPlaying] = useState(false);
|
||||
|
||||
// 当前机器人摄像头路数(接口返回 cameraNum,1-4)
|
||||
const [cameraNum, setCameraNum] = useState<number>(1);
|
||||
// 行车辅助线开关(仅前视/后视单路叠加)
|
||||
const [showGuideLine, setShowGuideLine] = useState<boolean>(true);
|
||||
// 设备 Agora 视频频道号(后端 paramData 或 device 字段;最终兜底 SN)
|
||||
const toggleVideoPlay = useCallback(() => {
|
||||
setIsVideoPlaying(prev => !prev);
|
||||
}, []);
|
||||
|
||||
// 选中机器人变化 → 拉设备参数,取 cameraNum 决定视频网格布局(1/2/4 路)
|
||||
|
||||
|
||||
|
||||
const [isControlled, setIsControlled] = useState(false);
|
||||
const [hasControlRight, setHasControlRight] = useState(false);
|
||||
const [connecting, setConnecting] = useState(false);
|
||||
@@ -272,6 +208,15 @@ export default function DeviceStatusPage() {
|
||||
const handleFinishEdPoint = (point) => {
|
||||
setArrivedPoint(point);
|
||||
}
|
||||
const ConsoleRow = ({ icon, label, value }: any) => (
|
||||
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8 }}>
|
||||
<span style={{ display: 'inline-flex', alignItems: 'center', gap: 6, fontSize: 12, color: '#8c8c8c', whiteSpace: 'nowrap' }}>
|
||||
{icon}
|
||||
{label}
|
||||
</span>
|
||||
<span style={{ fontSize: 12, color: '#262626', textAlign: 'right', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{value}</span>
|
||||
</div>
|
||||
);
|
||||
useEffect(() => {
|
||||
fetchAllData();
|
||||
}, [userInfo, stationId]);
|
||||
@@ -437,6 +382,50 @@ export default function DeviceStatusPage() {
|
||||
onMessage: handleMqttMessage,
|
||||
enabled: mqttTopics.length > 0,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const id = device?.device_sn || device?.serialNumber || selectedSn;
|
||||
if (!id || !stationId) {
|
||||
setCameraNum(1);
|
||||
return;
|
||||
}
|
||||
let cancelled = false;
|
||||
deviceRunParamSelectByDeviceId({ deviceId: id }).then((res) => {
|
||||
if (cancelled) return;
|
||||
if (res?.code === 200) {
|
||||
const n = Number(res.data?.cameraNum);
|
||||
// channel 字段:videoChannel / cameraChannel / agoraChannel / rtcChannel / channel
|
||||
|
||||
setCameraNum(Number.isFinite(n) && n >= 1 && n <= 4 ? n : 1);
|
||||
console.log('[DSP] deviceRunParam res.data=', res.data);
|
||||
} else {
|
||||
setCameraNum(1);
|
||||
}
|
||||
}).catch(() => {
|
||||
if (!cancelled) setCameraNum(1);
|
||||
});
|
||||
return () => { cancelled = true; };
|
||||
}, [device?.device_sn, device?.serialNumber, selectedSn, stationId]);
|
||||
|
||||
// 视角按钮:按摄像头路数动态裁剪
|
||||
const viewButtons = useMemo(() => {
|
||||
const all = [
|
||||
{ key: 'all', label: t('devices.panorama') },
|
||||
{ key: 'front', label: t('devices.frontView'), minCams: 1 },
|
||||
{ key: 'back', label: t('devices.backView'), minCams: 1 },
|
||||
{ key: 'left', label: t('devices.leftView'), minCams: 3 },
|
||||
{ key: 'right', label: t('devices.rightView'), minCams: 3 },
|
||||
];
|
||||
const n = Number(cameraNum) || 1;
|
||||
return all.filter((b) => !b.minCams || n >= b.minCams);
|
||||
}, [cameraNum, t]);
|
||||
|
||||
// cameraNum 变化时自动把非法视角回退到 front
|
||||
useEffect(() => {
|
||||
const n = Number(cameraNum) || 1;
|
||||
if (n <= 2 && (mowerView === 'left' || mowerView === 'right')) setMowerView('front');
|
||||
}, [cameraNum, mowerView]);
|
||||
|
||||
// 合并无人机和机场数据
|
||||
const currentDroneData = React.useMemo(() => {
|
||||
return { ...persistentHostData, ...persistentDroneData };
|
||||
@@ -1406,51 +1395,57 @@ export default function DeviceStatusPage() {
|
||||
bodyStyle={{ padding: 8, display: 'flex', flexDirection: 'column', gap: 8 }}
|
||||
>
|
||||
<div style={{ display: 'flex', alignItems: 'center', gap: 6, flexShrink: 0, overflowX: 'auto' }}>
|
||||
{[{ key: 'front', label: t('devices.frontView') }, { key: 'left', label: t('devices.leftView') }, { key: 'right', label: t('devices.rightView') }, { key: 'back', label: t('devices.backView') }, { key: 'all', label: t('devices.panorama') }].map((v) => (
|
||||
{viewButtons.map((v) => (
|
||||
<Button key={v.key} type={mowerView === v.key ? 'primary' : 'default'} size="small" onClick={() => setMowerView(v.key)}>
|
||||
{v.label}
|
||||
</Button>
|
||||
))}
|
||||
<span style={{ marginLeft: 'auto', display: 'inline-flex', alignItems: 'center', gap: 6, fontSize: 12, color: '#555' }}>
|
||||
{t('devices.showGuideLine')}
|
||||
<Switch size="small" checked={showGuideLine} onChange={setShowGuideLine} />
|
||||
</span>
|
||||
</div>
|
||||
<div style={{ position: 'relative', flex: 1, minHeight: 0, borderRadius: 8, overflow: 'hidden', }}>
|
||||
{isVideoPlaying && (
|
||||
mowerView === 'all' ? (
|
||||
// 全景/网格视图:单频道多 UID,按 cameraNum 决定 1/2/4 路布局
|
||||
<div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>
|
||||
<MowerAllView serialNumber={device?.serialNumber} robotVideo={robotVideo} error={error} ready={ready} />
|
||||
<AgrtcRoomRobot channel={device?.serialNumber || device?.device_sn || ""} cameraCount={cameraNum} />
|
||||
</div>
|
||||
) : mowerView === 'front' ? (
|
||||
// 前视:单路 UID 101
|
||||
<div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>
|
||||
<AgrtcRoomRobot CHANNEL={"cam2-17"} />
|
||||
<AgrtcRoomRobot channel={device?.serialNumber || device?.device_sn || ""} slotUids={[101]} />
|
||||
<CarReverseGuideLine
|
||||
direction="forward"
|
||||
steer={steerXY.x * 45}
|
||||
linearSpeed={Number(runningStatus?.linear_speed ?? runningStatus?.linearSpeed)}
|
||||
angularSpeed={Number(runningStatus?.angular_speed ?? runningStatus?.angularSpeed)}
|
||||
visible={isVideoPlaying}
|
||||
visible={isVideoPlaying && showGuideLine}
|
||||
/>
|
||||
</div>
|
||||
) : mowerView === 'back' ? (
|
||||
// 后视:单路 UID 103 + 倒车辅助线
|
||||
<div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>
|
||||
<AgrtcRoomRobot channel={device?.serialNumber || device?.device_sn || ""} slotUids={[103]} />
|
||||
<CarReverseGuideLine
|
||||
direction="reverse"
|
||||
steer={steerXY.x * 45}
|
||||
linearSpeed={Number(runningStatus?.linear_speed ?? runningStatus?.linearSpeed)}
|
||||
angularSpeed={Number(runningStatus?.angular_speed ?? runningStatus?.angularSpeed)}
|
||||
visible={isVideoPlaying && showGuideLine}
|
||||
/>
|
||||
</div>
|
||||
) : mowerView === 'left' ? (
|
||||
<div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>
|
||||
<AgrtcRoomRobot channel={device?.serialNumber || device?.device_sn || ""} slotUids={[102]} />
|
||||
</div>
|
||||
) : (
|
||||
// 右视:单路 UID 104
|
||||
<div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}>
|
||||
<VideoPlayer
|
||||
deviceId={device?.serialNumber}
|
||||
idx={mowerView === 'back' ? 2 : mowerView === 'left' ? 3 : 4}
|
||||
className="w-full h-full object-contain"
|
||||
video={robotVideo}
|
||||
error={error}
|
||||
ready={ready}
|
||||
/>
|
||||
{mowerView === 'back' && (
|
||||
<CarReverseGuideLine
|
||||
direction="reverse"
|
||||
steer={steerXY.x * 45}
|
||||
linearSpeed={Number(runningStatus?.linear_speed ?? runningStatus?.linearSpeed)}
|
||||
angularSpeed={Number(runningStatus?.angular_speed ?? runningStatus?.angularSpeed)}
|
||||
visible={isVideoPlaying}
|
||||
/>
|
||||
)}
|
||||
<AgrtcRoomRobot channel={device?.serialNumber || device?.device_sn || ""} slotUids={[104]} />
|
||||
</div>
|
||||
)
|
||||
)}
|
||||
))}
|
||||
{!isVideoPlaying && (
|
||||
<div style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0, display: 'flex', alignItems: 'center', justifyContent: 'center', flexDirection: 'column', gap: 12, color: 'rgba(14, 78, 198, 0.55)' }}>
|
||||
<VideoCameraOutlined style={{ fontSize: 56, opacity: 0.6 }} />
|
||||
|
||||
@@ -19,6 +19,8 @@ import { MapEditorView } from './MapEditorView';
|
||||
import type { ViewStats } from './WayLineView';
|
||||
import { backToRestPointCommand } from '@/api/mapEdit';
|
||||
import { sendEmergencyStop, subscribeEmergencyStop, syncEmergencyStop } from './emergencyStopControl';
|
||||
import AgrtcRoomRobot from '../AgrtcRoomRobot.js';
|
||||
import { deviceRunParamSelectByDeviceId } from '@/api/stationManage/index.js';
|
||||
|
||||
|
||||
const { Text, Title } = Typography;
|
||||
@@ -109,6 +111,7 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
|
||||
|
||||
// 当前激活的Tab
|
||||
const [activeTab, setActiveTab] = useState('pool'); // 'task' for 任务列表, 'pool' for 任务池, 'history' for 历史任务
|
||||
const [cameraNum, setCameraNum] = useState(0);
|
||||
|
||||
// 任务池和历史任务筛选表单
|
||||
const [poolFilterForm, setPoolFilterForm] = useState({
|
||||
@@ -1384,6 +1387,26 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
|
||||
setDeviceStatistics(res.data || {});
|
||||
}
|
||||
});
|
||||
|
||||
const id = selectedMachineSn;
|
||||
if (!id || !stationId) {
|
||||
setCameraNum(1);
|
||||
return;
|
||||
}
|
||||
let cancelled = false;
|
||||
deviceRunParamSelectByDeviceId({ deviceId: id }).then((res) => {
|
||||
if (cancelled) return;
|
||||
if (res?.code === 200) {
|
||||
const n = Number(res.data?.cameraNum);
|
||||
setCameraNum(Number.isFinite(n) && n >= 1 && n <= 4 ? n : 1);
|
||||
console.log('[DSP] deviceRunParam res.data=', res.data);
|
||||
} else {
|
||||
setCameraNum(1);
|
||||
}
|
||||
}).catch(() => {
|
||||
if (!cancelled) setCameraNum(1);
|
||||
});
|
||||
return () => { cancelled = true; };
|
||||
}, [selectedMachineSn]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -3105,22 +3128,18 @@ export function TaskPlanningView({ selectedMachineSn, embedded = false, onStatsC
|
||||
</Row>*/}
|
||||
|
||||
|
||||
{/*{showVideo && executingRobot && execute && taskPoolList.length > 0 && (
|
||||
{showVideo && (
|
||||
<DraggableBox
|
||||
defaultPosition={{ x: 50, y: 50 }}
|
||||
title={t('devices.robotPanoramaVideo', { robot: executingRobot.deviceAlias || executingRobot.serialNumber })}
|
||||
title={t('devices.robotPanoramaVideo', { robot: targetRobot.deviceAlias || targetRobot.serialNumber })}
|
||||
onClose={() => setShowVideo(false)}
|
||||
>
|
||||
<div style={{ height: '100%', width: '100%' }}>
|
||||
<MowerAllView
|
||||
serialNumber={executingRobot.serialNumber}
|
||||
robotVideo={robotVideo}
|
||||
ready={ready}
|
||||
error={error}
|
||||
/>
|
||||
<AgrtcRoomRobot channel={targetRobot?.serialNumber || targetRobot?.device_sn || ""} cameraCount={cameraNum} />
|
||||
|
||||
</div>
|
||||
</DraggableBox>
|
||||
)}*/}
|
||||
)}
|
||||
</div >
|
||||
);
|
||||
}
|
||||
|
||||
@@ -198,4 +198,8 @@ h4, .ant-typography h4 { font-size: clamp(1rem, 1.5vw, 1.25rem) !important; }
|
||||
}
|
||||
}
|
||||
|
||||
.badge-rtc-connected .ant-badge-status-text{
|
||||
color:#fff !important
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -492,6 +492,7 @@
|
||||
autoFetch: 'Auto Fetch',
|
||||
autoResumeFromBreakpoint: 'Auto Resume From Breakpoint',
|
||||
backView: 'Back View',
|
||||
showGuideLine: "Show Guide Line",
|
||||
batteryCapacity: 'Battery Capacity',
|
||||
batteryWithPercent: 'Battery with Percent',
|
||||
batteryWithValue: 'Battery with Value',
|
||||
|
||||
@@ -513,6 +513,7 @@ const zh = {
|
||||
autoFetch: '自动获取',
|
||||
autoResumeFromBreakpoint: '自动恢复从断点',
|
||||
backView: '后视角',
|
||||
showGuideLine: "显示辅助线",
|
||||
batteryCapacity: '电量容量',
|
||||
batteryWithPercent: '电量带百分比',
|
||||
batteryWithValue: '电量带值',
|
||||
|
||||
Reference in New Issue
Block a user