install go2rtc on bob
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>net - go2rtc</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/vis-network@10.0.2/standalone/umd/vis-network.min.js"></script>
|
||||
<style>
|
||||
html, body, #network {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script src="main.js"></script>
|
||||
|
||||
<div id="network"></div>
|
||||
|
||||
<script>
|
||||
/* global vis */
|
||||
window.addEventListener('load', () => {
|
||||
const url = new URL('api/streams.dot' + location.search, location.href);
|
||||
|
||||
const container = document.getElementById('network');
|
||||
const options = {
|
||||
edges: {
|
||||
font: {align: 'middle'},
|
||||
smooth: false,
|
||||
},
|
||||
nodes: {shape: 'box'},
|
||||
physics: false,
|
||||
};
|
||||
|
||||
let network;
|
||||
|
||||
async function update() {
|
||||
try {
|
||||
const response = await fetch(url, {cache: 'no-cache'});
|
||||
const dotData = await response.text();
|
||||
const data = vis.parseDOTNetwork(dotData);
|
||||
|
||||
if (!network) {
|
||||
network = new vis.Network(container, data, options);
|
||||
network.storePositions();
|
||||
} else {
|
||||
const positions = network.getPositions();
|
||||
const viewPosition = network.getViewPosition();
|
||||
const scale = network.getScale();
|
||||
const selectedNodes = network.getSelectedNodes();
|
||||
|
||||
network.setData(data);
|
||||
|
||||
for (const nodeId in positions) {
|
||||
network.moveNode(nodeId, positions[nodeId].x, positions[nodeId].y);
|
||||
}
|
||||
|
||||
network.moveTo({position: viewPosition, scale: scale});
|
||||
|
||||
network.selectNodes(selectedNodes);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching or updating network data:', error);
|
||||
}
|
||||
|
||||
setTimeout(update, 5000);
|
||||
}
|
||||
|
||||
update();
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user