Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Examples/ExampleStreaming.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ private IEnumerator CreateService()
yield return null;

_service = new SpeechToTextService(authenticator);
if (!string.IsNullOrEmpty(_serviceUrl))
{
_service.SetServiceUrl(_serviceUrl);
}
_service.StreamMultipart = true;

Active = true;
Expand Down Expand Up @@ -192,9 +196,7 @@ private IEnumerator RecordingHandler()

yield return new WaitForSeconds(timeRemaining);
}

}

yield break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public partial class SpeechToTextService : BaseService
private const float WsKeepAliveInterval = 20.0f;
/// <summary>
/// If no listen state is received after start is sent within this time, we will timeout
/// and stop listening.
/// and stop listening.
/// </summary>
private const float ListenTimeout = 10.0f;
/// <summary>
Expand Down Expand Up @@ -77,9 +77,9 @@ public partial class SpeechToTextService : BaseService
#endregion

#region Private Data
private OnRecognize _listenCallback = null; // Callback is set by StartListening()
private OnRecognize _listenCallback = null; // Callback is set by StartListening()
private OnRecognizeSpeaker _speakerLabelCallback = null;
private WSConnector _listenSocket = null; // WebSocket object used when StartListening() is invoked
private WSConnector _listenSocket = null; // WebSocket object used when StartListening() is invoked
private bool _listenActive = false;
private bool _audioSent = false;
private bool _isListening = false;
Expand Down Expand Up @@ -541,6 +541,8 @@ private IEnumerator KeepAlive()
// Temporary clip to use for KeepAlive
// TODO: Generate small sound clip to send to the service to keep alive.
AudioClip _keepAliveClip = Resources.Load<AudioClip>("highHat");
while (_keepAliveClip.loadState != AudioDataLoadState.Loaded)
yield return null;

#if ENABLE_DEBUGGING
Log.Debug("SpeechToText.KeepAlive()", "Sending keep alive.");
Expand Down