v153 · speechrecognitionresult timestamps

Caption timeline mapper

A captioning or transcript-scrubbing tool needs to know where each phrase sits in the audio. With speechStartTime and speechEndTime — seconds from the first audio frame the recognizer consumed — you can position every recognised segment on a timeline — the foundation for click-to-seek transcripts, karaoke-style highlighting, and aligning captions to a media element.

Enable it: the attributes sit behind the Blink runtime flag WebSpeechTimestamps. In Chrome 153–159 it is experimental: turn on chrome://flags/#enable-experimental-web-platform-features, or launch Chrome with --enable-blink-features=WebSpeechTimestamps. Chromium main (after the M159 branch) enables it by default on Windows, macOS and Linux; Android and ChromeOS still need the flag. The spec names are speechStartTime / speechEndTime (Chrome 156+), already in seconds on the session audio timeline — exactly what a VTTCue or media.currentTime wants. Chrome 153–155 expose an earlier draft, audioStartTime / audioEndTime (nullable ms on the time origin); this page uses them only when the spec names are absent, re-bases them on audiostart, and labels them as draft. A caption with no timing is still listed but flagged unpositioned — never dropped onto the timeline at a made-up spot. The sample walkthrough renders a fully-timed transcript.

Recognised phrases on an audio timeline

0.00 s— s

Caption list

  1. No captions yet. Start listening, or play the sample.

code path

recognition.onresult = (event) => {
  const result = event.results[event.resultIndex];
  if (!result.isFinal) return;
  const start = result.speechStartTime, end = result.speechEndTime;   // seconds from audiostart
  if (!Number.isFinite(start) || !Number.isFinite(end)) { listUnpositioned(result[0].transcript); return; }
  addSegment(result[0].transcript, start, end);   // left = start / total, width = (end - start) / total
  textTrack.addCue(new VTTCue(start, end, result[0].transcript));   // same units as a media timeline
};

see also