Resume unknown episode positions from progress, not 0
The web player only knows a podcast episode's position from a handoff or a seek. When Next, auto-advance, a click or a play command makes an episode current, it now reports `position_unknown` instead of 0, and the server takes the resume position (and the register generation) from the relayed progress register before it hands the state to another device. Remote Next/Prev/play commands to a device do the same. Next with repeat all or shuffle wraps past a trailing unplayable item instead of stopping on it. Prev leaves an unplayable item instead of "restarting" it, and seeking such an item moves its kept position. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ab7202fc73
commit
d1be583d1e
8 files changed
+435
-30
No files matched your search
@@ -274,6 +274,10 @@ pub(super) struct PlayerDevicePlaybackStateDto {
|
||||
pub(super) volume: f64,
|
||||
#[serde(default)]
|
||||
pub(super) updated_at_ms: i64,
|
||||
/// The browser does not know the position of its current item, a podcast
|
||||
/// episode it cannot play (`queue_items::POSITION_UNKNOWN_KEY`).
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub(super) position_unknown: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, JsonSchema)]
|
||||
|
||||
@@ -1472,6 +1472,7 @@ mod device_tests {
|
||||
repeat_mode: "off".to_string(),
|
||||
volume: 0.7,
|
||||
updated_at_ms: current_millis(),
|
||||
position_unknown: false,
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -1806,6 +1807,7 @@ mod jam_command_tests {
|
||||
repeat_mode: "off".into(),
|
||||
volume: 0.5,
|
||||
updated_at_ms: 0,
|
||||
position_unknown: false,
|
||||
};
|
||||
let redacted = redact_playback_state_for_jam(playback.clone());
|
||||
assert_eq!(redacted.duration_seconds, 0.0);
|
||||
|
||||
@@ -24,6 +24,13 @@ use serde_json::Value;
|
||||
pub(crate) const WIRE_TRACK_KEY: &str = "wire_track";
|
||||
/// Browser track key holding the explicit [`PlaybackSource`] of an external item.
|
||||
pub(crate) const SOURCE_KEY: &str = "source";
|
||||
/// Browser playback state key: `true` when the browser does not know the
|
||||
/// position of its current item. That happens when it selects a podcast
|
||||
/// episode it cannot play (Next, auto-advance, a click or a play command):
|
||||
/// it is never told where the episode was left, and inventing 0 would
|
||||
/// restart the episode for every device. The server then takes the
|
||||
/// position from the episode's progress register.
|
||||
pub(crate) const POSITION_UNKNOWN_KEY: &str = "position_unknown";
|
||||
|
||||
/// Reason shown for federated music that is not in this library.
|
||||
pub(crate) const FED_UNAVAILABLE_REASON: &str = "Not available on this web player yet";
|
||||
|
||||
Reference in new issue
Block a user