How to align a transcript to what is on screen
Ask for the transcript with words set to true and every word carries a start and an end. Frame times come back in the same units on the frames call, so lining them up is arithmetic rather than guesswork — and each sheet already carries the words spoken across its own window in a spoken field.
Last updated
The call
Copy this as it stands. “What was on screen while they said the price?” is the question it answers.
const { segments } = await playhead.transcript({ url, words: true });
const price = segments
.flatMap((s) => s.words ?? [])
.find((w) => /\$\d/.test(w.word));
if (price) {
const frame = await playhead.watch({
url,
detail: "single",
start: price.start,
end: price.start,
});
console.log(`"${price.word}" at ${price.start}s →`, frame.sheets[0]?.url);
}curl -X POST https://api.tryplayhead.com/v1/transcript \
-H "Authorization: Bearer $PLAYHEAD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "…", "words": true}' | jq '.segments[0].words'Watch out for
Everything the API can refuse, and what to send instead, is on the errors page.