Transcript
Speaker-labelled, timestamped segments synced to playback: click to seek, the word playing marked, search built in.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
segments | TranscriptSegment[] | [] | The segments, in time order. |
speakers | Record<string, TranscriptSpeaker> | {} | Speaker ids mapped to a name, an avatar and a colour. |
current-time | number | undefined | undefined | The playing position in seconds, when there is no media. |
follow | boolean | true | Keeps the segment playing in view. |
layout | 'default' | 'compact' | default | default, or compact: a time before every segment and no avatars. |
query | string | — | Text to mark, ignoring case and accents. |
Events
| Name | Type | Description |
|---|---|---|
match-change | CustomEvent<TranscriptMatchEventDetail> | The matches of query, or the one shown, changed. |
transcript-seek | CustomEvent<TranscriptSeekEventDetail> | A time, a segment or a word was clicked. Cancel it to keep media where it is. |
CSS parts
Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.
| Name | Description |
|---|---|
scroll | The scroll box. |
group | A speaker's run of segments. |
speaker | A speaker's name. |
time | A timestamp button. |
segment | A segment. |
jump | The "Jump to current" button. |
CSS custom properties
Grouped by semantic target and state from --c2-<component>__<target>__<state>--<property>. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-transcript--padding | length | 12px | Space inside the scroll box. |
--c2-transcript--font-size | font-size | 14px | |
--c2-transcript--line-height | number | 1.55 | |
--c2-transcript--color | color | #18181b | |
--c2-transcript__group--gap | length | 18px | Space between speaker groups. |
--c2-transcript__avatar--size | pixel | 28px | |
--c2-transcript__speaker--font-weight | font-weight | 600 | |
--c2-transcript__time--color | color | #71717a | |
--c2-transcript__time--font-size | font-size | 12px | |
--c2-transcript__time__hover--color | color | rgb(2, 101, 220) | |
--c2-transcript__segment--padding | padding | 2px 6px | |
--c2-transcript__segment--border-radius | border-radius | 6px | |
--c2-transcript__segment__active--background-color | color | rgba(2, 101, 220, 0.1) | |
--c2-transcript__segment__focus--outline-color | color | rgb(2, 101, 220) | |
--c2-transcript__word__active--decoration-color | color | rgb(2, 101, 220) | |
--c2-transcript__word__upcoming--color | color | #71717a | Words of the segment playing that are still to come. |
--c2-transcript__interim--color | color | #71717a | |
--c2-transcript__mark--background-color | color | #fef08a | |
--c2-transcript__mark--color | color | #18181b | |
--c2-transcript__mark__current--outline-color | color | #ca8a04 | |
--c2-transcript__jump--background-color | color | #ffffff | |
--c2-transcript__jump--color | color | #18181b | |
--c2-transcript__jump--border | border | 1px solid #e4e4e7 | |
--c2-transcript__jump--box-shadow | box-shadow | 0 2px 8px rgba(0, 0, 0, 0.15) | |
--c2-transcript__speaker-1--color | color | #1d4ed8 | |
--c2-transcript__speaker-2--color | color | #b45309 | |
--c2-transcript__speaker-3--color | color | #7e22ce | |
--c2-transcript__speaker-4--color | color | #047857 | |
--c2-transcript__speaker-5--color | color | #be123c | |
--c2-transcript__speaker-6--color | color | #0e7490 | |
--c2-transcript__speaker-7--color | color | #4d7c0f | |
--c2-transcript__speaker-8--color | color | #a21caf | |
Text and languages
The text the component shows, in English. It shows another language when the app adds one with addTranslations, under transcript, and the nearest lang asks for it; any message not translated stays in English. {0}, {1}… stand for the values a message carries. Languages guide.
| Key | English | Values |
|---|---|---|
transcript | Transcript | — |
group | {0}, {1} | {0} speaker {1} time |
playFrom | Play from {0} | {0} time |
jump | Jump to current | — |
matches | {0} of {1} matches | {0} current {1} count |
noMatches | No matches | — |