====== onTranscription() ====== wrtc.onTranscription() occurs when a call receives voice to text transcription. You can use this event to add subtitles to the video feed from the user. ===== Occurs ===== When the voice to text service has decoded a user's speech and delivered a piece of transcription of it. ===== Arguments ===== wrtc.onTranscription(call, text, from) * call - [[ixnx:wrtc:js:api:call:start|call]] object raising the event (undefined if transcripting yourself) * text - string containing a piece of transcription * from - string containing the address name of the decoded user ===== Example ===== You can use wrtc.onTranscription() either to build a transcription of a call by piecing multiple wrtc.onTranscription() events together to a complete transcript, or to add subtitles to the video feed of remote users: var transcript = ""; var prev_from; wrtc.onTranscription = function(callobj, text, from) { // Transcription: if (from != prev_from) transcript += "\r\n\r\n" + from + ": " + text; else transcript += " " + text; // Subtitles: if (callobj) { callobj.user.subtitles.innerHTML = text; wrtc.setTimeout(callobj, ".user.subtitles.innerHTML=\"\"", 3000 + text.length * 200); } } Create and add a .user.subtitles field to the call object in [[ixnx:wrtc:js:api:wrtc:onnewcallobject|wrtc.onNewCallObject()]]