Skip to content

Add useTranscription hook #1109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 22, 2025
Merged

Add useTranscription hook #1109

merged 5 commits into from
May 22, 2025

Conversation

lukasIO
Copy link
Contributor

@lukasIO lukasIO commented Mar 27, 2025

with filtering based on participant identites and track ids.

Copy link

changeset-bot bot commented Mar 27, 2025

🦋 Changeset detected

Latest commit: 6a41f3f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@livekit/components-core Patch
@livekit/components-react Patch
@livekit/component-example-next Patch
@livekit/components-js-docs Patch
@livekit/component-docs-storybook Patch
@livekit/components-docs-gen Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@lukasIO lukasIO mentioned this pull request Mar 27, 2025
Copy link
Contributor

github-actions bot commented Mar 27, 2025

size-limit report 📦

Path Size
LiveKitRoom only 6 KB (0%)
LiveKitRoom with VideoConference 30.42 KB (0%)
All exports 37.8 KB (0%)

@lukasIO lukasIO requested a review from bcherry March 29, 2025 07:59
* ```
*/
export function useTranscriptions(opts?: UseTranscriptionsOptions) {
const { participantIdentities, trackSids } = opts ?? {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't adding these options expose an easy trap where you have

const agentTranscriptions = useTranscriptions({ participantIdentities: ['agent'] });

and

const userTranscriptions = useTranscriptions({ participantIdentities: ['user'] });

in two different locations and then they conflict on useTextStream which can only be used once?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the components implementation creates a registered handler cache that makes it possible to reuse streams across the app without running into that limitation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok that works. i do still think we should just make it easy for anyone to register multiple handlers but it's not a blocker to this PR

* ```
*/
export function useTranscriptions(opts?: UseTranscriptionsOptions) {
const { participantIdentities, trackSids } = opts ?? {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok that works. i do still think we should just make it easy for anyone to register multiple handlers but it's not a blocker to this PR

Copy link
Contributor

@bcherry bcherry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this also get adopted by useVoiceAssistant?

@lukasIO lukasIO merged commit f2a7e95 into main May 22, 2025
4 checks passed
@lukasIO lukasIO deleted the lukas/use-transcription branch May 22, 2025 09:08
@github-actions github-actions bot mentioned this pull request May 22, 2025
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