1
0
Fork 0
mirror of https://gitlab.com/futo-org/fcast.git synced 2025-07-31 14:27:01 +00:00

Added websocket wrapper for TCP connection to Android receiver.

This commit is contained in:
Koen 2023-12-06 09:04:14 +01:00
parent b339f4f487
commit ad8f3985a3
22 changed files with 1165 additions and 277 deletions

View file

@ -146,7 +146,7 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
session.send_message(Opcode::Play, Some(play_message))?;
} else if let Some(seek_matches) = matches.subcommand_matches("seek") {
let seek_message = SeekMessage::new(match seek_matches.value_of("timestamp") {
Some(s) => s.parse::<u64>()?,
Some(s) => s.parse::<f64>()?,
_ => return Err("Timestamp is required.".into())
});
println!("Sent seek {:?}", seek_message);

View file

@ -16,18 +16,19 @@ impl PlayMessage {
#[derive(Serialize, Debug)]
pub struct SeekMessage {
pub time: u64,
pub time: f64,
}
impl SeekMessage {
pub fn new(time: u64) -> Self {
pub fn new(time: f64) -> Self {
Self { time }
}
}
#[derive(Deserialize, Debug)]
pub struct PlaybackUpdateMessage {
pub time: u64,
pub time: f64,
pub duration: f64,
pub state: u8 //0 = None, 1 = Playing, 2 = Paused
}