videosdk-plugins-lmnt 0.0.21__tar.gz → 0.0.23__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of videosdk-plugins-lmnt might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: videosdk-plugins-lmnt
3
- Version: 0.0.21
3
+ Version: 0.0.23
4
4
  Summary: VideoSDK Agent Framework plugin for LMNT AI Text-to-Speech services
5
5
  Author: videosdk
6
6
  License-Expression: Apache-2.0
@@ -13,7 +13,7 @@ Classifier: Topic :: Multimedia :: Video
13
13
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
14
  Requires-Python: >=3.11
15
15
  Requires-Dist: httpx>=0.24.0
16
- Requires-Dist: videosdk-agents>=0.0.21
16
+ Requires-Dist: videosdk-agents>=0.0.23
17
17
  Description-Content-Type: text/markdown
18
18
 
19
19
  # VideoSDK LMNT AI Plugin
@@ -21,7 +21,7 @@ classifiers = [
21
21
  "Topic :: Scientific/Engineering :: Artificial Intelligence",
22
22
  ]
23
23
  dependencies = [
24
- "videosdk-agents>=0.0.21",
24
+ "videosdk-agents>=0.0.23",
25
25
  "httpx>=0.24.0",
26
26
  ]
27
27
 
@@ -53,6 +53,7 @@ class LMNTTTS(TTS):
53
53
  self.base_url = base_url
54
54
  self.audio_track = None
55
55
  self.loop = None
56
+ self._first_chunk_sent = False
56
57
 
57
58
  self.api_key = api_key or os.getenv("LMNT_API_KEY")
58
59
  if not self.api_key:
@@ -71,6 +72,10 @@ class LMNTTTS(TTS):
71
72
  ),
72
73
  )
73
74
 
75
+ def reset_first_audio_tracking(self) -> None:
76
+ """Reset the first audio tracking state for next TTS task"""
77
+ self._first_chunk_sent = False
78
+
74
79
  async def synthesize(
75
80
  self,
76
81
  text: AsyncIterator[str] | str,
@@ -164,6 +169,10 @@ class LMNTTTS(TTS):
164
169
  audio_chunk = accumulated_data[:chunk_size]
165
170
  accumulated_data = accumulated_data[chunk_size:]
166
171
 
172
+ if not self._first_chunk_sent and self._first_audio_callback:
173
+ self._first_chunk_sent = True
174
+ await self._first_audio_callback()
175
+
167
176
  self.loop.create_task(self.audio_track.add_new_bytes(audio_chunk))
168
177
  await asyncio.sleep(0.01)
169
178
 
@@ -171,6 +180,11 @@ class LMNTTTS(TTS):
171
180
  chunk_size = int(self.output_sample_rate * LMNT_CHANNELS * 2 * 20 / 1000)
172
181
  if len(accumulated_data) < chunk_size:
173
182
  accumulated_data += b'\x00' * (chunk_size - len(accumulated_data))
183
+
184
+ if not self._first_chunk_sent and self._first_audio_callback:
185
+ self._first_chunk_sent = True
186
+ await self._first_audio_callback()
187
+
174
188
  self.loop.create_task(self.audio_track.add_new_bytes(accumulated_data))
175
189
 
176
190
  except httpx.HTTPError as e:
@@ -0,0 +1 @@
1
+ __version__ = "0.0.23"
@@ -1 +0,0 @@
1
- __version__ = "0.0.21"