diff --git a/src/rev_ai/streamingclient.py b/src/rev_ai/streamingclient.py index e91cca5b..3ed01f7e 100644 --- a/src/rev_ai/streamingclient.py +++ b/src/rev_ai/streamingclient.py @@ -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 @@ -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: @@ -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.""")