Skip to content
Open
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
8 changes: 6 additions & 2 deletions src/rev_ai/streamingclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def start(self,
start_ts=None,
transcriber=None,
language=None,
skip_postprocessing=None):
skip_postprocessing=None,
max_segment_duration_seconds=None):
"""Function to connect the websocket to the URL and start the response
thread
:param generator: generator object that yields binary audio data
Expand Down Expand Up @@ -124,6 +125,9 @@ def start(self,
if skip_postprocessing:
url += '&' + urlencode({'skip_postprocessing': 'true'})

if max_segment_duration_seconds:
url += '&' + urlencode({'max_segment_duration_seconds': max_segment_duration_seconds})

try:
self.client.connect(url)
except Exception as e:
Expand All @@ -146,7 +150,7 @@ def _start_send_data_thread(self, generator):
raise ValueError('generator must be provided')

if hasattr(self, 'request_thread'):
if self.request_thread.isAlive():
if self.request_thread.is_alive():
raise RuntimeError("""Data is still being sent and will interfere
with the responses.""")

Expand Down