New RPC event "speechToTextDisconnected"

pull/761/head
pabloFuente 2022-11-15 19:25:40 +01:00
parent b9fb8942c5
commit 75eeda4aee
6 changed files with 30 additions and 7 deletions

View File

@ -875,7 +875,8 @@ export class OpenVidu {
mediaError: this.session.onMediaError.bind(this.session),
masterNodeCrashedNotification: this.onMasterNodeCrashedNotification.bind(this),
forciblyReconnectSubscriber: this.session.onForciblyReconnectSubscriber.bind(this.session),
speechToTextMessage: this.session.onSpeechToTextMessage.bind(this.session)
speechToTextMessage: this.session.onSpeechToTextMessage.bind(this.session),
speechToTextDisconnected: this.session.onSpeechToTextDisconnected.bind(this.session)
}
};
this.jsonRpcClient = new RpcBuilder.clients.JsonRpcClient(config);

View File

@ -53,6 +53,7 @@ import semverMajor = require('semver/functions/major');
* @hidden
*/
import semverMinor = require('semver/functions/minor');
import { ExceptionEvent, ExceptionEventName } from '../OpenViduInternal/Events/ExceptionEvent';
/**
* @hidden
@ -1345,6 +1346,13 @@ export class Session extends EventDispatcher {
this.ee.emitEvent('speechToTextMessage', [ev]);
}
/**
* @hidden
*/
async onSpeechToTextDisconnected(event: { message: string }): Promise<void> {
this.emitEvent('exception', [new ExceptionEvent(this, ExceptionEventName.SPEECH_TO_TEXT_DISCONNECTED, this, event.message)]);
}
/**
* @hidden
*/

View File

@ -78,7 +78,16 @@ export enum ExceptionEventName {
*
* [[ExceptionEvent]] objects with this [[ExceptionEvent.name]] will have as [[ExceptionEvent.origin]] property a [[Subscriber]] object.
*/
NO_STREAM_PLAYING_EVENT = 'NO_STREAM_PLAYING_EVENT'
NO_STREAM_PLAYING_EVENT = 'NO_STREAM_PLAYING_EVENT',
/**
* There has been a server-side disconnection of the Speech To Text module. From the moment this exception is fired to the moment method
* [[Session.subscribeToSpeechToText]] is called again, the transcription of the audio stream will not be available and no [[SpeechToTextEvent]]
* will be fired.
*
* [[ExceptionEvent]] objects with this [[ExceptionEvent.name]] will have as [[ExceptionEvent.origin]] property a [[Session]] object.
*/
SPEECH_TO_TEXT_DISCONNECTED = 'SPEECH_TO_TEXT_DISCONNECTED',
}
/**

View File

@ -155,7 +155,6 @@ public class ProtocolElements {
public static final String UNSUBSCRIBEFROMSPEECHTOTEXT_METHOD = "unsubscribeFromSpeechToText";
public static final String UNSUBSCRIBEFROMSPEECHTOTEXT_CONNECTIONID_PARAM = "connectionId";
// ---------------------------- SERVER RESPONSES & EVENTS -----------------
public static final String PARTICIPANTJOINED_METHOD = "participantJoined";
@ -239,6 +238,9 @@ public class ProtocolElements {
public static final String SPEECHTOTEXTMESSAGE_RAW_PARAM = "raw";
public static final String SPEECHTOTEXTMESSAGE_LANG_PARAM = "lang";
public static final String SPEECHTOTEXTDISCONNECTED_METHOD = "speechToTextDisconnected";
public static final String SPEECHTOTEXTDISCONNECTED_MESSAGE_PARAM = "message";
public static final String CUSTOM_NOTIFICATION = "customNotification";
public static final String RECORDER_PARTICIPANT_PUBLICID = "RECORDER";

View File

@ -23,6 +23,9 @@ import java.util.concurrent.TimeUnit;
public class CommandLineExecutor {
/**
* WARNING: does not work with subshell. i.e: echo $(VARIABLE)
*/
public String executeCommand(String command, int secondsTimeout) {
String output = "";
Process p = null;

View File

@ -38,12 +38,12 @@
"name": "openvidu-testapp",
"private": true,
"scripts": {
"build": "ng build",
"build": "NODE_OPTIONS=--openssl-legacy-provider ng build",
"e2e": "ng e2e",
"lint": "ng lint",
"ng": "ng",
"start": "ng serve",
"test": "ng test"
"start": "NODE_OPTIONS=--openssl-legacy-provider ng serve --host 0.0.0.0 --ssl",
"test": "NODE_OPTIONS=--openssl-legacy-provider ng test"
},
"version": "2.23.0"
}