Discussions

Ask a Question
Back to all

Sending Arabic to Heygen

Hey

I am using Interactive avatar NextJS Demo with my own Arabic SST.

The thing is when I send Arabic text to handleSpeak function, the avatar replay that she will replay in English not Arabic, sometimes she go with English directly.

How to solve this issue?


//Piece of fucntion
const transcription = await transcribeAudio(audioBlob, language);  
        if (transcription) {  
          console.log("Transcription:", transcription);  
          await handleSpeak(transcription + " reply in arabic");
        }

 const handleSpeak = async (text: string, talkType?: string) => {
    setIsLoadingRepeat(true);
    if (isAvatarTalking)
      handleInterrupt();
    // if text = "Hello, How are you"
    // result the same "Hello, How are you"
    let taskTypes: TaskType = TaskType.TALK

    try {
      await avatar.current?.speak({
        text,
        taskType: taskTypes,
        taskMode: TaskMode.ASYNC,
      });
    } catch (error) {
      setDebug(error instanceof Error ? error.message : "Unknown error");
    } finally {
      setIsLoadingRepeat(false);
    }
  };