Skip to content

Commit a228f6c

Browse files
authored
Add Azure TTS callbacks as updatable options (#1645)
1 parent 648c850 commit a228f6c

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.changeset/green-jobs-own.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"livekit-plugins-azure": patch
3+
---
4+
5+
Add callbacks as updatable Azure TTS options

livekit-plugins/livekit-plugins-azure/livekit/plugins/azure/tts.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,39 @@ def update_options(
243243
language: str | None = None,
244244
prosody: ProsodyConfig | None = None,
245245
style: StyleConfig | None = None,
246+
on_bookmark_reached_event: Callable | None = None,
247+
on_synthesis_canceled_event: Callable | None = None,
248+
on_synthesis_completed_event: Callable | None = None,
249+
on_synthesis_started_event: Callable | None = None,
250+
on_synthesizing_event: Callable | None = None,
251+
on_viseme_event: Callable | None = None,
252+
on_word_boundary_event: Callable | None = None,
246253
) -> None:
247254
self._opts.voice = voice or self._opts.voice
248255
self._opts.language = language or self._opts.language
249256
self._opts.prosody = prosody or self._opts.prosody
250257
self._opts.style = style or self._opts.style
251258

259+
self._opts.on_bookmark_reached_event = (
260+
on_bookmark_reached_event or self._opts.on_bookmark_reached_event
261+
)
262+
self._opts.on_synthesis_canceled_event = (
263+
on_synthesis_canceled_event or self._opts.on_synthesis_canceled_event
264+
)
265+
self._opts.on_synthesis_completed_event = (
266+
on_synthesis_completed_event or self._opts.on_synthesis_completed_event
267+
)
268+
self._opts.on_synthesis_started_event = (
269+
on_synthesis_started_event or self._opts.on_synthesis_started_event
270+
)
271+
self._opts.on_synthesizing_event = (
272+
on_synthesizing_event or self._opts.on_synthesizing_event
273+
)
274+
self._opts.on_viseme_event = on_viseme_event or self._opts.on_viseme_event
275+
self._opts.on_word_boundary_event = (
276+
on_word_boundary_event or self._opts.on_word_boundary_event
277+
)
278+
252279
def synthesize(
253280
self,
254281
text: str,

0 commit comments

Comments
 (0)