@@ -44,7 +44,7 @@ public partial class SpeechToTextService : BaseService
4444 private const float WsKeepAliveInterval = 20.0f ;
4545 /// <summary>
4646 /// If no listen state is received after start is sent within this time, we will timeout
47- /// and stop listening.
47+ /// and stop listening.
4848 /// </summary>
4949 private const float ListenTimeout = 10.0f ;
5050 /// <summary>
@@ -77,9 +77,9 @@ public partial class SpeechToTextService : BaseService
7777 #endregion
7878
7979 #region Private Data
80- private OnRecognize _listenCallback = null ; // Callback is set by StartListening()
80+ private OnRecognize _listenCallback = null ; // Callback is set by StartListening()
8181 private OnRecognizeSpeaker _speakerLabelCallback = null ;
82- private WSConnector _listenSocket = null ; // WebSocket object used when StartListening() is invoked
82+ private WSConnector _listenSocket = null ; // WebSocket object used when StartListening() is invoked
8383 private bool _listenActive = false ;
8484 private bool _audioSent = false ;
8585 private bool _isListening = false ;
@@ -541,6 +541,8 @@ private IEnumerator KeepAlive()
541541 // Temporary clip to use for KeepAlive
542542 // TODO: Generate small sound clip to send to the service to keep alive.
543543 AudioClip _keepAliveClip = Resources . Load < AudioClip > ( "highHat" ) ;
544+ while ( _keepAliveClip . loadState != AudioDataLoadState . Loaded )
545+ yield return null ;
544546
545547#if ENABLE_DEBUGGING
546548 Log . Debug ( "SpeechToText.KeepAlive()" , "Sending keep alive." ) ;
0 commit comments