v153 · speechrecognitionresult timestamps
On-device latency monitor
On-device speech recognition trades server cost and privacy for a dependency on the visitor's hardware. audioEndTime tells you when a phrase ended in the audio; comparing it with the result event's timeStamp (when the transcript arrived) gives you the processing lag. Crossing an application-defined threshold can inform a configured fallback decision; the timing signal does not itself provide or authorize a cloud backend.
To read real timestamps: you need a build that implements the proposal (PR #192, unmerged; the v153 listing records a developer trial at 153, but the attributes are not yet in Chromium main's IDL as of 2026-07-24 and no dedicated runtime flag exists yet) plus a recognition backend that reports segment timing (on-device needs its speech model downloaded). If your engine returns
null for audioEndTime, this page says so and will not invent a latency number. Use the sample walkthrough to see the gauge move.
Live latency gauge
— ms processing lag
Idle. Start listening, or play the sample walkthrough.
(transcript will appear here)
code path
const recognition = new (window.SpeechRecognition || window.webkitSpeechRecognition)();
recognition.continuous = true;
recognition.interimResults = true;
recognition.onresult = (event) => {
const result = event.results[event.resultIndex];
if (result.audioEndTime == null) return; // engine did not supply timing
const lagMs = event.timeStamp - result.audioEndTime;
if (lagMs > failoverThresholdMs) switchToCloudBackend();
};