From 14970f7296bb34db6b6766a67b96d131c2eb79c1 Mon Sep 17 00:00:00 2001
From: mmc <1556375442@qq.com>
Date: Wed, 3 Jun 2026 16:09:11 +0800
Subject: [PATCH] =?UTF-8?q?=E6=97=A0=E4=BA=BA=E6=9C=BA=E5=A3=B0=E6=9C=9B?=
=?UTF-8?q?=E8=A7=86=E9=A2=91=20=E6=88=90=E5=8A=9F=20=20=E4=B9=8B=E5=89=8D?=
=?UTF-8?q?=E5=AF=B9=E6=8E=A5=E7=9A=84=E9=83=BD=E6=98=AF=E7=81=AB=E5=B1=B1?=
=?UTF-8?q?=E7=9A=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/AgoraRtc.tsx | 172 +++++++-------------
src/components/devices/DroneVideoPlayer.tsx | 15 +-
2 files changed, 67 insertions(+), 120 deletions(-)
diff --git a/src/components/AgoraRtc.tsx b/src/components/AgoraRtc.tsx
index bab6d5c..5503a0b 100644
--- a/src/components/AgoraRtc.tsx
+++ b/src/components/AgoraRtc.tsx
@@ -27,15 +27,28 @@ const client = AgoraRTC.createClient({
codec: "vp8",
});
-export default function AgoraRtcRoom() {
+const parseUrlParams = (url) => {
+ const params = new URLSearchParams(url);
+ return {
+ appId: params.get("app_id") || "",
+ channel: params.get("channel") || "",
+ token: params.get("token") || "",
+ uid: params.get("uid") || String(Math.floor(Math.random() * 100000)),
+ sn: params.get("sn") || "",
+ };
+};
- const [uid] = useState(() =>
- String(
- Math.floor(
- Math.random() * 100000
- )
- )
- );
+export default function AgoraRtcRoom({ url = "" }) {
+ const { appId, channel, token, uid } = parseUrlParams(url);
+
+
+ //const [uid] = useState(() =>
+ // String(
+ // Math.floor(
+ // Math.random() * 100000
+ // )
+ // )
+ //);
const [connected, setConnected] =
useState(false);
@@ -148,10 +161,17 @@ export default function AgoraRtcRoom() {
);
// 加入频道
+ //await client.join(
+ // APP_ID,
+ // CHANNEL,
+ // TOKEN,
+ // uid
+ //);
+
await client.join(
- APP_ID,
- CHANNEL,
- TOKEN,
+ appId,
+ channel,
+ token,
uid
);
@@ -246,122 +266,40 @@ export default function AgoraRtcRoom() {
return (
-
-
+ />
-
- 当前 UID:{uid}
-
-
-
+
-
-
-
-
-
-
);
}
diff --git a/src/components/devices/DroneVideoPlayer.tsx b/src/components/devices/DroneVideoPlayer.tsx
index bc4def7..db1fe60 100644
--- a/src/components/devices/DroneVideoPlayer.tsx
+++ b/src/components/devices/DroneVideoPlayer.tsx
@@ -4,6 +4,7 @@ import { ReloadOutlined } from '@ant-design/icons';
import DroneLivePlayer from '../VolcRtcPlayer.jsx';
import { changeCameragateway, changeCameraPlane } from '../../api/device.ts';
import utils from '../../lib/utils';
+import AgoraRtcRoom from '../AgoraRtc.tsx';
const { Text } = Typography;
@@ -245,10 +246,18 @@ const DroneVideoPlayer: React.FC = ({
)}
- {/* 视频内容 */}
{streamData ? (
-
+ streamData?.url_type == "volc" ? (
+
+ ) : (
+
+ )
) : (