Cognitive speech service is not working in one of the zebra device TC51 but same code working fine in other device (Nokia 7.2)
JituVarghese opened this issue · comments
I am developing a app having continuous speech to text functionality using Microsoft speech to text cognitive services SDK , its working fine & start the continuous speech to text process in Nokia 7.2 but its not working in Zebra device TC51 as it automatically stopped session instantly with cancellation reason end of stream.
I am using speech recognition SDK version : com.microsoft.cognitiveservices.speech:client-sdk:1.38.0
Code :
**Speech Recognition initialization code**
private val speechReco: SpeechRecognizer by lazy {
speechConfig = SpeechConfig.fromSubscription(speechSubscriptionKey, speechRegion)
// config.SetProperty("SPEECH-AudioBufferLength", "100");
speechConfig?.setProperty("SPEECH-AudioBufferLength","100")
destroyMicrophoneStream() // in case it was previously initialized
microphoneStream = MicrophoneStream()
SpeechRecognizer(
speechConfig,
AudioConfig.fromStreamInput(MicrophoneStream.create())
)
}
** Continuous speech recognition process**
private fun startReco() {
startRecoButton.isEnabled = false
val task = speechReco.startContinuousRecognitionAsync()
executorService.submit {
task.get()
Log.i(activityTag, "Continuous recognition finished. Stopping speechReco")
}
speechReco.canceled.addEventListener { sender, e ->
Log.i(
"Session started",
"canceled executed---${e.sessionId.toString()} result---${e.result.toString()}--- reason ${e.reason.toString()}--- error code ${e.errorCode.toString()}--- errordetails ${e.errorDetails.toString()}"
)
}
speechReco.sessionStarted.addEventListener { sender, e ->
Log.i(
"Session started",
"session executed---${e.sessionId.toString()} sender---${sender.toString()}--- Authorization ${speechReco.authorizationToken.toString()}"
)
}
speechReco.sessionStopped.addEventListener { sender, e ->
Log.i(
"Session started",
"session stopped executed---${e.sessionId.toString()} sender---${sender.toString()}--- Authorization ${speechReco.authorizationToken.toString()}"
)
}
speechReco.recognized.addEventListener { sender, e ->
Log.i(
"Session started",
"recognized executed---${e.result.text.toString()} sender---${sender.toString()} --- ${e.result.text}"
)
val finalResult = e.result.text
runOnUiThread {
recognizedText.text = (finalResult)
// stopReco()
}
}
speechReco.recognizing.addEventListener { sender, e ->
Log.i(
"Session started",
"recognizing executed---${e.result.text.toString()} sender---${sender.toString()}"
)
}
// speechReco.startContinuousRecognitionAsync()
}
Response :
Errorcode : NoError
Status code : Canceled Recognized text:<>
Canellation Reason : EndOfStream
Error Details : " "
Complete response details as follows:
e = {SpeechRecognitionCanceledEventArgs@5797} "SessionId:94561080e4d94bcf95bbe2f3045da5b1 ResultId:5ea199e6a78d45a6b79ea80528cd290b CancellationReason:EndOfStream CancellationErrorCode:NoError Error details:<"
cancellationReason = {CancellationReason@5748} "EndOfStream"
errorCode = {CancellationErrorCode@5749} "NoError"
errorDetails = ""
result = {SpeechRecognitionResult@5800} "ResultId:5ea199e6a78d45a6b79ea80528cd290b Status:Canceled Recognized text:<>."
offset = {BigInteger@5801} "0"
eventHandle = null
maxSessionID = 37
maxUUID = 36
sessionId = "94561080e4d94bcf95bbe2f3045da5b1"
Please suggest any changes or solution for it. Thanks