mirror of
https://github.com/Stremio/stremio-shell-ng.git
synced 2026-05-12 09:10:46 +00:00
fix: player seeking issues
This commit is contained in:
parent
7f2bbb2c12
commit
8a49a638d4
2 changed files with 10 additions and 9 deletions
|
|
@ -16,12 +16,14 @@ impl PlayerProprChange {
|
||||||
fn value_from_format(data: PropertyData, as_json: bool) -> serde_json::Value {
|
fn value_from_format(data: PropertyData, as_json: bool) -> serde_json::Value {
|
||||||
match data {
|
match data {
|
||||||
PropertyData::Flag(d) => serde_json::Value::Bool(d),
|
PropertyData::Flag(d) => serde_json::Value::Bool(d),
|
||||||
PropertyData::Int64(d) => serde_json::Value::Number(
|
PropertyData::Int64(d) => match serde_json::Number::from_f64(d as f64) {
|
||||||
serde_json::Number::from_f64(d as f64).expect("MPV returned invalid number"),
|
Some(n) => serde_json::Value::Number(n),
|
||||||
),
|
None => serde_json::Value::Null,
|
||||||
PropertyData::Double(d) => serde_json::Value::Number(
|
},
|
||||||
serde_json::Number::from_f64(d).expect("MPV returned invalid number"),
|
PropertyData::Double(d) => match serde_json::Number::from_f64(d) {
|
||||||
),
|
Some(n) => serde_json::Value::Number(n),
|
||||||
|
None => serde_json::Value::Null,
|
||||||
|
},
|
||||||
PropertyData::OsdStr(s) => serde_json::Value::String(s.to_string()),
|
PropertyData::OsdStr(s) => serde_json::Value::String(s.to_string()),
|
||||||
PropertyData::Str(s) => {
|
PropertyData::Str(s) => {
|
||||||
if as_json {
|
if as_json {
|
||||||
|
|
|
||||||
|
|
@ -102,8 +102,7 @@ fn create_event_thread(
|
||||||
.expect("failed to observer MPV property");
|
.expect("failed to observer MPV property");
|
||||||
}
|
}
|
||||||
|
|
||||||
// -1.0 means to block and wait for an event.
|
let event = match event_context.wait_event(1.) {
|
||||||
let event = match event_context.wait_event(-1.) {
|
|
||||||
Some(Ok(event)) => event,
|
Some(Ok(event)) => event,
|
||||||
Some(Err(error)) => {
|
Some(Err(error)) => {
|
||||||
eprintln!("Event errored: {error:?}");
|
eprintln!("Event errored: {error:?}");
|
||||||
|
|
@ -134,7 +133,7 @@ fn create_event_thread(
|
||||||
|
|
||||||
rpc_response_sender
|
rpc_response_sender
|
||||||
.send(RPCResponse::response_message(player_response.to_value()))
|
.send(RPCResponse::response_message(player_response.to_value()))
|
||||||
.expect("failed to send RPCResponse");
|
.ok();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue