Added JAM feature

This commit is contained in:
Ultradesu
2026-07-28 18:35:59 +01:00
parent 29466d70e8
commit 1c721b68f5
12 changed files with 1080 additions and 22 deletions
+15
View File
@@ -805,6 +805,7 @@ pub enum FedInputField {
ConnectTicket,
DeviceName,
ConnectInvite,
JamInvite,
}
impl FedInputField {
@@ -814,6 +815,7 @@ impl FedInputField {
FedInputField::ConnectTicket => "Connect to peer (paste ticket)",
FedInputField::DeviceName => "Device name",
FedInputField::ConnectInvite => "Connect device (paste frid://i invite)",
FedInputField::JamInvite => "Join Jam (paste frid://j invite)",
}
}
@@ -831,6 +833,9 @@ impl FedInputField {
FedInputField::ConnectInvite => {
"Paste a frid:// invite generated by another client to add this device to its sync group."
}
FedInputField::JamInvite => {
"Paste a frid://j capability to control the host player for this Jam only."
}
}
}
}
@@ -1210,6 +1215,7 @@ pub enum DevicePlaybackRole {
#[default]
Active,
Control,
Jam,
}
impl DevicePlaybackRole {
@@ -1217,6 +1223,7 @@ impl DevicePlaybackRole {
match self {
DevicePlaybackRole::Active => "active",
DevicePlaybackRole::Control => "control",
DevicePlaybackRole::Jam => "jam",
}
}
}
@@ -1232,11 +1239,18 @@ pub struct DevicePlaybackState {
pub local_idle_since_ms: Option<i64>,
pub remote: BTreeMap<String, crate::devices::PlaybackSnapshot>,
pub last_remote_snapshot: Option<crate::devices::PlaybackSnapshot>,
pub jam_host: bool,
}
impl DevicePlaybackState {
pub fn is_control(&self) -> bool {
self.role == DevicePlaybackRole::Control
|| (self.role == DevicePlaybackRole::Jam && !self.jam_host)
}
pub fn is_audio_owner(&self) -> bool {
self.role == DevicePlaybackRole::Active
|| (self.role == DevicePlaybackRole::Jam && self.jam_host)
}
pub fn active_label(&self) -> String {
@@ -1264,6 +1278,7 @@ pub struct AppState {
pub settings_cursor: usize,
pub player: PlayerBar,
pub device_playback: DevicePlaybackState,
pub jam: crate::jam::JamStatus,
pub visualizer: crate::visualizer::VisualizerState,
pub global: GlobalTab,
pub artist_views: HashMap<i64, Loadable<ArtistDetail>>,