Files
yass/client/index.html

177 lines
5.9 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Screenshare Broadcaster</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap" rel="stylesheet">
<style>
:root {
--bg-color: #0f172a;
--text-primary: #f8fafc;
--text-secondary: #94a3b8;
--accent-color: #3b82f6;
--glass-bg: rgba(30, 41, 59, 0.7);
--glass-border: rgba(255, 255, 255, 0.1);
}
body {
font-family: 'Inter', sans-serif;
background-color: var(--bg-color);
color: var(--text-primary);
margin: 0;
padding: 2rem;
display: flex;
flex-direction: column;
align-items: center;
}
h1 { margin-top: 0; }
.controls {
background: var(--glass-bg);
border: 1px solid var(--glass-border);
border-radius: 12px;
padding: 2rem;
width: 100%;
max-width: 600px;
text-align: center;
margin-bottom: 2rem;
}
input, button, select {
font-family: inherit;
padding: 0.8rem 1rem;
border-radius: 8px;
border: 1px solid var(--glass-border);
margin-bottom: 1rem;
width: 90%;
font-size: 1rem;
}
input, select {
background: rgba(0,0,0,0.2);
color: white;
outline: none;
}
button {
background: var(--accent-color);
color: white;
font-weight: 600;
cursor: pointer;
border: none;
transition: all 0.2s;
}
button:hover { background: #2563eb; transform: translateY(-2px); }
button:disabled { background: #475569; cursor: not-allowed; transform: none; }
video {
width: 100%;
max-width: 800px;
border-radius: 12px;
background: #000;
display: none;
}
.status { color: var(--text-secondary); margin-bottom: 1rem; }
.label {
display: block;
text-align: left;
width: 90%;
margin: 0 auto 0.5rem auto;
color: var(--text-secondary);
font-size: 0.9rem;
}
/* Source Grid */
.sources-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
gap: 15px;
width: 90%;
max-height: 250px;
overflow-y: auto;
margin: 0 auto 1.5rem auto;
padding: 10px;
background: rgba(0,0,0,0.2);
border-radius: 8px;
border: 1px solid var(--glass-border);
}
.source-item {
cursor: pointer;
border-radius: 6px;
padding: 8px;
background: rgba(255,255,255,0.05);
transition: all 0.2s ease;
text-align: center;
border: 2px solid transparent;
}
.source-item:hover {
background: rgba(255,255,255,0.1);
}
.source-item.selected {
background: rgba(59, 130, 246, 0.2);
border-color: var(--accent-color);
}
.source-item img {
width: 100%;
border-radius: 4px;
margin-bottom: 8px;
object-fit: cover;
aspect-ratio: 16/9;
}
.source-item span {
display: block;
font-size: 0.85rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* Stats Panel */
.stats-panel {
background: rgba(0,0,0,0.4);
border-radius: 8px;
padding: 1rem;
width: 90%;
margin: 1rem auto;
text-align: left;
display: none;
font-family: monospace;
font-size: 1.1rem;
color: #10b981; /* green text */
}
</style>
</head>
<body>
<h1>Broadcaster Client</h1>
<div class="controls" id="controlsPanel">
<label class="label">Server Connection</label>
<input type="text" id="serverUrl" placeholder="Server URL (e.g. http://localhost:3000)" value="http://localhost:3000">
<input type="password" id="serverPassword" placeholder="Stream Password">
<div style="display:flex; justify-content:space-between; align-items:center; width: 90%; margin: 10px auto;">
<h3 style="margin:0;">Media Sources</h3>
<button id="getSourcesBtn" style="width:auto; margin:0; padding: 0.4rem 0.8rem;">Refresh Devices</button>
</div>
<label class="label">Visual Source (Screen/Window)</label>
<div id="sourcesGrid" class="sources-grid"></div>
<label class="label">Audio Source (Microphone/Pipewire Virtual Sinks)</label>
<select id="audioSelect"></select>
<button id="startBtn" disabled style="margin-top: 1.5rem;">Start Broadcast</button>
<div class="status" id="statusText">Not Broadcasting</div>
<button id="stopBtn" style="display:none; background:#ef4444;">Stop Broadcast</button>
<div class="stats-panel" id="statsPanel">
<div><strong>Resolution:</strong> <span id="statsRes">0x0</span></div>
<div><strong>FPS:</strong> <span id="statsFps">0</span></div>
<div><strong>Upstream:</strong> <span id="statsBitrate">0 kbps</span></div>
</div>
</div>
<video id="localVideo" autoplay playsinline muted></video>
<!-- Use socket.io client script locally installed via npm -->
<script src="./node_modules/socket.io-client/dist/socket.io.js"></script>
<script src="renderer.js"></script>
</body>
</html>