Skip to content

Merge SpeechRecognitionResult Timestamps Explainer updates - #210

Merged
alan33d merged 7 commits into
mainfrom
alan33d-patch-1
Sep 4, 2026
Merged

Merge SpeechRecognitionResult Timestamps Explainer updates#210
alan33d merged 7 commits into
mainfrom
alan33d-patch-1

Conversation

@alan33d

@alan33d alan33d commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Remove latency tracking uses cases since SpeechRecognitionEvent timestamps can be used for that purpose. Instead focus on developer need for timeline association use cases in the updated explainer and alternatives considered.

…io stream

We want to switch to  stream-Relative (0-based) impl. since:
- In Web Audio and Media APIs (HTMLMediaElement.currentTime, AudioContext.currentTime, WebCodecs VideoFrame.timestamp), media timelines are always 0-based offsets relative to stream start, not the time origin.
- Immune to inter-process jitter since SODA and audio capture run in a separate utility/browser process. Translating stream offsets to the renderer's timeOrigin relies on estimating when IPC AudioStarted() arrived, which introduces IPC latency jitter. Stream-relative offsets are not prune to this and aligns with the raw audio frames.
- If SpeechRecognition is used with a pre-recorded MediaStreamTrack, a 0-based stream offset reflects the actual position in the audio track regardless of when the webpage was loaded.
- Being relative to performance.timeOrigin doesn't make sense in general for the Web Speech API because it assumes that the audio source is live. Since a SpeechRecognizer can also be created for a prerecorded media stream I think the timestamps on the speech recognition events should be relative to the position in that media stream.

See https://crbug.com/542330168 for more details.
Added a section on converting stream timestamps to document time origin and provided a live translation latency example with code.
Added separator before security section and closed example section for live transcription measurements.
Revised explainer to focus on timeline association use cases with the new SpeechRecognitionResult timestamps.  Provided 2 examples and interactive demo.
@alan33d alan33d self-assigned this Sep 3, 2026
@alan33d
alan33d marked this pull request as ready for review September 3, 2026 02:55
@alan33d
alan33d merged commit bcdfb7f into main Sep 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants