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.
When the voice to text service has decoded a user's speech and delivered a piece of transcription of it.
wrtc.onTranscription(call, text, from)
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 wrtc.onNewCallObject()