mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-11-22 02:59:38 +00:00
Fix: Call utterance_end callback on WinRT
This commit is contained in:
parent
4cb7e609e0
commit
507eeff456
|
@ -114,10 +114,23 @@ impl WinRt {
|
|||
let utterances_clone = tts.utterances.clone();
|
||||
tts.player.MediaEnded(&TypedEventHandler::new(
|
||||
move |player: &Option<MediaPlayer>, _args| {
|
||||
utterances_clone.lock().unwrap().pop_front(); // Utterance that just ended
|
||||
let mut utterances = utterances_clone.lock().unwrap();
|
||||
|
||||
if let Some(utterance) = utterances_clone.lock().unwrap().front() {
|
||||
utterance.speak(
|
||||
let ended_utterance = utterances.pop_front().unwrap();
|
||||
|
||||
if let Some(callback) = CALLBACKS
|
||||
.lock()
|
||||
.unwrap()
|
||||
.get_mut(&bid)
|
||||
.unwrap()
|
||||
.utterance_end
|
||||
.as_mut()
|
||||
{
|
||||
callback(ended_utterance.id);
|
||||
}
|
||||
|
||||
if let Some(new_utterance) = utterances.front() {
|
||||
new_utterance.speak(
|
||||
&synth_clone,
|
||||
player.as_ref().unwrap(),
|
||||
CALLBACKS.lock().unwrap().get_mut(&bid).unwrap(),
|
||||
|
|
Loading…
Reference in New Issue
Block a user