Update display_global.php
This commit is contained in:
@@ -80,6 +80,7 @@ $_hasVideo = (bool)$_tvVideo;
|
||||
transition: background .15s;
|
||||
}
|
||||
.btn-fs:hover { background: #f1f5f9; }
|
||||
.btn-fs.on { background: #dcfce7; border-color: #86efac; color: #15803d; }
|
||||
|
||||
/* ── Background decoration ── */
|
||||
.bg-deco {
|
||||
@@ -162,7 +163,6 @@ $_hasVideo = (bool)$_tvVideo;
|
||||
height: 100%;
|
||||
aspect-ratio: 9 / 16;
|
||||
overflow: hidden;
|
||||
background: #000;
|
||||
padding: 8px 8px 8px 0;
|
||||
}
|
||||
.reel-wrap.has-video { display: block; }
|
||||
@@ -318,6 +318,9 @@ $_hasVideo = (bool)$_tvVideo;
|
||||
<div class="hd-right">
|
||||
<div class="live-dot"></div>
|
||||
<div class="reloj" id="reloj">--:--:--</div>
|
||||
<button class="btn-fs" id="btn-sonido" onclick="activarSonido()" title="Activar sonido">
|
||||
<i class="fas fa-volume-mute"></i>
|
||||
</button>
|
||||
<button class="btn-fs" onclick="toggleFullscreen()" title="Pantalla completa">
|
||||
<i class="fas fa-expand" id="fs-icon"></i>
|
||||
</button>
|
||||
@@ -370,6 +373,54 @@ function tick() {
|
||||
}
|
||||
tick(); setInterval(tick, 1000);
|
||||
|
||||
/* ── Audio ── */
|
||||
let audioCtx = null, sonidoActivo = false;
|
||||
|
||||
function activarSonido() {
|
||||
try {
|
||||
audioCtx = new (window.AudioContext || window.webkitAudioContext)();
|
||||
const g = audioCtx.createGain(); g.gain.setValueAtTime(0.001, audioCtx.currentTime);
|
||||
const o = audioCtx.createOscillator(); o.connect(g); g.connect(audioCtx.destination);
|
||||
o.start(); o.stop(audioCtx.currentTime + 0.05);
|
||||
} catch (_) {}
|
||||
sonidoActivo = true;
|
||||
const btn = document.getElementById('btn-sonido');
|
||||
if (btn) { btn.innerHTML = '<i class="fas fa-volume-up"></i>'; btn.classList.add('on'); }
|
||||
setTimeout(playBeep, 100);
|
||||
}
|
||||
document.addEventListener('click', () => { if (!sonidoActivo) activarSonido(); }, { once: true });
|
||||
document.addEventListener('touchstart', () => { if (!sonidoActivo) activarSonido(); }, { once: true });
|
||||
|
||||
function playBeep() {
|
||||
if (!sonidoActivo || !audioCtx) return;
|
||||
try {
|
||||
const osc = audioCtx.createOscillator();
|
||||
const g = audioCtx.createGain();
|
||||
osc.type = 'sine';
|
||||
osc.connect(g); g.connect(audioCtx.destination);
|
||||
osc.frequency.setValueAtTime(880, audioCtx.currentTime);
|
||||
osc.frequency.setValueAtTime(1100, audioCtx.currentTime + 0.1);
|
||||
osc.frequency.setValueAtTime(880, audioCtx.currentTime + 0.2);
|
||||
g.gain.setValueAtTime(0.35, audioCtx.currentTime);
|
||||
g.gain.exponentialRampToValueAtTime(0.0001, audioCtx.currentTime + 0.65);
|
||||
osc.start(audioCtx.currentTime);
|
||||
osc.stop(audioCtx.currentTime + 0.65);
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
function anunciarTurno(codigo, destino) {
|
||||
playBeep();
|
||||
if ('speechSynthesis' in window) {
|
||||
setTimeout(() => {
|
||||
window.speechSynthesis.cancel();
|
||||
const letras = codigo.split('').join(' ');
|
||||
const utt = new SpeechSynthesisUtterance(`Turno ${letras}, pase a ${destino}`);
|
||||
utt.lang = 'es-CO'; utt.rate = 0.85; utt.pitch = 1.05; utt.volume = 1;
|
||||
window.speechSynthesis.speak(utt);
|
||||
}, 700);
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Fullscreen ── */
|
||||
function toggleFullscreen() {
|
||||
if (!document.fullscreenElement) {
|
||||
@@ -412,6 +463,8 @@ function showAnnouncement({ codigo, destino, paciente, color }) {
|
||||
|
||||
ov.classList.add('visible');
|
||||
|
||||
anunciarTurno(codigo, destino);
|
||||
|
||||
bar.style.transition = 'none';
|
||||
bar.style.width = '100%';
|
||||
requestAnimationFrame(() => requestAnimationFrame(() => {
|
||||
|
||||
Reference in New Issue
Block a user