533 lines
16 KiB
HTML
533 lines
16 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Configura tu estudio</title>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
background-color: #ffffff;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
min-height: 100vh;
|
|
padding: 20px;
|
|
}
|
|
|
|
.container {
|
|
max-width: 628px;
|
|
width: 100%;
|
|
}
|
|
|
|
.header {
|
|
text-align: center;
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.header h1 {
|
|
font-size: 28px;
|
|
font-weight: 600;
|
|
color: #1a1a1a;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.header p {
|
|
font-size: 14px;
|
|
color: #666666;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.video-container {
|
|
display: flex;
|
|
gap: 16px;
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.video-preview {
|
|
flex: 1;
|
|
background-color: #0a0a1a;
|
|
border-radius: 12px;
|
|
aspect-ratio: 16/9;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.user-badge {
|
|
position: absolute;
|
|
bottom: 16px;
|
|
left: 16px;
|
|
background-color: rgba(99, 102, 241, 0.9);
|
|
color: white;
|
|
padding: 8px 20px;
|
|
border-radius: 20px;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.mic-status {
|
|
background-color: #f8f9fa;
|
|
border-radius: 12px;
|
|
padding: 20px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-width: 180px;
|
|
}
|
|
|
|
.mic-icon {
|
|
width: 48px;
|
|
height: 48px;
|
|
background-color: #e8e8e8;
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-bottom: 12px;
|
|
position: relative;
|
|
}
|
|
|
|
.mic-icon::before {
|
|
content: '🎤';
|
|
font-size: 24px;
|
|
}
|
|
|
|
.mic-meter {
|
|
width: 32px;
|
|
height: 80px;
|
|
background-color: #e8e8e8;
|
|
border-radius: 16px;
|
|
margin-bottom: 12px;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.mic-level {
|
|
position: absolute;
|
|
bottom: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: 20%;
|
|
background: linear-gradient(to top, #22c55e, #86efac);
|
|
border-radius: 16px;
|
|
transition: height 0.1s ease-out;
|
|
}
|
|
|
|
.mic-status-text {
|
|
text-align: center;
|
|
font-size: 14px;
|
|
color: #22c55e;
|
|
font-weight: 500;
|
|
margin-bottom: 4px;
|
|
}
|
|
|
|
.mic-device {
|
|
font-size: 11px;
|
|
color: #999999;
|
|
text-align: center;
|
|
}
|
|
|
|
.controls {
|
|
display: inline-flex;
|
|
justify-content: center;
|
|
gap: 8px;
|
|
padding: 12px;
|
|
background-color: #ffffff;
|
|
border: 1px solid #e5e5e5;
|
|
border-radius: 12px;
|
|
margin-bottom: 24px;
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
|
|
}
|
|
|
|
.controls-wrapper {
|
|
text-align: center;
|
|
}
|
|
|
|
.control-btn {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 8px;
|
|
background: transparent;
|
|
border: none;
|
|
cursor: pointer;
|
|
color: #666666;
|
|
font-size: 13px;
|
|
transition: all 0.2s;
|
|
padding: 12px 20px;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.control-btn:hover {
|
|
color: #1a1a1a;
|
|
background-color: #fee2e2;
|
|
}
|
|
|
|
.control-btn.disabled {
|
|
color: #dc2626;
|
|
background-color: #fecaca;
|
|
}
|
|
|
|
.control-btn.disabled:hover {
|
|
color: #b91c1c;
|
|
background-color: #fca5a5;
|
|
}
|
|
|
|
.control-icon {
|
|
width: 24px;
|
|
height: 24px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
position: relative;
|
|
}
|
|
|
|
.control-icon::after {
|
|
content: '';
|
|
position: absolute;
|
|
width: 2px;
|
|
height: 28px;
|
|
background-color: #dc2626;
|
|
transform: rotate(-45deg);
|
|
opacity: 0;
|
|
transition: opacity 0.2s;
|
|
}
|
|
|
|
.control-btn.disabled .control-icon::after {
|
|
opacity: 1;
|
|
}
|
|
|
|
.control-hint {
|
|
position: absolute;
|
|
bottom: 100%;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
background-color: #1a1a1a;
|
|
color: white;
|
|
padding: 6px 12px;
|
|
border-radius: 6px;
|
|
font-size: 12px;
|
|
white-space: nowrap;
|
|
opacity: 0;
|
|
pointer-events: none;
|
|
transition: opacity 0.2s;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.control-hint::after {
|
|
content: '';
|
|
position: absolute;
|
|
top: 100%;
|
|
left: 50%;
|
|
transform: translateX(-50%);
|
|
border: 5px solid transparent;
|
|
border-top-color: #1a1a1a;
|
|
}
|
|
|
|
.control-btn {
|
|
position: relative;
|
|
}
|
|
|
|
.control-btn:hover .control-hint {
|
|
opacity: 1;
|
|
}
|
|
|
|
.kbd {
|
|
background-color: #374151;
|
|
padding: 2px 6px;
|
|
border-radius: 3px;
|
|
font-family: monospace;
|
|
font-size: 11px;
|
|
margin: 0 2px;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.form-label {
|
|
display: block;
|
|
font-size: 14px;
|
|
color: #1a1a1a;
|
|
margin-bottom: 8px;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.form-label .optional {
|
|
color: #666666;
|
|
font-weight: 400;
|
|
}
|
|
|
|
.info-icon {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 16px;
|
|
height: 16px;
|
|
border: 1.5px solid #3b82f6;
|
|
border-radius: 50%;
|
|
color: #3b82f6;
|
|
font-size: 11px;
|
|
font-weight: 600;
|
|
margin-left: 4px;
|
|
cursor: help;
|
|
}
|
|
|
|
.form-input {
|
|
width: 100%;
|
|
padding: 12px 16px;
|
|
border: 1px solid #d1d5db;
|
|
border-radius: 8px;
|
|
font-size: 14px;
|
|
color: #1a1a1a;
|
|
transition: border-color 0.2s, box-shadow 0.2s;
|
|
}
|
|
|
|
.form-input:focus {
|
|
outline: none;
|
|
border-color: #3b82f6;
|
|
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
|
|
}
|
|
|
|
.form-input::placeholder {
|
|
color: #9ca3af;
|
|
}
|
|
|
|
.submit-btn {
|
|
width: 100%;
|
|
padding: 14px;
|
|
background-color: #2563eb;
|
|
color: white;
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-size: 15px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: background-color 0.2s;
|
|
}
|
|
|
|
.submit-btn:hover {
|
|
background-color: #1d4ed8;
|
|
}
|
|
|
|
.submit-btn:active {
|
|
background-color: #1e40af;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="header">
|
|
<h1>Configura tu estudio</h1>
|
|
<p>Entrar al estudio no iniciará automáticamente<br>la transmisión.</p>
|
|
</div>
|
|
|
|
<div class="video-container">
|
|
<div class="video-preview">
|
|
<div class="user-badge">Cesar Mendivil</div>
|
|
</div>
|
|
|
|
<div class="mic-status">
|
|
<div class="mic-icon"></div>
|
|
<div class="mic-meter">
|
|
<div class="mic-level"></div>
|
|
</div>
|
|
<div class="mic-status-text">El micrófono<br>está<br>funcionando</div>
|
|
<div class="mic-device">Microphone Array (R...</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="controls-wrapper">
|
|
<div class="controls">
|
|
<button class="control-btn" id="audioBtn">
|
|
<span class="control-hint">Presiona <span class="kbd">CTRL</span> + <span class="kbd">D</span></span>
|
|
<div class="control-icon">
|
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/>
|
|
<path d="M19 10v2a7 7 0 0 1-14 0v-2"/>
|
|
<line x1="12" y1="19" x2="12" y2="23"/>
|
|
<line x1="8" y1="23" x2="16" y2="23"/>
|
|
</svg>
|
|
</div>
|
|
<span>Desactivar audio</span>
|
|
</button>
|
|
|
|
<button class="control-btn" id="cameraBtn">
|
|
<span class="control-hint">Presiona <span class="kbd">CTRL</span> + <span class="kbd">E</span></span>
|
|
<div class="control-icon">
|
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/>
|
|
<circle cx="12" cy="13" r="4"/>
|
|
</svg>
|
|
</div>
|
|
<span>Detener cámara</span>
|
|
</button>
|
|
|
|
<button class="control-btn">
|
|
<div class="control-icon">
|
|
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<circle cx="12" cy="12" r="3"/>
|
|
<path d="M12 1v6m0 6v6m-9-9h6m6 0h6"/>
|
|
</svg>
|
|
</div>
|
|
<span>Configuración</span>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<form>
|
|
<div class="form-group">
|
|
<label class="form-label" for="display-name">Nombre para mostrar</label>
|
|
<input
|
|
type="text"
|
|
id="display-name"
|
|
class="form-input"
|
|
value="Cesar Mendivil"
|
|
>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label class="form-label" for="title">
|
|
Título <span class="optional">(opcional)</span>
|
|
<span class="info-icon">?</span>
|
|
</label>
|
|
<input
|
|
type="text"
|
|
id="title"
|
|
class="form-input"
|
|
placeholder="p. ej.: Founder of Creativity Inc"
|
|
>
|
|
</div>
|
|
|
|
<button type="submit" class="submit-btn">Entrar al estudio</button>
|
|
</form>
|
|
</div>
|
|
|
|
<script>
|
|
// Estado de los controles
|
|
let audioEnabled = true;
|
|
let cameraEnabled = true;
|
|
let audioContext;
|
|
let analyser;
|
|
let microphone;
|
|
let animationId;
|
|
|
|
const audioBtn = document.getElementById('audioBtn');
|
|
const cameraBtn = document.getElementById('cameraBtn');
|
|
const micLevel = document.querySelector('.mic-level');
|
|
|
|
// Toggle audio
|
|
function toggleAudio() {
|
|
audioEnabled = !audioEnabled;
|
|
if (audioEnabled) {
|
|
audioBtn.classList.remove('disabled');
|
|
audioBtn.querySelector('span:last-child').textContent = 'Desactivar audio';
|
|
startAudioDetection();
|
|
} else {
|
|
audioBtn.classList.add('disabled');
|
|
audioBtn.querySelector('span:last-child').textContent = 'Activar audio';
|
|
stopAudioDetection();
|
|
}
|
|
}
|
|
|
|
// Toggle cámara
|
|
function toggleCamera() {
|
|
cameraEnabled = !cameraEnabled;
|
|
if (cameraEnabled) {
|
|
cameraBtn.classList.remove('disabled');
|
|
cameraBtn.querySelector('span:last-child').textContent = 'Detener cámara';
|
|
} else {
|
|
cameraBtn.classList.add('disabled');
|
|
cameraBtn.querySelector('span:last-child').textContent = 'Activar cámara';
|
|
}
|
|
}
|
|
|
|
// Eventos de click
|
|
audioBtn.addEventListener('click', toggleAudio);
|
|
cameraBtn.addEventListener('click', toggleCamera);
|
|
|
|
// Atajos de teclado
|
|
document.addEventListener('keydown', (e) => {
|
|
if (e.ctrlKey && e.key.toLowerCase() === 'd') {
|
|
e.preventDefault();
|
|
toggleAudio();
|
|
}
|
|
if (e.ctrlKey && e.key.toLowerCase() === 'e') {
|
|
e.preventDefault();
|
|
toggleCamera();
|
|
}
|
|
});
|
|
|
|
// Iniciar detección de audio
|
|
async function startAudioDetection() {
|
|
try {
|
|
if (!audioContext) {
|
|
audioContext = new (window.AudioContext || window.webkitAudioContext)();
|
|
analyser = audioContext.createAnalyser();
|
|
analyser.fftSize = 256;
|
|
|
|
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
microphone = audioContext.createMediaStreamSource(stream);
|
|
microphone.connect(analyser);
|
|
}
|
|
|
|
const dataArray = new Uint8Array(analyser.frequencyBinCount);
|
|
|
|
function updateMeter() {
|
|
if (!audioEnabled) return;
|
|
|
|
analyser.getByteFrequencyData(dataArray);
|
|
const average = dataArray.reduce((a, b) => a + b) / dataArray.length;
|
|
const percentage = Math.min(100, (average / 128) * 100);
|
|
|
|
micLevel.style.height = percentage + '%';
|
|
|
|
animationId = requestAnimationFrame(updateMeter);
|
|
}
|
|
|
|
updateMeter();
|
|
} catch (err) {
|
|
console.error('Error al acceder al micrófono:', err);
|
|
// Simulación si no hay acceso al micrófono
|
|
simulateAudioMeter();
|
|
}
|
|
}
|
|
|
|
// Detener detección de audio
|
|
function stopAudioDetection() {
|
|
if (animationId) {
|
|
cancelAnimationFrame(animationId);
|
|
}
|
|
micLevel.style.height = '20%';
|
|
}
|
|
|
|
// Simulación de audio (fallback)
|
|
function simulateAudioMeter() {
|
|
function animate() {
|
|
if (!audioEnabled) {
|
|
micLevel.style.height = '20%';
|
|
return;
|
|
}
|
|
|
|
const randomLevel = 20 + Math.random() * 60;
|
|
micLevel.style.height = randomLevel + '%';
|
|
|
|
animationId = requestAnimationFrame(animate);
|
|
}
|
|
animate();
|
|
}
|
|
|
|
// Iniciar animación al cargar
|
|
startAudioDetection();
|
|
</script>
|
|
</body>
|
|
</html> |