2022-10-10 11:45:27 +02:00
/ *
* ( C ) Copyright 2017 - 2022 OpenVidu ( https : //openvidu.io)
*
* Licensed under the Apache License , Version 2.0 ( the "License" ) ;
* you may not use this file except in compliance with the License .
* You may obtain a copy of the License at
*
* http : //www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing , software
* distributed under the License is distributed on an "AS IS" BASIS ,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND , either express or implied .
* See the License for the specific language governing permissions and
* limitations under the License .
*
* /
import { Event } from './Event' ;
import { Connection } from '../../OpenVidu/Connection' ;
import { Session } from '../../OpenVidu/Session' ;
/ * *
2022-10-17 12:27:23 +02:00
* Triggered by [ [ SessionEventMap . speechToTextMessage ] ]
2022-10-10 11:45:27 +02:00
* /
export class SpeechToTextEvent extends Event {
2022-10-17 12:27:23 +02:00
2022-10-10 11:45:27 +02:00
/ * *
2022-10-17 12:27:23 +02:00
* 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 .
2022-10-10 11:45:27 +02:00
* /
connection : Connection ;
/ * *
2022-10-17 12:27:23 +02:00
* The text of the event . This is the transcription for this specific piece of audio stream
* /
text : string ;
/ * *
* All speech - to - text events are generated
2022-10-10 11:45:27 +02:00
* /
2022-10-17 12:27:23 +02:00
reason : 'recognizing' | 'recognized' ;
2022-10-10 11:45:27 +02:00
/ * *
* The original event from the speech to text engine . This can vary depending on the engine
* /
raw : string ;
2022-10-21 10:32:00 +02:00
/ * *
2022-11-02 12:17:44 +01:00
* [ BCP - 47 ] ( https : //tools.ietf.org/html/bcp47) language tag (like "en-US" or "es-ES") of the recognized text. This will be the same as the language provided
2022-10-21 10:32:00 +02:00
* in method [ [ Session . subscribeToSpeechToText ] ] method
* /
lang : string ;
2022-10-10 11:45:27 +02:00
/ * *
* @hidden
* /
2022-10-21 10:32:00 +02:00
constructor ( target : Session , connection : Connection , text : string , reason : 'recognizing' | 'recognized' , raw : string , lang : string ) {
2022-10-10 12:04:17 +02:00
super ( false , target , 'speechToTextMessage' ) ;
2022-10-10 11:45:27 +02:00
this . connection = connection ;
2022-10-17 12:27:23 +02:00
this . text = text ;
this . reason = reason ;
2022-10-10 11:45:27 +02:00
this . raw = raw ;
2022-10-21 10:32:00 +02:00
this . lang = lang ;
2022-10-10 11:45:27 +02:00
}
/ * *
* @hidden
* /
// tslint:disable-next-line:no-empty
callDefaultBehavior() { }
}