Skip to content

Pull audio track from avatar worker in useVoiceAssistant #1130

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 6 commits into from
Apr 23, 2025

Conversation

bcherry
Copy link
Contributor

@bcherry bcherry commented Apr 22, 2025

  1. ensure avatar worker is never returned by useVoiceAssistant
  2. check avatar worker for audio track if main agent doesn't have one
  3. add video track to useVoiceAssistant

There's a remaining bug which is that useTrackTranscriptions doesn't work, as the agent won't publish legacy transcriptions if it has no audio track id. so we either need to fix something in the agents sdk so it can publish them anyways or just port this hook over to text streams

but for now this fixes the agent playground for video + audio at least

@bcherry bcherry requested a review from lukasIO April 22, 2025 06:18
Copy link

changeset-bot bot commented Apr 22, 2025

🦋 Changeset detected

Latest commit: 10c2380

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

This PR includes changesets to release 5 packages
Name Type
@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

Copy link
Contributor

github-actions bot commented Apr 22, 2025

size-limit report 📦

Path Size
LiveKitRoom only 5.98 KB (0%)
LiveKitRoom with VideoConference 30.42 KB (0%)
All exports 37.61 KB (+0.06% 🔺)

Copy link
Contributor

@lukasIO lukasIO left a comment

Choose a reason for hiding this comment

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

just some nits and comments

@@ -66,6 +78,7 @@ export function useVoiceAssistant(): VoiceAssistant {
agent,
state,
audioTrack,
videoTrack,
Copy link
Contributor

Choose a reason for hiding this comment

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

wouldn't we simply want to return all tracks that the agent publishes?
not a fan of audioTrack in the first place, but adding videoTrack doesn't make it any better.
Generally we have microphoneTrack and cameraTrack in our glossary of constructs, but not sure how well that works for agents

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah i don't have a strong opinion really. this seemed least disruptive and i think if you really want all the tracks you can get them from agent anyways

const agent = useRemoteParticipants().find((p) => p.kind === ParticipantKind.AGENT);
const audioTrack = useParticipantTracks([Track.Source.Microphone], agent?.identity)[0];
const agent = useRemoteParticipants().find(
(p) => p.kind === ParticipantKind.AGENT && !('lk.publish_on_behalf' in p.attributes),
Copy link
Contributor

Choose a reason for hiding this comment

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

where are we documenting these attributes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we probably need a full reference of special attributes but for now this is going into the avatar integration docs https://github.com/livekit/web/pull/1165/files#diff-42c10a5d6ec7f1e0d9ade709732ba1d4c3697b6d411523ecdc5a2ac75a9457efR46

@bcherry bcherry requested a review from lukasIO April 22, 2025 06:56
@bcherry bcherry merged commit 37182c3 into main Apr 23, 2025
6 checks passed
@bcherry bcherry deleted the bcherry/uva-avatar branch April 23, 2025 03:25
@github-actions github-actions bot mentioned this pull request Apr 23, 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