mirror of
https://github.com/ndarilek/tts-rs.git
synced 2024-11-17 12:19:37 +00:00
WinRT fixes.
* Use released `winrt` crate. * Implement `is_speaking`.
This commit is contained in:
parent
b691124d3f
commit
c82ea5f3b3
|
@ -15,7 +15,7 @@ thiserror = "1"
|
|||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
tolk = "0.2"
|
||||
winrt = { git = "https://github.com/microsoft/winrt-rs", rev = "ed46a71f506c343b3eb4fa6c15a4d9db1397ebcf" }
|
||||
winrt = "0.7"
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
speech-dispatcher = "0.4"
|
||||
|
|
|
@ -4,15 +4,15 @@ use winrt::*;
|
|||
import!(
|
||||
dependencies
|
||||
os
|
||||
modules
|
||||
"windows.media.core"
|
||||
"windows.media.playback"
|
||||
"windows.media.speechsynthesis"
|
||||
types
|
||||
windows::media::core::MediaSource
|
||||
windows::media::playback::{MediaPlaybackItem, MediaPlaybackList, MediaPlaybackState, MediaPlayer}
|
||||
windows::media::speech_synthesis::SpeechSynthesizer
|
||||
);
|
||||
|
||||
use log::{info, trace};
|
||||
use windows::media::core::MediaSource;
|
||||
use windows::media::playback::{MediaPlaybackItem, MediaPlaybackList, MediaPlayer};
|
||||
use windows::media::playback::{MediaPlaybackItem, MediaPlaybackList, MediaPlaybackState, MediaPlayer};
|
||||
use windows::media::speech_synthesis::SpeechSynthesizer;
|
||||
|
||||
use crate::{Backend, Error, Features};
|
||||
|
@ -139,6 +139,8 @@ impl Backend for WinRT {
|
|||
}
|
||||
|
||||
fn is_speaking(&self) -> std::result::Result<bool, Error> {
|
||||
unimplemented!()
|
||||
let state = self.player.playback_session()?.playback_state()?;
|
||||
let playing = state == MediaPlaybackState::Playing;
|
||||
Ok(playing)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user