loopCheckTranscribingChannelQueue method
void
loopCheckTranscribingChannelQueue()
Implementation
void loopCheckTranscribingChannelQueue() async{
while(duringConversation){
if(transcribingChannelQueue.isNotEmpty){
var obj = transcribingChannelQueue.removeFirst();
var result = await translate(obj.text, fromLang, toLang);
if(result != null){
try{
var data = JsonDecoder().convert(result);
azureSttCallback.onTranscribingEvent(obj.speakerId,obj.text,data[0]["translations"][0]["text"],2,true,obj.speechStartTimeStamp,obj.speechEndTimeStamp,DateTime.now().millisecondsSinceEpoch);
}
catch(ex){
azureSttCallback.onTranscribingEvent(obj.speakerId,obj.text,"",2,false,obj.speechStartTimeStamp,obj.speechEndTimeStamp,DateTime.now().millisecondsSinceEpoch);
}
}
else{
azureSttCallback.onTranscribingEvent(obj.speakerId,obj.text,"",2,false,obj.speechStartTimeStamp,obj.speechEndTimeStamp,DateTime.now().millisecondsSinceEpoch);
}
}
else{
await Future.delayed(Duration(milliseconds: 50));
}
}
}