Your Android phone and your Windows PC, working as one. Local-first, end-to-end encrypted, no account.
Play on phone: mute this PC while a phone watches
Beec7b565ce0aae
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8006186..9af1b61 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -15,6 +15,8 @@ change things that need a step from you, and its notes say so.as it plays, picture and sound, so your browser's ad blocker stillworks on YouTube: the phone shows just the video, even with otherwindows over it on the PC. Tap the notification on the phone to watch.+ The PC mutes its speakers while you watch and turns them back on after+ (**Settings › Camera & Audio** to keep them on).Scripts can do the same through the local API(`POST /v1/play-on-phone`).- **Phone as microphone.** In **Settings › Camera & Audio**, Start asksdiff --git a/desktop/app/qml/pages/SettingsPage.qml b/desktop/app/qml/pages/SettingsPage.qmlindex 457b50b..8fdac64 100644--- a/desktop/app/qml/pages/SettingsPage.qml+++ b/desktop/app/qml/pages/SettingsPage.qml@@ -1557,6 +1557,20 @@ Item {Divider { width: parent.width }+ ListRow {+ width: parent.width+ iconPath: Icons.soundOff+ title: qsTr("Mute this PC while a phone watches")+ description: qsTr("With Play on phone, the phone still gets the sound.")+ Toggle {+ label: qsTr("Mute this PC while a phone watches")+ checked: Preferences.muteWhileWatched+ onToggled: (on) => Preferences.muteWhileWatched = on+ }+ }++ Divider { width: parent.width }+// Phone as microphone: its sound plays into an output; a// virtual audio cable's other end is a microphone apps can pick.ListRow {diff --git a/desktop/app/src/bridge/prefs.rs b/desktop/app/src/bridge/prefs.rsindex f7d7689..dff2629 100644--- a/desktop/app/src/bridge/prefs.rs+++ b/desktop/app/src/bridge/prefs.rs@@ -58,6 +58,8 @@ pub mod qobject {#[qproperty(bool, auto_copy_otp)]/// Pause PC media playback while a phone call is ringing or active.#[qproperty(bool, pause_media_on_call)]+ /// Mute this PC while a phone watches its playback (Play on phone).+ #[qproperty(bool, mute_while_watched, cxx_name = "muteWhileWatched")]/// Quiet phone notification pop-ups on the PC while the phone is in Do Not Disturb.#[qproperty(bool, sync_dnd)]/// Paired phones in Explorer's "Send to" menu.@@ -259,6 +261,7 @@ pub struct PreferencesRust {suggest_clipboard_actions: bool,auto_copy_otp: bool,pause_media_on_call: bool,+ mute_while_watched: bool,sync_dnd: bool,send_to_menu: bool,start_with_windows: bool,@@ -330,6 +333,8 @@ impl cxx_qt::Initialize for qobject::Preferences {self.as_mut().set_auto_copy_otp(settings.auto_copy_otp);crate::notifications::set_auto_copy_otp(settings.auto_copy_otp);self.as_mut().set_pause_media_on_call(settings.pause_media_on_call);+ self.as_mut().set_mute_while_watched(settings.mute_while_watched);+ crate::pc_mirror::set_mute_while_watched(settings.mute_while_watched);crate::calls::set_pause_media_on_call(settings.pause_media_on_call);self.as_mut().set_sync_dnd(settings.sync_dnd);crate::notifications::set_sync_dnd(settings.sync_dnd);@@ -418,6 +423,12 @@ impl cxx_qt::Initialize for qobject::Preferences {p.save();}).release();+ self.as_mut()+ .on_mute_while_watched_changed(|p| {+ crate::pc_mirror::set_mute_while_watched(p.mute_while_watched);+ p.save();+ })+ .release();self.as_mut().on_pause_media_on_call_changed(|p| {crate::calls::set_pause_media_on_call(p.pause_media_on_call);@@ -865,6 +876,7 @@ impl qobject::Preferences {suggest_clipboard_actions: p.suggest_clipboard_actions,auto_copy_otp: p.auto_copy_otp,pause_media_on_call: p.pause_media_on_call,+ mute_while_watched: p.mute_while_watched,sync_dnd: p.sync_dnd,send_to_menu: p.send_to_menu,auto_update: p.auto_update,diff --git a/desktop/app/src/main.rs b/desktop/app/src/main.rsindex 17af192..ed42945 100644--- a/desktop/app/src/main.rs+++ b/desktop/app/src/main.rs@@ -551,6 +551,7 @@ fn main() -> ExitCode {notifications::set_auto_copy_otp(settings.auto_copy_otp);notifications::set_sync_dnd(settings.sync_dnd);calls::set_pause_media_on_call(settings.pause_media_on_call);+ pc_mirror::set_mute_while_watched(settings.mute_while_watched);recordings::init(&settings);send_to::set_enabled(settings.send_to_menu);battery::set_enabled(settings.battery_alerts);diff --git a/desktop/app/src/pc_mirror.rs b/desktop/app/src/pc_mirror.rsindex c4a550c..ddd7bd8 100644--- a/desktop/app/src/pc_mirror.rs+++ b/desktop/app/src/pc_mirror.rs@@ -869,18 +869,33 @@ fn run_capture_loop(cleanup_session(&stop);}+/// Mute this PC's speakers while a phone watches (the setting).+static MUTE_WHILE_WATCHED: AtomicBool = AtomicBool::new(true);++pub fn set_mute_while_watched(on: bool) {+ MUTE_WHILE_WATCHED.store(on, Ordering::Relaxed);+}+/// The PC's sound going to a phone that watches one of its players (as-/// Phone speaker sends it), for as long as this lives; then as before.+/// Phone speaker sends it), with the PC's speakers muted if the user wants+/// (capturing the sound doesn't depend on them), for as long as this lives;+/// then as before.struct SoundToPhone {was_on: bool,was_target: Option<DeviceId>,+ /// This muted the speakers (they weren't already).+ muted: bool,}impl SoundToPhone {fn start(peer: DeviceId) -> SoundToPhone {+ let muted = MUTE_WHILE_WATCHED.load(Ordering::Relaxed)+ && win::audio::speaker_state().is_some_and(|(_, muted)| !muted)+ && win::audio::set_speaker_mute(true).is_ok();let sound = SoundToPhone {was_on: crate::pc_audio_stream::is_enabled(),was_target: crate::pc_audio_stream::target(),+ muted,};crate::pc_audio_stream::set_target(Some(peer));crate::pc_audio_stream::set_enabled(true);@@ -892,6 +907,10 @@ impl Drop for SoundToPhone {fn drop(&mut self) {crate::pc_audio_stream::set_target(self.was_target);crate::pc_audio_stream::set_enabled(self.was_on);+ // Unmuted only if this muted it.+ if self.muted {+ let _ = win::audio::set_speaker_mute(false);+ }}}diff --git a/desktop/app/src/settings.rs b/desktop/app/src/settings.rsindex 3a7fe18..00b49b2 100644--- a/desktop/app/src/settings.rs+++ b/desktop/app/src/settings.rs@@ -290,6 +290,9 @@ pub struct Settings {/// Pause PC media playback while a phone call is ringing or active.#[serde(alias = "pause_media_on_call", alias = "auto_pause_media")]pub pause_media_on_call: bool,+ /// Play on phone: mute this PC's speakers while a phone watches its+ /// playback (the phone still gets the sound).+ pub mute_while_watched: bool,/// Quiet phone notification pop-ups on the PC while the phone is in Do Not Disturb.#[serde(alias = "sync_dnd")]pub sync_dnd: bool,@@ -430,6 +433,7 @@ impl Default for Settings {suggest_clipboard_actions: true,auto_copy_otp: false,pause_media_on_call: true,+ mute_while_watched: true,sync_dnd: false,send_to_menu: true,auto_update: true,@@ -580,6 +584,7 @@ mod tests {suggest_clipboard_actions: false,auto_copy_otp: true,pause_media_on_call: false,+ mute_while_watched: false,sync_dnd: true,send_to_menu: false,auto_update: false,