Skip to content
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

useTrackTranscription equivalent for react native? #159

Open
kotani123 opened this issue Jul 11, 2024 · 6 comments
Open

useTrackTranscription equivalent for react native? #159

kotani123 opened this issue Jul 11, 2024 · 6 comments

Comments

@kotani123
Copy link

I wanted to know if there was a useTrackTranscription equivalent for the react native package.
The agent-playground uses this to display the chat messages for both the user and the agent.

I wanted to know if there was a built in way of achieving the same thing in a react-native app.

@davidliu
Copy link
Contributor

I think it might be fine to use the components-react hook? Can't test at the moment, but it's worth trying it out yourself. If it works, I'll add it to our list of exports.

@kotani123
Copy link
Author

Thank you so much! I will try it out!

@goatandsheep
Copy link

is this pertaining to closed captions / subtitles?

@tarikozket
Copy link

the @livekit/react-native doesn't export the necessary useTrackTranscription hook. you need to add @livekit/components-react to your react native project and import it from there. once imported, you can use it like in the following:

  const { isMicrophoneEnabled, localParticipant, microphoneTrack } = useLocalParticipant();

  const localMessages = useTrackTranscription({
    publication: microphoneTrack,
    source: Track.Source.Microphone,
    participant: localParticipant,
  });

here is an example from the playground's source code.

@davidliu
Copy link
Contributor

@tarikozket hey, can you confirm if this works for you? I never got around to testing this myself, but if it works, I can add it to this library's export list (not all of the component-react hooks work, so we re-export to keep a confirmed list of working hooks).

@tarikozket
Copy link

yup, it does 👍

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

No branches or pull requests

4 participants