minor bug fixes
This commit is contained in:
committed by
GitHub
parent
46e2c58ba8
commit
e398ad69c3
+27
-27
@@ -1330,11 +1330,11 @@
|
||||
function initCamerman() {
|
||||
const video = document.getElementById('cammanVideo');
|
||||
if (!video) return;
|
||||
const idx = CAMERAS.findIndex(([,s]) => s === 'cameraman-5');
|
||||
const idx = CAMERAS.findIndex(([,s]) => s === 'cameraman2-5');
|
||||
if (typeof Hls !== 'undefined' && Hls.isSupported()) {
|
||||
if (hlsInstances['camman']) hlsInstances['camman'].destroy();
|
||||
const hls = new Hls({ lowLatencyMode: true, maxBufferLength: 8 });
|
||||
hls.loadSource('http://localhost:3000/cam/cameraman-5/index.m3u8');
|
||||
hls.loadSource('http://localhost:3000/cam/cameraman2-5/index.m3u8');
|
||||
hls.attachMedia(video);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, () => video.play().catch(() => {}));
|
||||
hls.on(Hls.Events.ERROR, (e, d) => {
|
||||
@@ -1349,7 +1349,7 @@
|
||||
});
|
||||
hlsInstances['camman'] = hls;
|
||||
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = 'http://localhost:3000/cam/cameraman-5/index.m3u8';
|
||||
video.src = 'http://localhost:3000/cam/cameraman2-5/index.m3u8';
|
||||
video.play().catch(() => {});
|
||||
}
|
||||
}
|
||||
@@ -1360,7 +1360,7 @@
|
||||
_origSetFeatured(i);
|
||||
// If cameraman is now in featured, show director in camman panel
|
||||
// If cameraman is what's being swapped back, restore its own stream
|
||||
const cammanIdx = CAMERAS.findIndex(([,s]) => s === 'cameraman-5');
|
||||
const cammanIdx = CAMERAS.findIndex(([,s]) => s === 'cameraman2-5');
|
||||
const cammanVideo = document.getElementById('cammanVideo');
|
||||
const cammanLabel = document.getElementById('cammanLabel');
|
||||
if (!cammanVideo) return;
|
||||
@@ -1381,7 +1381,7 @@
|
||||
// Restore camman panel to cameraman stream
|
||||
if (hlsInstances['camman']) hlsInstances['camman'].destroy();
|
||||
const hls = new Hls({ lowLatencyMode: true, maxBufferLength: 8 });
|
||||
hls.loadSource('http://localhost:3000/cam/cameraman-5/index.m3u8');
|
||||
hls.loadSource('http://localhost:3000/cam/cameraman2-5/index.m3u8');
|
||||
hls.attachMedia(cammanVideo);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, () => { cammanVideo.muted = true; cammanVideo.play().catch(() => {}); });
|
||||
hlsInstances['camman'] = hls;
|
||||
@@ -1419,11 +1419,11 @@
|
||||
function initCamerman() {
|
||||
const video = document.getElementById('cammanVideo');
|
||||
if (!video) return;
|
||||
const idx = CAMERAS.findIndex(([,s]) => s === 'cameraman-5');
|
||||
const idx = CAMERAS.findIndex(([,s]) => s === 'cameraman2-5');
|
||||
if (typeof Hls !== 'undefined' && Hls.isSupported()) {
|
||||
if (hlsInstances['camman']) hlsInstances['camman'].destroy();
|
||||
const hls = new Hls({ lowLatencyMode: true, maxBufferLength: 8 });
|
||||
hls.loadSource('http://localhost:3000/cam/cameraman-5/index.m3u8');
|
||||
hls.loadSource('http://localhost:3000/cam/cameraman2-5/index.m3u8');
|
||||
hls.attachMedia(video);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, () => video.play().catch(() => {}));
|
||||
hls.on(Hls.Events.ERROR, (e, d) => {
|
||||
@@ -1438,7 +1438,7 @@
|
||||
});
|
||||
hlsInstances['camman'] = hls;
|
||||
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = 'http://localhost:3000/cam/cameraman-5/index.m3u8';
|
||||
video.src = 'http://localhost:3000/cam/cameraman2-5/index.m3u8';
|
||||
video.play().catch(() => {});
|
||||
}
|
||||
}
|
||||
@@ -1449,7 +1449,7 @@
|
||||
_origSetFeatured(i);
|
||||
// If cameraman is now in featured, show director in camman panel
|
||||
// If cameraman is what's being swapped back, restore its own stream
|
||||
const cammanIdx = CAMERAS.findIndex(([,s]) => s === 'cameraman-5');
|
||||
const cammanIdx = CAMERAS.findIndex(([,s]) => s === 'cameraman2-5');
|
||||
const cammanVideo = document.getElementById('cammanVideo');
|
||||
const cammanLabel = document.getElementById('cammanLabel');
|
||||
if (!cammanVideo) return;
|
||||
@@ -1470,7 +1470,7 @@
|
||||
// Restore camman panel to cameraman stream
|
||||
if (hlsInstances['camman']) hlsInstances['camman'].destroy();
|
||||
const hls = new Hls({ lowLatencyMode: true, maxBufferLength: 8 });
|
||||
hls.loadSource('http://localhost:3000/cam/cameraman-5/index.m3u8');
|
||||
hls.loadSource('http://localhost:3000/cam/cameraman2-5/index.m3u8');
|
||||
hls.attachMedia(cammanVideo);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, () => { cammanVideo.muted = true; cammanVideo.play().catch(() => {}); });
|
||||
hlsInstances['camman'] = hls;
|
||||
@@ -1556,7 +1556,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Cameraman Panel -->
|
||||
<div class="panel stocks-hide" style="grid-area:camman;overflow:hidden;background:#000;padding:0;cursor:pointer;" onclick="setFeatured(CAMERAS.findIndex(([,s])=>s==='cameraman-5'))" title="Click to feature Cameraman">
|
||||
<div class="panel stocks-hide" style="grid-area:camman;overflow:hidden;background:#000;padding:0;cursor:pointer;" onclick="setFeatured(CAMERAS.findIndex(([,s])=>s==='cameraman2-5'))" title="Click to feature Cameraman">
|
||||
<div style="position:relative;width:100%;height:100%;">
|
||||
<video id="cammanVideo" muted playsinline autoplay style="width:100%;height:100%;object-fit:contain;display:block;"></video>
|
||||
<div class="cam-label" id="cammanLabel" style="position:absolute;bottom:0;left:0;right:0;">CAMERAMAN</div>
|
||||
@@ -2148,7 +2148,7 @@
|
||||
["Hallway Down", "hwdn-5"],
|
||||
["Hallway Up", "hwup-5"],
|
||||
["Jungle Room", "br4j-5"],
|
||||
["Cameraman", "cameraman-5"],
|
||||
["Cameraman", "cameraman2-5"],
|
||||
];
|
||||
|
||||
const ROOM_NAMES = {
|
||||
@@ -2160,7 +2160,7 @@
|
||||
"dnrm-5": "Dining Room", "mrke-5": "Market", "hwdn-5": "Hallway Down",
|
||||
"hwup-5": "Hallway Up",
|
||||
"br4j-5": "Jungle Room",
|
||||
"cameraman-5": "Cameraman", "site": "Site-wide",
|
||||
"cameraman2-5": "Cameraman", "site": "Site-wide",
|
||||
};
|
||||
|
||||
const DEFAULT_IDX = 1; // Director Mode
|
||||
@@ -2854,7 +2854,7 @@
|
||||
|
||||
if (thumbMode) {
|
||||
// Switch back to thumbnail mode — destroy all live thumb streams, refresh canvases
|
||||
const cammanIdx = CAMERAS.findIndex(([,s]) => s === 'cameraman-5');
|
||||
const cammanIdx = CAMERAS.findIndex(([,s]) => s === 'cameraman2-5');
|
||||
CAMERAS.forEach(([name, slug], i) => {
|
||||
if (i === DEFAULT_IDX || i === cammanIdx) return;
|
||||
if (hlsInstances[i]) { hlsInstances[i].destroy(); delete hlsInstances[i]; }
|
||||
@@ -2875,7 +2875,7 @@
|
||||
} else {
|
||||
// Switch to live mode — replace canvases with live video streams
|
||||
if (window._thumbInterval) { clearInterval(window._thumbInterval); window._thumbInterval = null; }
|
||||
const cammanIdx = CAMERAS.findIndex(([,s]) => s === 'cameraman-5');
|
||||
const cammanIdx = CAMERAS.findIndex(([,s]) => s === 'cameraman2-5');
|
||||
CAMERAS.forEach(([name, slug], i) => {
|
||||
if (i === DEFAULT_IDX || i === cammanIdx) return;
|
||||
const cell = document.getElementById('cam-' + i);
|
||||
@@ -2928,7 +2928,7 @@
|
||||
}
|
||||
|
||||
async function refreshAllThumbnails() {
|
||||
const cammanIdx = CAMERAS.findIndex(([,s]) => s === 'cameraman-5');
|
||||
const cammanIdx = CAMERAS.findIndex(([,s]) => s === 'cameraman2-5');
|
||||
const tasks = CAMERAS.map(([name, slug], i) => {
|
||||
if (i === DEFAULT_IDX || i === cammanIdx) return null;
|
||||
if (slug === CAMERAS[featuredIdx][1]) return null;
|
||||
@@ -2995,7 +2995,7 @@
|
||||
featVideo.addEventListener('canplay', () => { const s = document.getElementById('featuredVolume'); if (s) featVideo.volume = parseFloat(s.value); }, { once: true });
|
||||
|
||||
// Build thumb grid — skip Director Mode and Cameraman
|
||||
const cammanIdx = CAMERAS.findIndex(([,s]) => s === "cameraman-5");
|
||||
const cammanIdx = CAMERAS.findIndex(([,s]) => s === "cameraman2-5");
|
||||
CAMERAS.forEach(([name, slug], i) => {
|
||||
if (i === DEFAULT_IDX || i === cammanIdx) return;
|
||||
const cell = document.createElement('div');
|
||||
@@ -3122,11 +3122,11 @@
|
||||
function initCamerman() {
|
||||
const video = document.getElementById('cammanVideo');
|
||||
if (!video) return;
|
||||
const idx = CAMERAS.findIndex(([,s]) => s === 'cameraman-5');
|
||||
const idx = CAMERAS.findIndex(([,s]) => s === 'cameraman2-5');
|
||||
if (typeof Hls !== 'undefined' && Hls.isSupported()) {
|
||||
if (hlsInstances['camman']) hlsInstances['camman'].destroy();
|
||||
const hls = new Hls({ lowLatencyMode: true, maxBufferLength: 8 });
|
||||
hls.loadSource('http://localhost:3000/cam/cameraman-5/index.m3u8');
|
||||
hls.loadSource('http://localhost:3000/cam/cameraman2-5/index.m3u8');
|
||||
hls.attachMedia(video);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, () => video.play().catch(() => {}));
|
||||
hls.on(Hls.Events.ERROR, (e, d) => {
|
||||
@@ -3141,7 +3141,7 @@
|
||||
});
|
||||
hlsInstances['camman'] = hls;
|
||||
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = 'http://localhost:3000/cam/cameraman-5/index.m3u8';
|
||||
video.src = 'http://localhost:3000/cam/cameraman2-5/index.m3u8';
|
||||
video.play().catch(() => {});
|
||||
}
|
||||
}
|
||||
@@ -3152,7 +3152,7 @@
|
||||
_origSetFeatured(i);
|
||||
// If cameraman is now in featured, show director in camman panel
|
||||
// If cameraman is what's being swapped back, restore its own stream
|
||||
const cammanIdx = CAMERAS.findIndex(([,s]) => s === 'cameraman-5');
|
||||
const cammanIdx = CAMERAS.findIndex(([,s]) => s === 'cameraman2-5');
|
||||
const cammanVideo = document.getElementById('cammanVideo');
|
||||
const cammanLabel = document.getElementById('cammanLabel');
|
||||
if (!cammanVideo) return;
|
||||
@@ -3173,7 +3173,7 @@
|
||||
// Restore camman panel to cameraman stream
|
||||
if (hlsInstances['camman']) hlsInstances['camman'].destroy();
|
||||
const hls = new Hls({ lowLatencyMode: true, maxBufferLength: 8 });
|
||||
hls.loadSource('http://localhost:3000/cam/cameraman-5/index.m3u8');
|
||||
hls.loadSource('http://localhost:3000/cam/cameraman2-5/index.m3u8');
|
||||
hls.attachMedia(cammanVideo);
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, () => { cammanVideo.muted = true; cammanVideo.play().catch(() => {}); });
|
||||
hlsInstances['camman'] = hls;
|
||||
@@ -3400,7 +3400,7 @@
|
||||
|
||||
function autoDiscoverCameras(presenceData) {
|
||||
// presence keys are camera slugs (plus "total")
|
||||
const knownSpecial = new Set(['total', 'cameraman-5']);
|
||||
const knownSpecial = new Set(['total', 'cameraman2-5']);
|
||||
let added = false;
|
||||
|
||||
Object.keys(presenceData).forEach(slug => {
|
||||
@@ -3411,7 +3411,7 @@
|
||||
console.log('[CAM] Auto-discovered new camera:', slug);
|
||||
KNOWN_CAMERA_SLUGS.add(slug);
|
||||
const label = slugToLabel(slug);
|
||||
const cammanIdx = CAMERAS.findIndex(([, s]) => s === 'cameraman-5');
|
||||
const cammanIdx = CAMERAS.findIndex(([, s]) => s === 'cameraman2-5');
|
||||
CAMERAS.splice(cammanIdx, 0, [label, slug]);
|
||||
added = true;
|
||||
});
|
||||
@@ -3420,7 +3420,7 @@
|
||||
if (added) {
|
||||
// Add new cells to the grid without destroying existing streams
|
||||
const grid = document.getElementById('cameraGrid');
|
||||
const cammanIdx = CAMERAS.findIndex(([, s]) => s === 'cameraman-5');
|
||||
const cammanIdx = CAMERAS.findIndex(([, s]) => s === 'cameraman2-5');
|
||||
CAMERAS.forEach(([name, slug], i) => {
|
||||
if (i === DEFAULT_IDX || i === cammanIdx) return;
|
||||
if (document.getElementById('cam-' + i)) return; // already exists
|
||||
@@ -3447,7 +3447,7 @@
|
||||
|
||||
// ── Viewer counts ────────────────────────────────────────────
|
||||
window.updateViewerCounts = function(data) {
|
||||
const cammanIdx = typeof CAMERAS !== 'undefined' ? CAMERAS.findIndex(([,s]) => s === 'cameraman-5') : -1;
|
||||
const cammanIdx = typeof CAMERAS !== 'undefined' ? CAMERAS.findIndex(([,s]) => s === 'cameraman2-5') : -1;
|
||||
if (typeof CAMERAS !== 'undefined') {
|
||||
CAMERAS.forEach(([name, slug], i) => {
|
||||
if (i === (typeof DEFAULT_IDX !== 'undefined' ? DEFAULT_IDX : 1)) return;
|
||||
@@ -3506,7 +3506,7 @@
|
||||
}
|
||||
|
||||
// Update every camera cell in the grid
|
||||
const cammanIdx = typeof CAMERAS !== 'undefined' ? CAMERAS.findIndex(([,s]) => s === 'cameraman-5') : -1;
|
||||
const cammanIdx = typeof CAMERAS !== 'undefined' ? CAMERAS.findIndex(([,s]) => s === 'cameraman2-5') : -1;
|
||||
if (typeof CAMERAS !== 'undefined') {
|
||||
CAMERAS.forEach(([name, slug], i) => {
|
||||
if (i === (typeof DEFAULT_IDX !== 'undefined' ? DEFAULT_IDX : 1)) return;
|
||||
|
||||
Reference in New Issue
Block a user