fix(Remote playback): kludge to scrub after stream move
This commit is contained in:
@@ -284,22 +284,35 @@ impl JellyfinClient {
|
||||
}
|
||||
|
||||
/// Seek on a remote session
|
||||
///
|
||||
/// Jellyfin's `/Sessions/{id}/Playing/Seek` endpoint takes the target as the
|
||||
/// `SeekPositionTicks` *query parameter*, not a JSON body. Sending it in the
|
||||
/// body (as we used to) is silently ignored and the remote never seeks.
|
||||
pub async fn session_seek(
|
||||
&self,
|
||||
session_id: String,
|
||||
position_ticks: i64,
|
||||
) -> Result<(), String> {
|
||||
#[derive(serde::Serialize)]
|
||||
#[serde(rename_all = "PascalCase")]
|
||||
struct SeekRequest {
|
||||
seek_position_ticks: i64,
|
||||
let url = format!(
|
||||
"{}/Sessions/{}/Playing/Seek?SeekPositionTicks={}",
|
||||
self.config.server_url, session_id, position_ticks
|
||||
);
|
||||
|
||||
let response = self.http_client
|
||||
.post(&url)
|
||||
.header("X-Emby-Authorization", self.get_auth_header())
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| format!("Network request failed: {}", e))?;
|
||||
|
||||
let status = response.status();
|
||||
if !status.is_success() {
|
||||
let error_text = response.text().await.unwrap_or_else(|_| "Unknown error".to_string());
|
||||
return Err(format!("Jellyfin API error {}: {}", status.as_u16(), error_text));
|
||||
}
|
||||
|
||||
let request = SeekRequest {
|
||||
seek_position_ticks: position_ticks,
|
||||
};
|
||||
|
||||
self.post(&format!("/Sessions/{}/Playing/Seek", session_id), &request).await
|
||||
log::info!("[JellyfinClient] Seek to {} ticks on session {}", position_ticks, session_id);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Send a full GeneralCommand to a remote session.
|
||||
|
||||
Reference in New Issue
Block a user