-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplay.html
More file actions
135 lines (119 loc) · 3.67 KB
/
Copy pathdisplay.html
File metadata and controls
135 lines (119 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<!DOCTYPE html>
<!--
Copyright (C) 2026 Chris Whitehouse (bakedpanda)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ATEM Display Output</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
width: 100%;
height: 100%;
overflow: hidden;
background: #000;
}
#output-frame {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
}
#user-css { }
#user-content {
width: 100%;
height: 100%;
position: relative;
z-index: 1;
}
#overlay {
position: fixed;
z-index: 100;
pointer-events: none;
}
#overlay.bottom-left { bottom: 0; left: 0; }
#overlay.bottom-right { bottom: 0; right: 0; }
#overlay.top-left { top: 0; left: 0; }
#overlay.top-right { top: 0; right: 0; }
#overlay.center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
</style>
</head>
<body>
<div id="output-frame">
<style id="user-css"></style>
<div id="user-content"></div>
<div id="overlay"></div>
</div>
<script>
const WS_URL = `ws://${location.host}`;
let ws;
let reconnectTimer;
function applyConfig(config) {
const frame = document.getElementById('output-frame');
const content = document.getElementById('user-content');
const cssEl = document.getElementById('user-css');
const overlay = document.getElementById('overlay');
// Background
frame.style.background = config.backgroundColor || '#000';
// Custom CSS
cssEl.textContent = config.customCss || '';
// Content mode
content.innerHTML = '';
if (config.mode === 'html') {
content.innerHTML = config.html || '';
} else if (config.mode === 'image' && config.imageUrl) {
const img = document.createElement('img');
img.src = config.imageUrl;
img.style.cssText = 'width:100%;height:100%;object-fit:contain;';
content.appendChild(img);
} else if (config.mode === 'color') {
// background color already applied above
}
// Overlay
overlay.className = 'overlay ' + (config.overlayPosition || 'bottom-left');
if (config.overlayEnabled && config.overlayText) {
overlay.style.cssText = config.overlayStyle || '';
overlay.textContent = config.overlayText;
overlay.style.display = 'block';
} else {
overlay.style.display = 'none';
}
// Resolution hint — Chromium will be launched at the right res,
// but we note it here for reference
document.title = `ATEM Output [${config.resolution || '1920x1080'} @ ${config.framerate || '25'}fps]`;
}
function connect() {
ws = new WebSocket(WS_URL);
ws.onmessage = (e) => {
try {
const msg = JSON.parse(e.data);
if (msg.type === 'config') applyConfig(msg.config);
} catch {}
};
ws.onclose = () => {
clearTimeout(reconnectTimer);
reconnectTimer = setTimeout(connect, 2000);
};
ws.onerror = () => ws.close();
}
// Initial load via REST in case WS is slow
fetch('/api/config')
.then(r => r.json())
.then(applyConfig)
.catch(() => {});
connect();
</script>
</body>
</html>