声望测试

This commit is contained in:
mmc
2026-05-12 11:11:30 +08:00
parent 74107e7020
commit 307ee479db
9 changed files with 585 additions and 2335 deletions

193
package-lock.json generated
View File

@@ -15,6 +15,7 @@
"@tailwindcss/vite": "^4.1.14",
"@vitejs/plugin-react": "^5.0.4",
"@volcengine/rtc": "^4.66.37",
"agora-rtc-sdk-ng": "^4.24.3",
"antd": "^5.24.1",
"axios": "^1.15.1",
"cesium": "^1.140.0",
@@ -48,6 +49,53 @@
"vite": "^6.2.0"
}
},
"node_modules/@agora-js/media": {
"version": "4.24.3",
"resolved": "https://registry.npmjs.org/@agora-js/media/-/media-4.24.3.tgz",
"integrity": "sha512-aC471uaWWGSXnruoaJggi9Ltbp3ldYxMyIi61jOew960zVsHaw78YhTDVv27XX1NvPRqEPLyfyMGEX4av0xOKA==",
"license": "MIT",
"dependencies": {
"@agora-js/report": "4.24.3",
"@agora-js/shared": "4.24.3",
"agora-rte-extension": "^1.2.4",
"axios": "^1.13.6",
"webrtc-adapter": "8.2.0"
}
},
"node_modules/@agora-js/protocol": {
"version": "4.24.3",
"resolved": "https://registry.npmjs.org/@agora-js/protocol/-/protocol-4.24.3.tgz",
"integrity": "sha512-GWAV+J9wv53u5T/k4KAjsxQ9Y+n73bWc3dSBe7OHjWcSZQikcWRJoOtygQiZKWmpYV/ZW5LQ0R12jHI7GAG0cQ==",
"license": "MIT",
"dependencies": {
"@agora-js/media": "4.24.3",
"@agora-js/report": "4.24.3",
"@agora-js/shared": "4.24.3",
"@bufbuild/protobuf": "^2.9.0",
"@types/pako": "^2.0.0",
"pako": "^2.1.0"
}
},
"node_modules/@agora-js/report": {
"version": "4.24.3",
"resolved": "https://registry.npmjs.org/@agora-js/report/-/report-4.24.3.tgz",
"integrity": "sha512-A2Q13JbRlSYkEF0W6eMCJmnzmHSBzaWZORNnsS23GElwACSxoa2KTMcDp0MQhlsI9Ht6277ZuVSCdkT48A6Pwg==",
"license": "MIT",
"dependencies": {
"@agora-js/shared": "4.24.3",
"axios": "^1.13.6"
}
},
"node_modules/@agora-js/shared": {
"version": "4.24.3",
"resolved": "https://registry.npmjs.org/@agora-js/shared/-/shared-4.24.3.tgz",
"integrity": "sha512-PyKelGEuV/g4fTjDjANpBqPZMaY0NFdd0W4UcGtJ2rayVU+YAeztLvu4tpDbm14U4BG5dmz/N+VHckxFPgoIjQ==",
"license": "MIT",
"dependencies": {
"axios": "^1.13.6",
"ua-parser-js": "^0.7.34"
}
},
"node_modules/@ant-design/charts": {
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/@ant-design/charts/-/charts-2.6.7.tgz",
@@ -850,6 +898,12 @@
"node": ">=6.9.0"
}
},
"node_modules/@bufbuild/protobuf": {
"version": "2.12.0",
"resolved": "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.12.0.tgz",
"integrity": "sha512-B/XlCaFIP8LOwzo+bz5uFzATYokcwCKQcghqnlfwSmM5eX/qTkvDBnDPs+gXtX/RyjxJ4DRikECcPJbyALA8FA==",
"license": "(Apache-2.0 AND BSD-3-Clause)"
},
"node_modules/@cesium/engine": {
"version": "24.0.0",
"resolved": "https://registry.npmjs.org/@cesium/engine/-/engine-24.0.0.tgz",
@@ -2498,6 +2552,12 @@
"undici-types": "~6.21.0"
}
},
"node_modules/@types/pako": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@types/pako/-/pako-2.0.4.tgz",
"integrity": "sha512-VWDCbrLeVXJM9fihYodcLiIv0ku+AlOa/TQ1SvYOaBuyrSKgEcro95LJyIsJ4vSo6BXIxOKxiJAat04CmST9Fw==",
"license": "MIT"
},
"node_modules/@types/qs": {
"version": "6.15.0",
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.15.0.tgz",
@@ -2617,6 +2677,30 @@
"node": ">= 0.6"
}
},
"node_modules/agora-rtc-sdk-ng": {
"version": "4.24.3",
"resolved": "https://registry.npmjs.org/agora-rtc-sdk-ng/-/agora-rtc-sdk-ng-4.24.3.tgz",
"integrity": "sha512-DEz0+/jgsajZgWFG/uHijoMeheqr7YWUJ5AyubiqKt5vC1TF0/3v51vVl2aqupY+YkmJOg0q64B4AJcdpj/TBQ==",
"license": "MIT",
"dependencies": {
"@agora-js/media": "4.24.3",
"@agora-js/protocol": "4.24.3",
"@agora-js/report": "4.24.3",
"@agora-js/shared": "4.24.3",
"agora-rte-extension": "^1.2.4",
"axios": "^1.13.6",
"formdata-polyfill": "^4.0.7",
"pako": "^2.1.0",
"ua-parser-js": "^0.7.34",
"webrtc-adapter": "8.2.0"
}
},
"node_modules/agora-rte-extension": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/agora-rte-extension/-/agora-rte-extension-1.2.4.tgz",
"integrity": "sha512-0ovZz1lbe30QraG1cU+ji7EnQ8aUu+Hf3F+a8xPml3wPOyUQEK6CTdxV9kMecr9t+fIDrGeW7wgJTsM1DQE7Nw==",
"license": "ISC"
},
"node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
@@ -3990,6 +4074,29 @@
"integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==",
"license": "MIT"
},
"node_modules/fetch-blob": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
"integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/jimmywarting"
},
{
"type": "paypal",
"url": "https://paypal.me/jimmywarting"
}
],
"license": "MIT",
"dependencies": {
"node-domexception": "^1.0.0",
"web-streams-polyfill": "^3.0.3"
},
"engines": {
"node": "^12.20 || >= 14.13"
}
},
"node_modules/fill-range": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
@@ -4093,6 +4200,18 @@
"node": ">= 6"
}
},
"node_modules/formdata-polyfill": {
"version": "4.0.10",
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
"integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
"license": "MIT",
"dependencies": {
"fetch-blob": "^3.1.2"
},
"engines": {
"node": ">=12.20.0"
}
},
"node_modules/forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
@@ -5107,6 +5226,26 @@
"node": ">= 0.6"
}
},
"node_modules/node-domexception": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
"deprecated": "Use your platform's native DOMException instead",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/jimmywarting"
},
{
"type": "github",
"url": "https://paypal.me/jimmywarting"
}
],
"license": "MIT",
"engines": {
"node": ">=10.5.0"
}
},
"node_modules/node-releases": {
"version": "2.0.37",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.37.tgz",
@@ -6370,6 +6509,12 @@
"compute-scroll-into-view": "^3.0.2"
}
},
"node_modules/sdp": {
"version": "3.2.2",
"resolved": "https://registry.npmjs.org/sdp/-/sdp-3.2.2.tgz",
"integrity": "sha512-xZocWwfyp4hkbN4hLWxMjmv2Q8aNa9MhmOZ7L9aCZPT+dZsgRr6wZRrSYE3HTdyk/2pZKPSgqI7ns7Een1xMSA==",
"license": "MIT"
},
"node_modules/semver": {
"version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
@@ -6806,6 +6951,32 @@
"node": ">=14.17"
}
},
"node_modules/ua-parser-js": {
"version": "0.7.41",
"resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.41.tgz",
"integrity": "sha512-O3oYyCMPYgNNHuO7Jjk3uacJWZF8loBgwrfd/5LE/HyZ3lUIOdniQ7DNXJcIgZbwioZxk0fLfI4EVnetdiX5jg==",
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/ua-parser-js"
},
{
"type": "paypal",
"url": "https://paypal.me/faisalman"
},
{
"type": "github",
"url": "https://github.com/sponsors/faisalman"
}
],
"license": "MIT",
"bin": {
"ua-parser-js": "script/cli.js"
},
"engines": {
"node": "*"
}
},
"node_modules/undici-types": {
"version": "6.21.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
@@ -7532,6 +7703,28 @@
"@esbuild/win32-x64": "0.25.12"
}
},
"node_modules/web-streams-polyfill": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
"integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
"license": "MIT",
"engines": {
"node": ">= 8"
}
},
"node_modules/webrtc-adapter": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/webrtc-adapter/-/webrtc-adapter-8.2.0.tgz",
"integrity": "sha512-umxCMgedPAVq4Pe/jl3xmelLXLn4XZWFEMR5Iipb5wJ+k1xMX0yC4ZY9CueZUU1MjapFxai1tFGE7R/kotH6Ww==",
"license": "BSD-3-Clause",
"dependencies": {
"sdp": "^3.0.2"
},
"engines": {
"node": ">=6.0.0",
"npm": ">=3.10.0"
}
},
"node_modules/which-module": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz",

View File

@@ -18,6 +18,7 @@
"@tailwindcss/vite": "^4.1.14",
"@vitejs/plugin-react": "^5.0.4",
"@volcengine/rtc": "^4.66.37",
"agora-rtc-sdk-ng": "^4.24.3",
"antd": "^5.24.1",
"axios": "^1.15.1",
"cesium": "^1.140.0",

2
public/js/jswebrtc.min.js vendored Normal file

File diff suppressed because one or more lines are too long

16
public/js/jswebrtcnew.js Normal file
View File

@@ -0,0 +1,16 @@
// 覆盖 startLoading,强制 HTTPS + 域名,不用 1985
(function() {
const oldStartLoading = JSWebrtc.Player.prototype.startLoading;
JSWebrtc.Player.prototype.startLoading = function() {
// 强制域名
this.urlParams.server = "ri.satabot.com";
// 使用 HTTPS 默认端口(内部拼接会自动处理)
delete this.urlParams.port;
// this.urlParams.port = 443;
// 强制 play API 路径
this.urlParams.user_query.play = "/rtc/rtc/v1/play/";
return oldStartLoading.apply(this, arguments);
};
})();

83
public/js/tailwind.js Normal file

File diff suppressed because one or more lines are too long

287
src/components/AgoraRtc.tsx Normal file
View File

@@ -0,0 +1,287 @@
import React, { useEffect, useState } from "react";
import AgoraRTC, {
IMicrophoneAudioTrack,
} from "agora-rtc-sdk-ng";
import {
Button,
Card,
Badge,
message,
} from "antd";
const APP_ID =
"62a87b833b7e48888aca06b625f88c14";
const CHANNEL =
"test_rtc_channel";
const TOKEN =
"007eJxTYGhZyLP1Ekt5av/jV1mPpi98fG75FqcXvDl7/wuUJjNeEVukwGBmlGhhnmRhbJxknmpiAQSJyYkGZklmRqZpFhbJhiYfZjJlNQQyMrDxcrIwMkAgiC/AUJJaXBJfVJIcn5yRmJeXmsPAAABcCyR4";
const client = AgoraRTC.createClient({
mode: "rtc",
codec: "vp8",
});
export default function AgoraRtcTest() {
const [uid] = useState(() =>
String(Math.floor(Math.random() * 100000))
);
const [connected, setConnected] =
useState(false);
const [published, setPublished] =
useState(false);
const [remoteUsers, setRemoteUsers] =
useState<any[]>([]);
useEffect(() => {
const init = async () => {
try {
// 连接状态
client.on(
"connection-state-change",
(state) => {
console.log(
"连接状态:",
state
);
if (
state === "CONNECTED"
) {
setConnected(true);
message.success(
"RTC 已连接"
);
}
}
);
// 远端用户发布
client.on(
"user-published",
async (user, mediaType) => {
console.log(
"收到远端流:",
user.uid,
mediaType
);
await client.subscribe(
user,
mediaType
);
if (
mediaType === "audio"
) {
user.audioTrack?.play();
message.success(
`收到用户 ${user.uid} 音频流`
);
}
setRemoteUsers([
...client.remoteUsers
]);
}
);
// 用户离开
client.on(
"user-left",
(user) => {
console.log(
"用户离开:",
user.uid
);
setRemoteUsers([
...client.remoteUsers
]);
}
);
// 加入频道
await client.join(
APP_ID,
CHANNEL,
TOKEN,
uid
);
console.log(
"加入频道成功"
);
} catch (err) {
console.error(err);
message.error(
"初始化失败"
);
}
};
init();
return () => {
client.leave();
};
}, []);
// 推流
const startPublish =
async () => {
try {
// 创建麦克风轨道
const micTrack:
IMicrophoneAudioTrack =
await AgoraRTC.createMicrophoneAudioTrack();
// 推流
await client.publish([
micTrack
]);
console.log(
"推流成功"
);
message.success(
"开始推流"
);
setPublished(true);
} catch (err) {
console.error(
"推流失败:",
err
);
message.error(
"推流失败"
);
}
};
return (
<Card
title="Agora RTC 推拉流测试"
style={{
width: 700,
margin: "30px auto",
}}
>
<div
style={{
marginBottom: 12,
}}
>
当前 UID:{uid}
</div>
<div
style={{
marginBottom: 12,
}}
>
<Badge
color={
connected
? "green"
: "red"
}
text={
connected
? "RTC 已连接"
: "RTC 未连接"
}
/>
</div>
<div
style={{
marginBottom: 20,
}}
>
<Badge
color={
published
? "green"
: "orange"
}
text={
published
? "已推流"
: "未推流"
}
/>
</div>
<Button
type="primary"
onClick={startPublish}
disabled={
!connected ||
published
}
>
开始推流
</Button>
<div
style={{
marginTop: 30,
}}
>
<h3>
远端用户:
</h3>
{remoteUsers.map(
(user) => (
<div
key={user.uid}
>
用户:
{user.uid}
</div>
)
)}
</div>
</Card>
);
}

File diff suppressed because it is too large Load Diff

View File

@@ -18,6 +18,7 @@ import { useSelector } from 'react-redux';
import { getDeviceListApi, getLiveStream, getPlaneDeviceList } from '../../api/device.ts';
import { RootState } from '@/src/store';
import DroneLivePlayer from '../VolcRtcPlayer.jsx';
import AgoraTextTest from '../AgoraRtc.tsx';
const { Content } = Layout;
const { Text, Title } = Typography;
@@ -137,6 +138,7 @@ export default function DeviceOverviewPage({ devices, planedevices, devicesAll,
return (
<Content style={{ maxWidth: 1800, margin: '0 auto', }}>
<AgoraTextTest />
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '16px', marginBottom: 20 }}>
{dynamicTopCards.map((card, idx) => (
<div key={idx} style={{ flex: 1 }}>

View File

@@ -18,6 +18,7 @@ import { useSelector } from 'react-redux';
import { RootState } from '@/src/store/index.ts';
import envConfig from '../../../env';
const { Text } = Typography;
const OBSTACLE_TYPE = {