watson-developer-cloud / swift-sdk

:iphone: The Watson Swift SDK enables developers to quickly add Watson Cognitive Computing services to their Swift applications.
https://watson-developer-cloud.github.io/swift-sdk/
Apache License 2.0
878 stars 222 forks source link

[speech-to-text] Speech to text transcribe completionHandler doesn't fire under some circumstances #174

Closed simonmcl closed 8 years ago

simonmcl commented 8 years ago

Just started using this in a POC app. I introduced a timer to stop the recording if the user doesn't speak for X seconds. While testing this feature I uploaded a file that had only silence in it (watson stt probably through an error or returned no results / alternatives). XCGLogger printed the following:

g0,128,0;g;2016-02-03 10:05:04.092 [Info] > XCGLogger Version: 3.1.1 - LogLevel: Info[;
g0,128,0;g;2016-02-03 10:05:04.094 [Info] > XCGLogger writing to log to: IBMWatsonLog.txt -- <path>[;
g0,128,0;g;2016-02-03 10:05:04.094 [Info] [0x7fcc29b147b0] [WatsonSocket.swift:97] connectWebsocket() > Got a response back from the server[;
g0,128,0;g;2016-02-03 10:05:04.761 [Info] [main] [WatsonSocket.swift:149] websocketDidDisconnect(_:error:) > Websocket disconnected[;
g0,128,0;g;2016-02-03 10:05:05.714 [Info] [0x7fcc29b147b0] [WatsonSocket.swift:97] connectWebsocket() > Got a response back from the server[;
g0,128,0;g;2016-02-03 10:05:06.256 [Info] [main] [WatsonSocket.swift:139] websocketDidConnect > Sending {"action": "start", "content-type": "audio/wav"} through socket[;
g0,128,0;g;2016-02-03 10:05:06.257 [Info] [0x7fcc29801d60] [WatsonSocket.swift:240] main() > Uploading audio of length 863632[;
g0,128,0;g;2016-02-03 10:05:06.483 [Info] [main] [WatsonSocket.swift:178] websocketDidReceiveMessage(_:text:) > [;
g0,128,0;g;2016-02-03 10:05:06.484 [Info] [main] [WatsonSocket.swift:184] websocketDidReceiveMessage(_:text:) > Speech recognition is listening[;
g0,128,0;g;2016-02-03 10:05:08.907 [Info] [main] [WatsonSocket.swift:178] websocketDidReceiveMessage(_:text:) > [;
g0,128,0;g;2016-02-03 10:05:08.908 [Info] [main] [WatsonSocket.swift:178] websocketDidReceiveMessage(_:text:) > [;
g0,128,0;g;2016-02-03 10:05:08.908 [Info] [main] [WatsonSocket.swift:184] websocketDidReceiveMessage(_:text:) > Speech recognition is listening[;
g0,128,0;g;2016-02-03 10:05:38.869 [Info] [main] [WatsonSocket.swift:178] websocketDidReceiveMessage(_:text:) > [;
g0,128,0;g;2016-02-03 10:05:38.870 [Info] [main] [WatsonSocket.swift:149] websocketDidDisconnect(_:error:) > Websocket disconnected[;
g255,165,0;g;2016-02-03 10:05:38.870 [Warning] [main] [WatsonSocket.swift:161] websocketDidDisconnect(_:error:) > connection closed by server[;

However the completion handler for the SpeechToText.transcribe(audioData: , format: , completionHandler:) was never called.

Using:

Xcode 7.2 (7C68) iOS 9.1

luish commented 8 years ago

I have noticed this same issue.

glennrfisher commented 8 years ago

Thanks @simonmcl and @luish! This is definitely something we'll be addressing in the new implementation of speech to text that we're working on.

I added this problem as an explicit feature requested of the new implementation, so that we can't miss it. For more information about the redesign, please see #168.

Since this problem is captured in #168, I'm going to close this issue in favor of that one.