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" ? (
+
+ ) : (
+
+ )
) : (