9943a409f1
orbisubs.py escribe la cola cues.jsonl y anuncia la pista en el master (--en); orbisubs_tr.py junta frases, traduce con Qwen (sin thinking, contexto de la frase anterior) y escribe en/<seq>.vtt + en.m3u8. Tarea 077.
43 lines
2.6 KiB
HTML
43 lines
2.6 KiB
HTML
<!doctype html>
|
|
<html lang="es"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<title>OrbiSubs prueba</title>
|
|
<style>body{background:#111;color:#ddd;font-family:sans-serif;margin:16px}video{width:100%;max-width:960px}
|
|
#info{font-size:13px;color:#999;margin-top:8px}select,input{font-size:14px}</style></head>
|
|
<body>
|
|
<h3>OrbiSubs — subtítulos en vivo (prueba)</h3>
|
|
<input id="u" size="50" value="/hls/t13/master.m3u8"> <button onclick="cargar()">Cargar</button>
|
|
<label> Subtítulos <select id="s"><option value="-1">Apagados</option></select></label>
|
|
<div><video id="v" controls muted autoplay playsinline></video></div>
|
|
<div id="info"></div>
|
|
<div id="diag" style="font-size:12px;color:#777"></div>
|
|
<script src="https://cdn.jsdelivr.net/npm/hls.js@1.5.20/dist/hls.min.js"></script>
|
|
<script>
|
|
let hls;
|
|
function cargar(){
|
|
const v=document.getElementById('v'), s=document.getElementById('s');
|
|
if(hls) hls.destroy();
|
|
hls=new Hls({liveSyncDurationCount:3});
|
|
// Recuperación estándar de hls.js: el CDN de origen mete cortes de PTS en las tandas
|
|
// y el decoder del navegador a veces se cae ahí (visto con Chromium, 2026-11-16).
|
|
hls.on(Hls.Events.ERROR,(e,d)=>{ if(!d.fatal) return;
|
|
if(d.type===Hls.ErrorTypes.MEDIA_ERROR) hls.recoverMediaError(); else hls.startLoad(); });
|
|
hls.loadSource(document.getElementById('u').value); hls.attachMedia(v);
|
|
hls.on(Hls.Events.SUBTITLE_TRACKS_UPDATED,()=>{
|
|
s.innerHTML='<option value="-1">Apagados</option>'+hls.subtitleTracks.map((t,i)=>`<option value="${i}">${t.name}</option>`).join('');
|
|
// Arranca en la pista pedida por ?lang=en (o en español).
|
|
const q=new URLSearchParams(location.search).get('lang')||'es';
|
|
const i=Math.max(0,hls.subtitleTracks.findIndex(t=>t.lang===q));
|
|
s.value=i; hls.subtitleTrack=i; hls.subtitleDisplay=true;
|
|
});
|
|
s.onchange=()=>{hls.subtitleTrack=+s.value; hls.subtitleDisplay=+s.value>=0;};
|
|
// Diagnóstico: cuántos cues cargó la pista y cuál está en pantalla (sirve para
|
|
// probar con un navegador headless que el texto llega y en qué tiempo del video).
|
|
setInterval(()=>{const t=[...v.textTracks].find(x=>x.mode==='showing');
|
|
const act=t&&t.activeCues&&t.activeCues.length?[...t.activeCues].map(c=>c.text.replace(/\n/g,' ')).join(' / '):'';
|
|
document.getElementById('diag').textContent=`t=${v.currentTime.toFixed(1)} pistas=${v.textTracks.length} cues=${t&&t.cues?t.cues.length:0} activo=[${act}]`;},500);
|
|
setInterval(()=>{const l=hls.latency; document.getElementById('info').textContent=
|
|
'Retraso al borde de la lista publicada: '+(l?l.toFixed(1):'?')+' s';},1000);
|
|
}
|
|
cargar();
|
|
</script></body></html>
|