3ec29dc911234f837665c5845616e7ff4bbea6e9
Streaming Avatar Demo
Pre-Requisites
- Node.js and npm installed on your system.
- API key for HeyGen's API or Trial Token
Run the Demo
-
Clone the repository.
git clone https://github.com/HeyGen-Official/StreamingAvatar.git -
Open the
index.jsfile and replace'YourApiKey'with your API key:"apiKey": "YourApiKey"; -
(optional) Open the
server.jsfile and set your OpenAI API key to use talk mode:const openai = new OpenAI({ apiKey: "<your openai api key>", }); -
open a terminal in the folder and then install the express and run the server.js:
npm install express node server.js -
you will see
App is listening on port 3000!.
Use the Demo
- Make sure you are whitelisted to use the HeyGen's Streaming avatar API.
- Open the web browser and enter the
http://localhost:3000to start the demo. - Click the "New" button to create a new session. The status updates will be displayed on the screen.
- After the session is created successfully, click the "Start" button to start streaming the avatar.
- To send a task to the avatar, type the text in the provided input field and click the "Repeat Text" button.
- In order to use Talk mode, set your OpenAI key in server.js before starting the server and click "Talk" button
- Once done, click the "Close Connection" button to close the session.
Remember, this is a demo and should be modified according to your needs and preferences. Happy coding!
Troubleshooting
In case you face any issues while running the demo or have any questions, feel free to raise an issue in this repository or contact our support team.
Please note, if you encounter a "Server Error", it could be due to the server being offline. In such cases, please contact the service provider.
Description
Languages
JavaScript
74.2%
CSS
16.2%
HTML
9.6%