视频成功 原因 token原因
This commit is contained in:
2
env.js
2
env.js
@@ -14,7 +14,7 @@ const envConfig = {
|
|||||||
WS_URL: 'ws://192.168.2.59:9002/ws/',
|
WS_URL: 'ws://192.168.2.59:9002/ws/',
|
||||||
},
|
},
|
||||||
[ENV.PROD]: {
|
[ENV.PROD]: {
|
||||||
// baseURL: 'http://192.168.2.56:8081',
|
//baseURL: 'https://pvcloudservice.satabot.com',
|
||||||
baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
|
baseURL: 'http://1.95.137.212:59015',//http://192.168.2.56:8081
|
||||||
//baseURL: 'https://serviceri.satabot.com',
|
//baseURL: 'https://serviceri.satabot.com',
|
||||||
WS_URL: 'ws://1.95.137.212:59017/ws/'
|
WS_URL: 'ws://1.95.137.212:59017/ws/'
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
<link rel="stylesheet"
|
<link rel="stylesheet"
|
||||||
href="https://lf-unpkg.volccdn.com/obj/vcloudfe/sdk/@volcengine/veplayer/2.11.2/umd/veplayer.production.css"
|
href="https://lf-unpkg.volccdn.com/obj/vcloudfe/sdk/@volcengine/veplayer/2.11.2/umd/veplayer.production.css"
|
||||||
media="print" onload="this.media='all'">
|
media="print" onload="this.media='all'">
|
||||||
|
<script src="/js/jswebrtc.min.js"></script>
|
||||||
|
<script src="/js/jswebrtcnew.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -44,8 +46,8 @@
|
|||||||
|
|
||||||
// 按顺序加载
|
// 按顺序加载
|
||||||
Promise.resolve()
|
Promise.resolve()
|
||||||
.then(() => loadScript('/js/jswebrtc.min.js'))
|
//.then(() => loadScript('/js/jswebrtc.min.js'))
|
||||||
.then(() => loadScript('/js/jswebrtcnew.js'))
|
//.then(() => loadScript('/js/jswebrtcnew.js'))
|
||||||
.then(() => loadScript('https://unpkg.com/leaflet@1.9.4/dist/leaflet.js'))
|
.then(() => loadScript('https://unpkg.com/leaflet@1.9.4/dist/leaflet.js'))
|
||||||
.then(() => loadScript('https://cdn.jsdelivr.net/npm/cesium@latest/Build/Cesium/Cesium.js'))
|
.then(() => loadScript('https://cdn.jsdelivr.net/npm/cesium@latest/Build/Cesium/Cesium.js'))
|
||||||
.then(() => loadScript('https://cdn.jsdelivr.net/npm/hls.js@1.5.8/dist/hls.min.js'))
|
.then(() => loadScript('https://cdn.jsdelivr.net/npm/hls.js@1.5.8/dist/hls.min.js'))
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ export default function CesiumMap({ realtimePosition, pathPoints = [], devices =
|
|||||||
id,
|
id,
|
||||||
position: window.Cesium.Cartesian3.fromDegrees(p.lon, p.lat),
|
position: window.Cesium.Cartesian3.fromDegrees(p.lon, p.lat),
|
||||||
point: {
|
point: {
|
||||||
color: window.Cesium.Color.SKYBLUE,
|
color: window.Cesium?.Color.SKYBLUE,
|
||||||
pixelSize: 10,
|
pixelSize: 10,
|
||||||
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
||||||
},
|
},
|
||||||
@@ -115,7 +115,7 @@ export default function CesiumMap({ realtimePosition, pathPoints = [], devices =
|
|||||||
text: `${i + 1}`,
|
text: `${i + 1}`,
|
||||||
font: '12px sans-serif',
|
font: '12px sans-serif',
|
||||||
pixelOffset: new window.Cesium.Cartesian2(0, -15),
|
pixelOffset: new window.Cesium.Cartesian2(0, -15),
|
||||||
fillColor: window.Cesium.Color.WHITE
|
fillColor: window.Cesium?.Color.WHITE
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
pointEntitiesRef.current.push(id);
|
pointEntitiesRef.current.push(id);
|
||||||
@@ -133,7 +133,7 @@ export default function CesiumMap({ realtimePosition, pathPoints = [], devices =
|
|||||||
polyline: {
|
polyline: {
|
||||||
positions: positions,
|
positions: positions,
|
||||||
width: 4,
|
width: 4,
|
||||||
material: window.Cesium.Color.SKYBLUE,
|
material: window.Cesium?.Color.SKYBLUE,
|
||||||
clampToGround: true,
|
clampToGround: true,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -202,9 +202,9 @@ export default function CesiumMap({ realtimePosition, pathPoints = [], devices =
|
|||||||
positions: positions,
|
positions: positions,
|
||||||
width: 3,
|
width: 3,
|
||||||
material: new Cesium.PolylineDashMaterialProperty({
|
material: new Cesium.PolylineDashMaterialProperty({
|
||||||
color: Cesium.Color.BLUE,
|
color: Cesium?.Color.BLUE,
|
||||||
dashLength: 16,
|
dashLength: 16,
|
||||||
gapColor: Cesium.Color.TRANSPARENT,
|
gapColor: Cesium?.Color.TRANSPARENT,
|
||||||
}),
|
}),
|
||||||
clampToGround: true,
|
clampToGround: true,
|
||||||
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
disableDepthTestDistance: Number.POSITIVE_INFINITY,
|
||||||
@@ -656,9 +656,9 @@ export default function CesiumMap({ realtimePosition, pathPoints = [], devices =
|
|||||||
text: robot.name,
|
text: robot.name,
|
||||||
font: "14px sans-serif",
|
font: "14px sans-serif",
|
||||||
pixelOffset: new window.Cesium.Cartesian2(0, -40),
|
pixelOffset: new window.Cesium.Cartesian2(0, -40),
|
||||||
fillColor: window.Cesium.Color.WHITE,
|
fillColor: window.Cesium?.Color.WHITE,
|
||||||
showBackground: true,
|
showBackground: true,
|
||||||
backgroundColor: window.Cesium.Color.BLACK.withAlpha(0.6)
|
backgroundColor: window.Cesium?.Color.BLACK.withAlpha(0.6)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
entity.robotData = robot;
|
entity.robotData = robot;
|
||||||
@@ -685,7 +685,7 @@ export default function CesiumMap({ realtimePosition, pathPoints = [], devices =
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
viewerRef.current = viewer;
|
viewerRef.current = viewer;
|
||||||
viewer.scene.globe.baseColor = window.Cesium.Color.BLACK;
|
viewer.scene.globe.baseColor = window.Cesium?.Color.BLACK;
|
||||||
viewer.scene.globe.depthTestAgainstTerrain = false;
|
viewer.scene.globe.depthTestAgainstTerrain = false;
|
||||||
viewer.scene.requestRenderMode = true; // 👈 加这个(只在需要时渲染)
|
viewer.scene.requestRenderMode = true; // 👈 加这个(只在需要时渲染)
|
||||||
viewer.scene.globe.enableLighting = false;
|
viewer.scene.globe.enableLighting = false;
|
||||||
@@ -854,9 +854,9 @@ export default function CesiumMap({ realtimePosition, pathPoints = [], devices =
|
|||||||
text: device.name || "",
|
text: device.name || "",
|
||||||
font: "12px sans-serif",
|
font: "12px sans-serif",
|
||||||
pixelOffset: new Cesium.Cartesian2(0, -40),
|
pixelOffset: new Cesium.Cartesian2(0, -40),
|
||||||
fillColor: Cesium.Color.WHITE,
|
fillColor: Cesium?.Color.WHITE,
|
||||||
showBackground: true,
|
showBackground: true,
|
||||||
backgroundColor: Cesium.Color.BLACK.withAlpha(0.6)
|
backgroundColor: Cesium?.Color.BLACK.withAlpha(0.6)
|
||||||
},
|
},
|
||||||
|
|
||||||
properties: {
|
properties: {
|
||||||
@@ -1259,7 +1259,7 @@ export default function CesiumMap({ realtimePosition, pathPoints = [], devices =
|
|||||||
|
|
||||||
material: new Cesium.PolylineGlowMaterialProperty({
|
material: new Cesium.PolylineGlowMaterialProperty({
|
||||||
glowPower: 0.25,
|
glowPower: 0.25,
|
||||||
color: Cesium.Color.LIME
|
color: Cesium?.Color.LIME
|
||||||
}),
|
}),
|
||||||
|
|
||||||
clampToGround: true,
|
clampToGround: true,
|
||||||
|
|||||||
@@ -151,13 +151,13 @@ const VideoCanvas: React.FC<Props> = ({ video, idx, title, className, noCrop })
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="absolute inset-0 pointer-events-none">
|
<div className="absolute inset-0 pointer-events-none">
|
||||||
<div className="absolute top-5 left-12 px-2 py-0.5 bg-black/60 rounded text-[10px] text-cyan-400">
|
{/*<div className="absolute top-5 left-12 px-2 py-0.5 bg-black/60 rounded text-[10px] text-cyan-400">
|
||||||
{title}
|
{title}
|
||||||
</div>
|
</div>*/}
|
||||||
<div className="absolute top-5 right-12 text-cyan-400 text-[8px] flex items-center gap-1">
|
{/*<div className="absolute top-5 right-12 text-cyan-400 text-[8px] flex items-center gap-1">
|
||||||
<span className="w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse" />
|
<span className="w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse" />
|
||||||
LIVE
|
LIVE
|
||||||
</div>
|
</div>*/}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -42,6 +42,9 @@ import { RootState } from '@/src/store/index.ts';
|
|||||||
import { useWebRTCPlayer } from '../useWebRTCStream.tsx';
|
import { useWebRTCPlayer } from '../useWebRTCStream.tsx';
|
||||||
import VideoPlayer from '../VideoPlayer.tsx';
|
import VideoPlayer from '../VideoPlayer.tsx';
|
||||||
import DeviceController from './DeviceController';
|
import DeviceController from './DeviceController';
|
||||||
|
import { DatePicker } from 'antd';
|
||||||
|
import dayjs from 'dayjs';
|
||||||
|
const { RangePicker } = DatePicker;
|
||||||
|
|
||||||
const { Text } = Typography;
|
const { Text } = Typography;
|
||||||
|
|
||||||
@@ -62,6 +65,13 @@ export default function DeviceStatusPage({
|
|||||||
const [connecting, setConnecting] = useState(false);
|
const [connecting, setConnecting] = useState(false);
|
||||||
const [wsStatus, setWsStatus] = useState('disconnected');
|
const [wsStatus, setWsStatus] = useState('disconnected');
|
||||||
const [wsDeviceInfo, setWsDeviceInfo] = useState({});
|
const [wsDeviceInfo, setWsDeviceInfo] = useState({});
|
||||||
|
const [selectedDrone, setSelectedDrone] = useState(null);
|
||||||
|
const [taskList, setTaskList] = useState([]);
|
||||||
|
|
||||||
|
// 👇 加上这两个
|
||||||
|
const [queryTimeRange, setQueryTimeRange] = useState([]); // 时间范围
|
||||||
|
const [startTimestamp, setStartTimestamp] = useState(''); // 开始时间戳
|
||||||
|
const [endTimestamp, setEndTimestamp] = useState(''); // 结束时间戳
|
||||||
|
|
||||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||||
const [modalContent, setModalContent] = useState({
|
const [modalContent, setModalContent] = useState({
|
||||||
@@ -303,7 +313,7 @@ export default function DeviceStatusPage({
|
|||||||
<Button type={mowerView === 'back' ? 'primary' : 'default'} onClick={() => setMowerView('back')}>后视</Button>
|
<Button type={mowerView === 'back' ? 'primary' : 'default'} onClick={() => setMowerView('back')}>后视</Button>
|
||||||
<Button type={mowerView === 'left' ? 'primary' : 'default'} onClick={() => setMowerView('left')}>左视</Button>
|
<Button type={mowerView === 'left' ? 'primary' : 'default'} onClick={() => setMowerView('left')}>左视</Button>
|
||||||
<Button type={mowerView === 'right' ? 'primary' : 'default'} onClick={() => setMowerView('right')}>右视</Button>
|
<Button type={mowerView === 'right' ? 'primary' : 'default'} onClick={() => setMowerView('right')}>右视</Button>
|
||||||
<Button type={mowerView === 'top' ? 'primary' : 'default'} onClick={() => setMowerView('top')}>顶视</Button>
|
{/*<Button type={mowerView === 'top' ? 'primary' : 'default'} onClick={() => setMowerView('top')}>顶视</Button>*/}
|
||||||
<Button type={mowerView === 'all' ? 'primary' : 'default'} onClick={() => setMowerView('all')}>全景</Button>
|
<Button type={mowerView === 'all' ? 'primary' : 'default'} onClick={() => setMowerView('all')}>全景</Button>
|
||||||
</Space>
|
</Space>
|
||||||
)}
|
)}
|
||||||
@@ -311,10 +321,10 @@ export default function DeviceStatusPage({
|
|||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
height: 450,
|
height: 450,
|
||||||
background: '#000',
|
|
||||||
borderRadius: 8,
|
borderRadius: 8,
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
flexWrap: 'wrap', // 允许换行
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isUAV ? (
|
{isUAV ? (
|
||||||
@@ -325,11 +335,10 @@ export default function DeviceStatusPage({
|
|||||||
style={{
|
style={{
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
height: '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<DroneLivePlayer streamData={s} />
|
<DroneLivePlayer streamData={s} />
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
@@ -338,22 +347,79 @@ export default function DeviceStatusPage({
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
) : robotVideo ? (
|
) : robotVideo ? (
|
||||||
<VideoPlayer
|
// 全景模式 = 4 分屏
|
||||||
deviceId={serialNumber}
|
mowerView === 'all' ? (
|
||||||
idx={
|
<div style={{
|
||||||
mowerView === 'front'
|
display: 'grid',
|
||||||
? 1
|
gridTemplateColumns: '1fr 1fr',
|
||||||
: mowerView === 'back'
|
width: '100%',
|
||||||
? 2
|
height: '100%'
|
||||||
: mowerView === 'left'
|
}}>
|
||||||
? 3
|
{/* 前 */}
|
||||||
: 4
|
<div style={{ position: 'relative', border: '1px solid #222' }}>
|
||||||
}
|
<VideoPlayer
|
||||||
className="w-full h-full object-contain"
|
deviceId={serialNumber}
|
||||||
video={robotVideo}
|
idx={1}
|
||||||
error={error}
|
className="w-full h-full object-contain"
|
||||||
ready={ready}
|
video={robotVideo}
|
||||||
/>
|
error={error}
|
||||||
|
ready={ready}
|
||||||
|
/>
|
||||||
|
<div style={{ position: 'absolute', top: 4, left: 8, color: '#fff', fontSize: 12, background: '#0006', padding: '2px 6px', borderRadius: 4 }}>前视</div>
|
||||||
|
</div>
|
||||||
|
{/* 后 */}
|
||||||
|
<div style={{ position: 'relative', border: '1px solid #222' }}>
|
||||||
|
<VideoPlayer
|
||||||
|
deviceId={serialNumber}
|
||||||
|
idx={2}
|
||||||
|
className="w-full h-full object-contain"
|
||||||
|
video={robotVideo}
|
||||||
|
error={error}
|
||||||
|
ready={ready}
|
||||||
|
/>
|
||||||
|
<div style={{ position: 'absolute', top: 4, left: 8, color: '#fff', fontSize: 12, background: '#0006', padding: '2px 6px', borderRadius: 4 }}>后视</div>
|
||||||
|
</div>
|
||||||
|
{/* 左 */}
|
||||||
|
<div style={{ position: 'relative', border: '1px solid #222' }}>
|
||||||
|
<VideoPlayer
|
||||||
|
deviceId={serialNumber}
|
||||||
|
idx={3}
|
||||||
|
className="w-full h-full object-contain"
|
||||||
|
video={robotVideo}
|
||||||
|
error={error}
|
||||||
|
ready={ready}
|
||||||
|
/>
|
||||||
|
<div style={{ position: 'absolute', top: 4, left: 8, color: '#fff', fontSize: 12, background: '#0006', padding: '2px 6px', borderRadius: 4 }}>左视</div>
|
||||||
|
</div>
|
||||||
|
{/* 右 */}
|
||||||
|
<div style={{ position: 'relative', border: '1px solid #222' }}>
|
||||||
|
<VideoPlayer
|
||||||
|
deviceId={serialNumber}
|
||||||
|
idx={4}
|
||||||
|
className="w-full h-full object-contain"
|
||||||
|
video={robotVideo}
|
||||||
|
error={error}
|
||||||
|
ready={ready}
|
||||||
|
/>
|
||||||
|
<div style={{ position: 'absolute', top: 4, left: 8, color: '#fff', fontSize: 12, background: '#0006', padding: '2px 6px', borderRadius: 4 }}>右视</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
// 单画面模式
|
||||||
|
<VideoPlayer
|
||||||
|
deviceId={serialNumber}
|
||||||
|
idx={
|
||||||
|
mowerView === 'front' ? 1
|
||||||
|
: mowerView === 'back' ? 2
|
||||||
|
: mowerView === 'left' ? 3
|
||||||
|
: 4
|
||||||
|
}
|
||||||
|
className="w-full h-full object-contain"
|
||||||
|
video={robotVideo}
|
||||||
|
error={error}
|
||||||
|
ready={ready}
|
||||||
|
/>
|
||||||
|
)
|
||||||
) : (
|
) : (
|
||||||
<div style={{ color: '#ccc', margin: 'auto' }}>
|
<div style={{ color: '#ccc', margin: 'auto' }}>
|
||||||
视频加载中...
|
视频加载中...
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ export function useWebRTCPlayer(deviceId: string, url: string) {
|
|||||||
v.style.height = '100%';
|
v.style.height = '100%';
|
||||||
v.style.objectFit = 'contain';
|
v.style.objectFit = 'contain';
|
||||||
videoRef.current = v;
|
videoRef.current = v;
|
||||||
|
const token = "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6Ijk2ZTQyYzJlLTYwNWMtNGU5MS05ZTJkLWE2NWUxM2VjZTMyZiJ9.l-F0LGxnfUD2WuATaHK7bYlguorGpGkkOR3Qpga7CWU1S_GiRI6U3At0gjOqx7DasZS7ChVsC_Csp6DX6HfArw"
|
||||||
const token = localStorage.getItem('videotoken') || JSON.parse(localStorage.getItem('userInfo') || '{}')?.token;
|
//const token = localStorage.getItem('videotoken') || JSON.parse(localStorage.getItem('userInfo') || '{}')?.token;
|
||||||
const videoUrl = `${url}?token=${token}`;
|
const videoUrl = `${url}?token=${token}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user