1
0
mirror of https://github.com/ndarilek/tts-rs.git synced 2024-11-22 22:59:37 +00:00

Don't double-speak previous item when not flushing queue.

This commit is contained in:
Nolan Darilek 2020-11-03 11:20:02 -06:00
parent 9c98026978
commit 289a35dc83

View File

@ -156,6 +156,12 @@ impl Backend for WinRT {
let content_type = stream.content_type()?;
let source = MediaSource::create_from_stream(stream, content_type)?;
let item = MediaPlaybackItem::create(source)?;
let item_index = self.playback_list.current_item_index()?;
let item_count = self.playback_list.items()?.size()?;
let state = self.player.playback_session()?.playback_state()?;
if state == MediaPlaybackState::Paused && item_index != 0 {
self.playback_list.items()?.clear()?;
}
self.playback_list.items()?.append(&item)?;
if !self.is_speaking()? {
self.player.play()?;