Files
BridgeSwarm/examples/screenshare/index.html
T
Raven Scott 8c95a97662
CI / Build & Test (push) Successful in 3m0s
fixes
2026-07-26 22:19:31 -04:00

55 lines
2.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>BridgeSwarm Screenshare</title>
<link rel="stylesheet" href="style.css">
<script>
if (location.protocol === 'file:') {
document.documentElement.innerHTML =
'<body style="margin:0;font:15px/1.5 Segoe UI,system-ui,sans-serif;background:#0f1419;color:#e7ecf3">' +
'<div style="max-width:36rem;margin:10vh auto;padding:24px;background:#1a2332;border:1px solid #2a3548;border-radius:14px">' +
'<h1 style="margin:0 0 10px;font-size:1.25rem">Open this demo over HTTP</h1>' +
'<p style="color:#8b9bb4">Browsers treat each <code>file://</code> URL as a unique security origin, so local demos break.</p>' +
'<p>From the BridgeSwarm repo root run:</p>' +
'<pre style="padding:12px;background:#0f1419;border-radius:10px;color:#2dd4bf">npm run examples</pre>' +
'<p style="color:#8b9bb4">Then open <code>http://127.0.0.1:4173/</code></p>' +
'</div></body>';
}
</script>
</head>
<body>
<h1>BridgeSwarm Screenshare</h1>
<p class="status" id="status">Load the extension, then join a topic. Share your screen or watch another tab's stream.</p>
<div class="row">
<input type="text" id="topic" placeholder="Topic (e.g. my-screenshare)" value="bridge-swarm-screenshare">
<button class="primary" id="btnJoin">Join</button>
<button class="danger" id="btnLeave" disabled>Leave</button>
</div>
<div class="peers" id="peers">Peers: 0</div>
<div class="peers" id="publicKey">Your public key: (join to generate)</div>
<div class="row">
<button class="primary" id="btnShare" disabled>Share my screen</button>
<button class="secondary" id="btnStopShare" disabled style="display: none;">Stop sharing</button>
</div>
<div class="video-wrap" id="videoWrap">
<video id="remoteVideo" autoplay playsinline muted controls></video>
<div class="placeholder-block" id="placeholderBlock">
<span class="placeholder" id="videoPlaceholder">Join a topic. Share your screen, or wait for a peer to share.</span>
<button class="primary" id="btnPlay" style="display: none;">Play</button>
</div>
</div>
<div class="row">
<button class="secondary" id="btnPip" disabled style="display: none;">Picture-in-Picture</button>
</div>
<p class="stream-state" id="streamState"></p>
<div class="preview-wrap" id="previewWrap" style="display: none;">
<span>Your shared screen (local preview):</span>
<video id="localPreview" autoplay playsinline muted controls></video>
</div>
<script src="app.js"></script>
</body>
</html>