mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-11-23 03:19:38 +00:00
Remove WinRT code for handling paused player state, which caused issues with queued speech.
This commit is contained in:
parent
e66b8403aa
commit
0bbda0a90f
|
@ -175,7 +175,7 @@ impl Backend for WinRT {
|
||||||
text: &str,
|
text: &str,
|
||||||
interrupt: bool,
|
interrupt: bool,
|
||||||
) -> std::result::Result<Option<UtteranceId>, Error> {
|
) -> std::result::Result<Option<UtteranceId>, Error> {
|
||||||
trace!("speak({}, {})", text, interrupt);
|
println!("speak({}, {})", text, interrupt);
|
||||||
if interrupt {
|
if interrupt {
|
||||||
self.stop()?;
|
self.stop()?;
|
||||||
}
|
}
|
||||||
|
@ -183,16 +183,9 @@ impl Backend for WinRT {
|
||||||
let content_type = stream.content_type()?;
|
let content_type = stream.content_type()?;
|
||||||
let source = MediaSource::create_from_stream(stream, content_type)?;
|
let source = MediaSource::create_from_stream(stream, content_type)?;
|
||||||
let item = MediaPlaybackItem::create(source)?;
|
let item = MediaPlaybackItem::create(source)?;
|
||||||
let state = self.player.playback_session()?.playback_state()?;
|
|
||||||
if state == MediaPlaybackState::Paused {
|
|
||||||
let index = self.playback_list.current_item_index()?;
|
|
||||||
let total = self.playback_list.items()?.size()?;
|
|
||||||
if total != 0 && index == total - 1 {
|
|
||||||
self.reinit_player()?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.playback_list.items()?.append(&item)?;
|
self.playback_list.items()?.append(&item)?;
|
||||||
if !self.is_speaking()? {
|
if !self.is_speaking()? {
|
||||||
|
println!("Playing");
|
||||||
self.player.play()?;
|
self.player.play()?;
|
||||||
}
|
}
|
||||||
let mut uid = NEXT_UTTERANCE_ID.lock().unwrap();
|
let mut uid = NEXT_UTTERANCE_ID.lock().unwrap();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user