根据hashost字段 显示 视频
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import AgoraRTC, { IAgoraRTCClient, IRemoteVideoTrack } from "agora-rtc-sdk-ng";
|
||||
import { Card, Badge, message, Space } from "antd";
|
||||
import { Badge, message } from "antd";
|
||||
|
||||
const APP_ID = "875f6494d87548e783fefbf33f598c97";
|
||||
const TOKEN = "007eJxTYIjPuZr09PC0znd6+z0MMyL6ZHb68OetXW+kO1vHU2ZNtYECg4W5aZqZiaVJCpBhYpFqbmGclpqWlGZsnGZqaZFsaT6pZH5WQyAjA7e+LysjAwSC+JwMxmYlqcUlugZGDAwAbuYeJg==";
|
||||
@@ -195,23 +195,25 @@ export default function AgrtcRoomRobot({ CHANNEL }) {
|
||||
c.leave();
|
||||
clientRef.current = null;
|
||||
};
|
||||
}, [uid]);
|
||||
}, [uid, CHANNEL]);
|
||||
|
||||
return (
|
||||
<Card title="Agora RTC 上位机视频观看" style={{ width: 1000, margin: "20px auto" }}>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
<div>当前 UID:{uid}</div>
|
||||
<Badge color={connected ? "green" : "red"} text={connected ? "RTC 已连接" : "RTC 未连接"} />
|
||||
<Badge color={joined ? "green" : "orange"} text={joined ? "已加入频道" : "未加入频道"} />
|
||||
<div style={{ width: "100%", height: "100%", 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' } }}
|
||||
/>
|
||||
|
||||
<div style={{ marginTop: 20 }}>
|
||||
<h3>远端视频(上位机画面)</h3>
|
||||
<div
|
||||
ref={remoteVideoRef}
|
||||
style={{ width: 800, height: 600, background: "#000", borderRadius: 8, overflow: "hidden" }}
|
||||
/>
|
||||
</div>
|
||||
</Space>
|
||||
</Card>
|
||||
<span style={{ fontSize: 11, color: "#888" }}>频道:{CHANNEL}</span>
|
||||
</div>
|
||||
<div ref={remoteVideoRef} style={{ flex: 1, width: "100%", minHeight: 0 }} />
|
||||
</div >
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user