Discussions
How to know if the Avatar is talking or not?
I have integarted HeyGen Interactive avatar in a React Native interactive chat app.
how to know if the bot on the call is talking or not, I am using react-native-webrtc and JS code logic of heygen.
const setupChannel = async () => {
const {sdp: serverSdp, ice_servers2: iceServers} = sessionInfo;
console.log('sessionInfo...', sessionInfo);
dispatch(updateSessionId(sessionInfo.session_id));
setDataInAsyncStorage(sessionInfo.session_id);
peerConnection.current = new RTCPeerConnection({iceServers});
peerConnection.current.ontrack = event => {
console.log('Received track:', event.streams[0]);
dispatch(updateRemoteStream(event.streams[0]));
};
peerConnection.current.ondatachannel = async event => {
const dataChannel = event.channel;
dataChannel.onmessage = message => {
console.log('Message from server:', message.data);
};
};
const remoteDescription = new RTCSessionDescription(serverSdp);
await peerConnection.current.setRemoteDescription(remoteDescription);
};
how to know if the bot on the call is talking or not, I am using react-native-webrtc and JS code logic of heygen.
when bot is talking i am getting
dataChannel.onmessage = message => {
console.log('Message from server:', message.data);
}; but this is not constantly sending events