314 lines
10 KiB
HTML
314 lines
10 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: #000000;
|
|
--text-primary: #ffffff;
|
|
--text-secondary: #aaaaaa;
|
|
--accent-color: #555555;
|
|
--glass-bg: #111111;
|
|
--glass-border: #333333;
|
|
}
|
|
body {
|
|
font-family: 'Inter', sans-serif;
|
|
background-color: var(--bg-color);
|
|
color: var(--text-primary);
|
|
margin: 0;
|
|
height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
overflow: hidden; /* Prevent body scroll */
|
|
}
|
|
.header {
|
|
padding: 1.5rem 2rem 0.5rem 2rem;
|
|
}
|
|
h1 { margin: 0; font-size: 1.8rem; }
|
|
|
|
.main-content {
|
|
display: flex;
|
|
flex: 1;
|
|
padding: 1rem 2rem 2rem 2rem;
|
|
gap: 2rem;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.controls {
|
|
flex: 0 0 350px;
|
|
background: var(--glass-bg);
|
|
border: 1px solid var(--glass-border);
|
|
padding: 1.5rem;
|
|
display: flex;
|
|
flex-direction: column;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.preview-container {
|
|
flex: 1;
|
|
background: var(--glass-bg);
|
|
border: 1px solid var(--glass-border);
|
|
padding: 1.5rem;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
}
|
|
|
|
.preview-header {
|
|
width: 100%;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.preview-header h3 {
|
|
margin: 0;
|
|
color: var(--text-primary);
|
|
}
|
|
|
|
input, button, select {
|
|
font-family: inherit;
|
|
padding: 0.8rem 1rem;
|
|
border: 1px solid var(--glass-border);
|
|
margin-bottom: 1rem;
|
|
width: 100%;
|
|
box-sizing: border-box;
|
|
font-size: 1rem;
|
|
}
|
|
input, select {
|
|
background: rgba(0,0,0,0.5);
|
|
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: #777777; transform: translateY(-2px); }
|
|
button:disabled { background: #333333; cursor: not-allowed; transform: none; }
|
|
|
|
.video-wrapper {
|
|
flex: 1;
|
|
width: 100%;
|
|
background: #000;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
overflow: hidden;
|
|
position: relative;
|
|
}
|
|
|
|
video {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: contain;
|
|
display: none;
|
|
}
|
|
|
|
.video-placeholder {
|
|
color: var(--text-secondary);
|
|
text-align: center;
|
|
position: absolute;
|
|
}
|
|
|
|
.status { color: var(--text-secondary); margin-bottom: 1rem; text-align: center; }
|
|
|
|
.label {
|
|
display: block;
|
|
text-align: left;
|
|
margin: 0 0 0.5rem 0;
|
|
color: var(--text-secondary);
|
|
font-size: 0.9rem;
|
|
}
|
|
|
|
.section-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin: 1.5rem 0 1rem 0;
|
|
}
|
|
.section-header h3 { margin: 0; font-size: 1.1rem; }
|
|
.section-header button { width: auto; margin: 0; padding: 0.4rem 0.8rem; font-size: 0.85rem;}
|
|
|
|
/* Source Grid */
|
|
.sources-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
|
|
gap: 10px;
|
|
max-height: 250px;
|
|
margin: 0 0 1.5rem 0;
|
|
padding: 10px;
|
|
background: rgba(0,0,0,0.5);
|
|
border: 1px solid var(--glass-border);
|
|
}
|
|
|
|
/* Single Item Override */
|
|
.sources-grid.single-item {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
.sources-grid.single-item .source-item {
|
|
width: 250px;
|
|
min-width: 250px;
|
|
flex-shrink: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
.source-item {
|
|
cursor: pointer;
|
|
padding: 8px;
|
|
background: rgba(255,255,255,0.05);
|
|
transition: all 0.2s ease;
|
|
text-align: center;
|
|
border: 2px solid transparent;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
.source-item:hover {
|
|
background: rgba(255,255,255,0.1);
|
|
}
|
|
.source-item.selected {
|
|
background: rgba(255, 255, 255, 0.2);
|
|
border-color: var(--text-primary);
|
|
}
|
|
.source-item img {
|
|
width: 100%;
|
|
margin-bottom: 4px;
|
|
object-fit: contain;
|
|
aspect-ratio: 16/9;
|
|
background: #000;
|
|
}
|
|
.source-item span {
|
|
display: block;
|
|
font-size: 0.8rem;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
color: #e2e8f0;
|
|
line-height: 1.2;
|
|
padding-top: 4px;
|
|
}
|
|
|
|
/* Stats Panel */
|
|
.stats-panel {
|
|
background: rgba(0,0,0,0.7);
|
|
padding: 1rem;
|
|
margin-top: 1rem;
|
|
text-align: left;
|
|
display: none;
|
|
font-family: monospace;
|
|
font-size: 0.95rem;
|
|
color: #aaaaaa; /* grey text */
|
|
}
|
|
|
|
/* Custom Scrollbar */
|
|
::-webkit-scrollbar {
|
|
width: 8px;
|
|
height: 8px;
|
|
}
|
|
::-webkit-scrollbar-track {
|
|
background: var(--glass-bg);
|
|
border-left: 1px solid var(--glass-border);
|
|
}
|
|
::-webkit-scrollbar-thumb {
|
|
background: var(--accent-color);
|
|
}
|
|
::-webkit-scrollbar-thumb:hover {
|
|
background: #777777;
|
|
}
|
|
|
|
/* Responsive Layout */
|
|
@media (max-width: 900px) {
|
|
body {
|
|
overflow-y: auto;
|
|
height: auto;
|
|
}
|
|
.main-content {
|
|
flex-direction: column;
|
|
overflow: visible;
|
|
padding: 1rem;
|
|
}
|
|
.controls {
|
|
flex: none;
|
|
width: 100%;
|
|
overflow: visible;
|
|
box-sizing: border-box;
|
|
}
|
|
.preview-container {
|
|
min-height: 400px;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="main-content">
|
|
<!-- Left Column: Controls -->
|
|
<div class="controls" id="controlsPanel">
|
|
<label class="label">Server Connection</label>
|
|
<input type="text" id="serverUrl" placeholder="URL (e.g. http://localhost:3000)" value="http://localhost:3000">
|
|
<input type="password" id="serverPassword" placeholder="Stream Password">
|
|
|
|
<div class="section-header">
|
|
<h3>Media Sources</h3>
|
|
<button id="getSourcesBtn">Select new Source</button>
|
|
</div>
|
|
|
|
<label class="label">Visual Source (Screen/Window)</label>
|
|
<div id="sourcesGrid" class="sources-grid"></div>
|
|
|
|
<label class="label">Audio Source (Microphone/Virtual Sinks)</label>
|
|
<select id="audioSelect"></select>
|
|
|
|
<label class="label">Video Quality</label>
|
|
<select id="qualitySelect">
|
|
<option value="1000000|30">Low (1 Mbps / 30fps)</option>
|
|
<option value="4000000|30">Medium (4 Mbps / 30fps)</option>
|
|
<option value="8000000|60" selected>High (8 Mbps / 60fps)</option>
|
|
<option value="15000000|60">Ultra (15 Mbps / 60fps)</option>
|
|
<option value="30000000|60">Max (30 Mbps / 60fps)</option>
|
|
</select>
|
|
|
|
<div style="margin-top: auto;">
|
|
<button id="startBtn" disabled style="margin-bottom: 0.5rem;">Start Broadcast</button>
|
|
<div class="status" id="statusText">Not Broadcasting</div>
|
|
<div class="status" id="viewerCount" style="display:none; font-weight: bold; color: var(--text-primary);">Viewers: 0</div>
|
|
<button id="stopBtn" style="display:none; background:#444444; margin-bottom: 0.5rem;">Stop Broadcast</button>
|
|
</div>
|
|
|
|
<div class="stats-panel" id="statsPanel">
|
|
<div><strong>Res:</strong> <span id="statsRes">0x0</span></div>
|
|
<div><strong>FPS:</strong> <span id="statsFps">0</span></div>
|
|
<div><strong>Up:</strong> <span id="statsBitrate">0 kbps</span></div>
|
|
<div><strong>V-Codec:</strong> <span id="statsVideoCodec">...</span></div>
|
|
<div><strong>A-Codec:</strong> <span id="statsAudioCodec">...</span></div>
|
|
|
|
<div style="margin-top: 10px; height: 100px;">
|
|
<canvas id="bitrateChart"></canvas>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Right Column: Big Preview -->
|
|
<div class="preview-container">
|
|
<div class="preview-header">
|
|
</div>
|
|
<div class="video-wrapper">
|
|
<div id="videoPlaceholder" class="video-placeholder"></div>
|
|
<video id="localVideo" autoplay playsinline muted></video>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Use socket.io client script locally installed via npm -->
|
|
<script src="./node_modules/socket.io-client/dist/socket.io.js"></script>
|
|
<script src="./node_modules/chart.js/dist/chart.umd.js"></script>
|
|
<script src="renderer.js"></script>
|
|
</body>
|
|
</html>
|