Captions

자막

Text that conveys not just dialogue but speaker identity and sound effects from a video — needed by deaf/hard-of-hearing users and silent-mode viewers alike.

Also known as: Closed captionsSubtitles vs captions
···
html
<div class="stage">
  <div class="player">
    <div class="screen"><div class="play"></div></div>
    <div class="bar"><div class="fill" id="fill"></div></div>
    <div class="cap" id="cap"></div>
  </div>
</div>
css
.stage{width:78%;height:88%;display:grid;place-items:center}
.player{width:100%;height:100%;border-radius:14px;overflow:hidden;background:#0d0d12;position:relative;display:flex;flex-direction:column}
.screen{flex:1;display:grid;place-items:center;background:linear-gradient(135deg,#1c1c26,#0d0d12)}
.play{width:0;height:0;border-top:14px solid transparent;border-bottom:14px solid transparent;border-left:22px solid rgba(255,255,255,.65)}
.bar{height:4px;background:rgba(255,255,255,.15)}
.fill{height:100%;width:0;background:var(--accent)}
.cap{min-height:30px;display:flex;align-items:center;justify-content:center;padding:6px 8%;font:700 clamp(10px,3vmin,13px)/1.2 ui-monospace,monospace;color:#fff;text-align:center;background:rgba(0,0,0,.55)}
js
const fill = document.getElementById('fill');
const cap = document.getElementById('cap');
const lines = [
  { t: 0, text: 'Welcome back to the show.' },
  { t: 20, text: '[applause]' },
  { t: 45, text: "Today we're talking accessibility." },
  { t: 70, text: '[phone ringing]' },
  { t: 90, text: "Let's dive right in." },
];
const DURATION = 6000;
const start = Date.now();
function frame() {
  const elapsed = (Date.now() - start) % DURATION;
  const pct = (elapsed / DURATION) * 100;
  fill.style.width = pct + '%';
  let current = '';
  for (let i = 0; i < lines.length; i++) {
    if (pct >= lines[i].t) current = lines[i].text;
  }
  cap.textContent = current;
  requestAnimationFrame(frame);
}
frame();

A caption is not a subtitle — a subtitle translates dialogue for someone who doesn't understand the language, while a caption is built for deaf and hard-of-hearing viewers and also identifies who's speaking and what sounds occur ([phone ringing], [applause]).

In HTML this is `<track kind="captions" src="..." srclang="en">` nested inside `<video>`, pointing at a WebVTT file. Captions on prerecorded video are a baseline WCAG requirement (1.2.2); real-time captions on live broadcasts are required at a higher level.

As a side effect, captions make video watchable anywhere sound can't be turned on — a subway car, an open office — which is exactly why so much social video autoplays muted by default.

The demo syncs caption lines to a playback progress bar, cycling through dialogue and a non-speech cue like [applause] in order.

When to use

Attach a caption file to every prerecorded video you ship, by default. Auto-generated captions still need human review to fix typos and misrecognitions.