UNPKG

@invincible_rd/test-two

Version:

Ultron SDK for integrating conversational AI Avatars into your web application

19 lines (16 loc) 796 B
export function sendMessageToIframe(iframe: HTMLIFrameElement, message: any, url: string): void { if (iframe.contentWindow) { iframe.contentWindow.postMessage(message, url); } else { console.error('Iframe contentWindow is null'); } } export function sendMessageContent(iframe: HTMLIFrameElement, message: string, speak: boolean, lipsync: boolean, url: string): void { sendMessageToIframe(iframe, { type: 'MESSAGE_CONTENT', message, speak, lipsync }, url); } export function sendSubmitEvent(iframe: HTMLIFrameElement, url: string): void { sendMessageToIframe(iframe, { type: 'SUBMIT_EVENT' }, url); } export function sendAudioMessage(iframe: HTMLIFrameElement, audioData: string, url: string): void { sendMessageToIframe(iframe, { type: 'MESSAGE_AUDIO', audioData }, url); }