diff --git a/openvidu-browser/src/OpenVidu/Session.ts b/openvidu-browser/src/OpenVidu/Session.ts index 05d4ccf8..fcb47bd2 100644 --- a/openvidu-browser/src/OpenVidu/Session.ts +++ b/openvidu-browser/src/OpenVidu/Session.ts @@ -1317,13 +1317,10 @@ export class Session extends EventDispatcher { /** * @hidden */ - async onSpeechToTextMessage(event: { streamId: string; connectionId: string; sessionId: string, timestamp: number, raw: string }): Promise { + async onSpeechToTextMessage(event: { streamId: string; connectionId: string; sessionId: string, text: string, reason: string, raw: string }): Promise { const connection = await this.getConnection(event.connectionId, 'No connection found for connectionId ' + event.connectionId); - const ev = new SpeechToTextEvent(this, connection, event.timestamp, event.raw); + const ev = new SpeechToTextEvent(this, connection, event.text, event.reason.toLowerCase(), event.raw); this.ee.emitEvent('speechToTextMessage', [ev]); - if (ev.raw.includes('text')) { - console.log(ev); - } } /** diff --git a/openvidu-browser/src/OpenViduInternal/Events/SpeechToTextEvent.ts b/openvidu-browser/src/OpenViduInternal/Events/SpeechToTextEvent.ts index b866dc04..52cfe8d9 100644 --- a/openvidu-browser/src/OpenViduInternal/Events/SpeechToTextEvent.ts +++ b/openvidu-browser/src/OpenViduInternal/Events/SpeechToTextEvent.ts @@ -20,18 +20,25 @@ import { Connection } from '../../OpenVidu/Connection'; import { Session } from '../../OpenVidu/Session'; /** - * Triggered by [[SessionEventMap.signal]] + * Triggered by [[SessionEventMap.speechToTextMessage]] */ export class SpeechToTextEvent extends Event { + /** - * The connectionId of the + * The [[Connection]] owning the Stream that produced the speech-to-text event. + * In other words, this is the participant that spoke and produced this transcription event. */ connection: Connection; /** - * + * The text of the event. This is the transcription for this specific piece of audio stream */ - timestamp: number; + text: string; + + /** + * All speech-to-text events are generated + */ + reason: 'recognizing' | 'recognized'; /** * The original event from the speech to text engine. This can vary depending on the engine @@ -41,10 +48,11 @@ export class SpeechToTextEvent extends Event { /** * @hidden */ - constructor(target: Session, connection: Connection, timestamp: number, raw: string) { + constructor(target: Session, connection: Connection, text: string, reason: 'recognizing' | 'recognized', raw: string) { super(false, target, 'speechToTextMessage'); this.connection = connection; - this.timestamp = timestamp; + this.text = text; + this.reason = reason; this.raw = raw; } diff --git a/openvidu-client/src/main/java/io/openvidu/client/internal/ProtocolElements.java b/openvidu-client/src/main/java/io/openvidu/client/internal/ProtocolElements.java index 22bb0ed3..35452918 100644 --- a/openvidu-client/src/main/java/io/openvidu/client/internal/ProtocolElements.java +++ b/openvidu-client/src/main/java/io/openvidu/client/internal/ProtocolElements.java @@ -232,7 +232,9 @@ public class ProtocolElements { public static final String SPEECHTOTEXTMESSAGE_TIMESTAMP_PARAM = "timestamp"; public static final String SPEECHTOTEXTMESSAGE_SESSIONID_PARAM = "sessionId"; public static final String SPEECHTOTEXTMESSAGE_CONNECTIONID_PARAM = "connectionId"; - public static final String SPEECHTOTEXTMESSAGE_RAW_PARAM = "raw"; + public static final String SPEECHTOTEXTMESSAGE_TEXT_PARAM = "text"; + public static final String SPEECHTOTEXTMESSAGE_REASON_PARAM = "reason"; + public static final String SPEECHTOTEXTMESSAGE_RAW_PARAM = "raw"; public static final String CUSTOM_NOTIFICATION = "customNotification"; diff --git a/openvidu-server/src/main/java/io/openvidu/server/config/OpenviduConfig.java b/openvidu-server/src/main/java/io/openvidu/server/config/OpenviduConfig.java index 8daeb3c2..da455c5a 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/config/OpenviduConfig.java +++ b/openvidu-server/src/main/java/io/openvidu/server/config/OpenviduConfig.java @@ -640,7 +640,7 @@ public class OpenviduConfig { webrtcIceServersBuilders = loadWebrtcIceServers("OPENVIDU_WEBRTC_ICE_SERVERS"); - Boolean openviduDevAux = asOptionalBoolean("OPENVIDU_DEV"); + Boolean openviduDevAux = asOptionalBoolean("OPENVIDU_DEV", false); if (openviduDevAux != null) { openviduDev = openviduDevAux; } @@ -887,9 +887,9 @@ public class OpenviduConfig { return getValue(property); } - protected Boolean asOptionalBoolean(String property) { + protected Boolean asOptionalBoolean(String property, boolean storeInConfigProps) { Boolean value = null; - String strValue = this.getValue(property, false); + String strValue = this.getValue(property, storeInConfigProps); if (strValue != null) { value = Boolean.parseBoolean(strValue); }