<!doctype html><html lang="fr"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>WinZik sur la TV</title><!--RECEIVER_SDK--><style> :root { --accent: #ffd84a; --ink: #f4f6fb; --muted: #9aa6bf; --bg: #0b1020; } * { box-sizing: border-box; } html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: "Segoe UI", Roboto, Arial, sans-serif; overflow: hidden; } #bg { position: fixed; inset: -10%; background-size: cover; background-position: center; filter: blur(60px) brightness(.35); transform: scale(1.1); transition: background-image 1s; } #shade { position: fixed; inset: 0; background: linear-gradient(90deg, rgba(11,16,32,.92) 0%, rgba(11,16,32,.55) 45%, rgba(11,16,32,.85) 100%); } main { position: relative; display: grid; grid-template-columns: 34vw 1fr; gap: 4vw; height: 100%; padding: 6vh 5vw; } #side { display: flex; flex-direction: column; justify-content: center; gap: 2.2vh; min-width: 0; } #cover { width: 100%; aspect-ratio: 1; border-radius: 1.2vw; background: #1c2540 center / cover no-repeat; box-shadow: 0 2vh 6vh rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; font-size: 10vw; color: #3a4670; } #title { font-size: 2.6vw; font-weight: 700; line-height: 1.15; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; } #artist { font-size: 1.7vw; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } #bar { height: .6vh; background: rgba(255,255,255,.15); border-radius: 1vh; overflow: hidden; } #fill { height: 100%; width: 0; background: var(--accent); } #times { display: flex; justify-content: space-between; font-size: 1.1vw; color: var(--muted); } #next { font-size: 1.05vw; color: var(--muted); line-height: 1.5; min-height: 4.5em; } #next b { color: var(--ink); font-weight: 600; } #lyrics { position: relative; overflow: hidden; display: block; mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent); -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent); } .line { font-size: 2.4vw; line-height: 1.3; color: rgba(244,246,251,.38); margin: 1.4vh 0; transition: color .3s, font-size .3s; } .line.now { font-size: 3.6vw; font-weight: 700; color: var(--ink); } .line .tr { display: block; font-size: .62em; font-weight: 400; font-style: italic; color: var(--muted); margin-top: .3vh; } .syl { color: inherit; } .line.now .syl { background: linear-gradient(90deg, var(--accent) var(--p, 0%), var(--ink) var(--p, 0%)); -webkit-background-clip: text; background-clip: text; color: transparent; } #lines { position: relative; padding: 26vh 0 70vh; } #mark { position: absolute; left: 0; top: 0; display: none; pointer-events: none; color: var(--accent); font-size: 2.4vw; line-height: 1; text-shadow: 0 0 .6vw rgba(0,0,0,.8); will-change: transform; } #mark.ball { width: 1.4vw; height: 1.4vw; border-radius: 50%; background: var(--accent); box-shadow: 0 0 1vw rgba(255,216,74,.6); } #mark.bar { height: .5vw; border-radius: .3vw; background: var(--accent); } #none { padding-top: 40vh; font-size: 2.4vw; color: var(--muted); } #brand { position: fixed; right: 2.5vw; bottom: 2.5vh; font-size: 1vw; color: var(--muted); letter-spacing: .1em; } #brand b { color: var(--accent); } #status { position: fixed; left: 50%; top: 3vh; transform: translateX(-50%); padding: 1vh 2vw; border-radius: 3vh; background: rgba(0,0,0,.6); font-size: 1.2vw; display: none; } #unlock { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 2vh; background: rgba(5,8,16,.88); font-size: 2.2vw; text-align: center; } #unlock button { font: inherit; padding: 1.5vh 3vw; border: 0; border-radius: 1vh; background: var(--accent); color: #111; cursor: pointer; } @media (max-aspect-ratio: 1/1) { main { grid-template-columns: 1fr; grid-template-rows: auto 1fr; } #cover { width: 40vw; } .line { font-size: 5vw; } .line.now { font-size: 7vw; } #title { font-size: 5vw; } #artist { font-size: 3.6vw; } #times, #next { font-size: 2.6vw; } }</style></head><body><div id="bg"></div><div id="shade"></div><main> <section id="side"> <div id="cover">♫</div> <div id="title">WinZik</div> <div id="artist">En attente de la musique…</div> <div id="bar"><div id="fill"></div></div> <div id="times"><span id="pos">0:00</span><span id="dur">0:00</span></div> <div id="next"></div> </section> <section id="lyrics"><div id="none">Les paroles s'afficheront ici.</div></section></main><div id="status"></div><div id="unlock"><div>La TV attend votre accord pour jouer le son.</div><button id="go">Appuyez sur OK pour démarrer</button></div><div id="brand"><b>WinZik</b> · télécommande : OK lecture / pause, ◀ ▶ morceau, ▲ ▼ ±10 s</div><audio id="audio" preload="auto"></audio><script>'use strict';const $ = (id) => document.getElementById(id);const audio = $('audio');let pendingAt = null, song = null, lyrics = [], posSeq = -1, wantPlay = false, ended = -1, lastLine = -2, lastVolume = -1, markStyle = 'ball';function clock(s) { s = Math.max(0, Math.floor(s || 0)); return Math.floor(s / 60) + ':' + String(s % 60).padStart(2, '0'); }function esc(t) { return String(t).replace(/[&<>"]/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"' }[c])); }function notice(text) { const s = $('status'); s.textContent = text || ''; s.style.display = text ? 'block' : 'none'; }function setLyrics(data) { lyrics = (data && data.lines) || []; if (data && data.synced === false) { lyrics.forEach((l) => { l.syl = []; l.at = []; }); } lastLine = -2; const box = $('lyrics'); if (!lyrics.length) { box.innerHTML = '<div id="none">Pas de paroles pour ce morceau.</div>'; return; } box.innerHTML = '<div id="lines">' + lyrics.map((l, i) => '<div class="line" id="l' + i + '">' + (l.syl && l.syl.length ? l.syl.map((s, k) => '<span class="syl" id="s' + i + '_' + k + '">' + esc(s) + '</span>').join('') : esc(l.text)) + (l.tr ? '<span class="tr">' + esc(l.tr) + '</span>' : '') + '</div>').join('') + '<div id="mark"></div></div>';}function apply(s) { if (!s || !s.song) { return; } notice(s.notice || ''); markStyle = ['ball', 'star', 'note', 'bar', 'off'].indexOf(s.karaoke) >= 0 ? s.karaoke : 'ball'; const next = s.next || []; $('next').innerHTML = next.length ? 'Ensuite : ' + next.map((n) => '<b>' + esc(n.title) + '</b>' + (n.artist ? ' · ' + esc(n.artist) : '')).join('<br>') : ''; if (!song || song.id !== s.song.id) { song = s.song; ended = -1; $('title').textContent = song.title || 'WinZik'; $('artist').textContent = song.artist || ''; $('cover').style.backgroundImage = song.cover ? 'url("' + song.cover + '")' : ''; $('cover').innerHTML = song.cover ? '' : '♫'; $('bg').style.backgroundImage = song.cover ? 'url("' + song.cover + '")' : ''; $('dur').textContent = clock(song.duration); setLyrics(null); if (song.lyricsData) { setLyrics(song.lyricsData); } else if (song.lyrics) { fetch(song.lyrics).then((r) => r.json()).then((d) => { if (song && song.lyrics && d) { setLyrics(d); } }).catch(() => {}); } if (song.url) { audio.src = song.url; pendingAt = s.position || 0; } posSeq = s.posSeq; } if (s.posSeq !== posSeq) { posSeq = s.posSeq; try { audio.currentTime = s.position || 0; } catch (e) {} } if (s.volume !== lastVolume) { lastVolume = s.volume; audio.volume = Math.max(0, Math.min(1, (s.volume == null ? 100 : s.volume) / 100)); } wantPlay = !!s.playing; if (wantPlay && audio.paused && song.url && ended !== song.id) { start(); } if (!wantPlay && !audio.paused) { audio.pause(); }}function start() { const p = audio.play(); if (p && p.catch) { p.then(() => { $('unlock').style.display = 'none'; }).catch((e) => { if (e && e.name === 'NotAllowedError') { $('unlock').style.display = 'flex'; } }); }}function report() { return { song: song ? song.id : -1, pos: Math.round(audio.currentTime * 100) / 100, st: !song ? 'idle' : (ended === song.id ? 'ended' : (audio.paused ? 'paused' : (audio.readyState < 3 ? 'loading' : 'playing'))) };}function draw() { const t = audio.currentTime || 0; const shown = clock(t); if (shown !== draw.shown) { draw.shown = shown; $('pos').textContent = shown; $('fill').style.width = (song && song.duration ? Math.min(100, 100 * t / song.duration) : 0) + '%'; } let now = -1; for (let i = 0; i < lyrics.length; i++) { if (lyrics[i].t <= t + 0.05) { now = i; } else { break; } } if (now !== lastLine) { if (lastLine >= 0 && $('l' + lastLine)) { $('l' + lastLine).classList.remove('now'); } if (now >= 0 && $('l' + now)) { $('l' + now).classList.add('now'); } lastLine = now; const box = $('lyrics'), el = $('l' + Math.max(0, now)); // the line sung near the top: the lines coming fill the screen under it if (el) { const off = el.offsetTop - box.clientHeight * 0.26; box.scrollTo ? box.scrollTo({ top: off, behavior: 'smooth' }) : (box.scrollTop = off); } } if (now >= 0) { const l = lyrics[now]; // only what changed (a TV's browser is slow: every style written each frame made the karaoke stutter) (l.at || []).forEach((a, k) => { const end = k + 1 < l.at.length ? l.at[k + 1] : l.e; const p = Math.round(t <= a ? 0 : (t >= end ? 100 : 100 * (t - a) / Math.max(0.05, end - a))); const el = $('s' + now + '_' + k); if (el && el._p !== p) { el._p = p; el.style.setProperty('--p', p + '%'); } }); } drawMark(now, t); requestAnimationFrame(draw);}// the karaoke's mark (ball, star, note or bar, as WinZik's lyrics bar): from syllable to syllable, landing on each at its momentfunction drawMark(now, t) { const m = $('mark'); if (!m) { return; } const l = now >= 0 ? lyrics[now] : null; if (!l || markStyle === 'off' || !l.at || !l.at.length || t > l.e + 0.4) { m.style.display = 'none'; return; } const syl = (k) => $('s' + now + '_' + k), line = $('l' + now); const n = l.at.length; let k = 0; while (k + 1 < n && t >= l.at[k + 1]) { k++; } const a = syl(k), b = syl(Math.min(n - 1, k + 1)); if (!a || !b || !line) { m.style.display = 'none'; return; } const cx = (e) => e.offsetLeft + e.offsetWidth / 2; m.className = markStyle; m.textContent = markStyle === 'star' ? '\u2605' : (markStyle === 'note' ? '\u266A' : ''); m.style.display = 'block'; if (markStyle === 'bar') { m.style.width = a.offsetWidth + 'px'; m.style.transform = 'translate(' + a.offsetLeft + 'px,' + (a.offsetTop + a.offsetHeight) + 'px)'; return; } let f = 0; if (t >= l.at[0] && k + 1 < n) { f = Math.min(1, (t - l.at[k]) / Math.max(0.05, l.at[k + 1] - l.at[k])); } const x = cx(a) + (cx(b) - cx(a)) * f; const hop = Math.min(2.4, 0.9 + (k + 1 < n ? l.at[k + 1] - l.at[k] : 0)) * line.offsetHeight * 0.35; const y = a.offsetTop - m.offsetHeight - hop * 4 * f * (1 - f); m.style.transform = 'translate(' + (x - m.offsetWidth / 2) + 'px,' + y + 'px)';}audio.addEventListener('loadedmetadata', () => { if (pendingAt !== null) { try { audio.currentTime = pendingAt; } catch (e) {} pendingAt = null; } });audio.addEventListener('ended', () => { if (song) { ended = song.id; } });audio.addEventListener('error', () => notice('La TV n\'arrive pas à lire ce morceau'));$('go').addEventListener('click', () => { $('unlock').style.display = 'none'; start(); });// the keys of the TV's remotedocument.addEventListener('keydown', (e) => { const k = e.key; let cmd = null; if (k === 'Enter' || k === ' ' || k === 'MediaPlayPause' || k === 'Unidentified' && e.keyCode === 179) { cmd = { do: 'toggle' }; if ($('unlock').style.display === 'flex') { $('unlock').style.display = 'none'; start(); return; } } else if (k === 'ArrowRight' || k === 'MediaTrackNext' || k === 'MediaFastForward') { cmd = { do: 'next' }; } else if (k === 'ArrowLeft' || k === 'MediaTrackPrevious' || k === 'MediaRewind') { cmd = { do: 'prev' }; } else if (k === 'ArrowUp') { cmd = { do: 'seek', t: (audio.currentTime || 0) + 10 }; } else if (k === 'ArrowDown') { cmd = { do: 'seek', t: Math.max(0, (audio.currentTime || 0) - 10) }; } else if (k === 'MediaPlay') { cmd = { do: 'play' }; } else if (k === 'MediaPause') { cmd = { do: 'pause' }; } if (cmd) { e.preventDefault(); transport.command(cmd); }});/*TRANSPORT*/requestAnimationFrame(draw);</script></body></html>