diff --git a/assets/sounds/guest_joined_call.wav b/assets/sounds/guest_joined_call.wav new file mode 100644 index 0000000000..336a6ca754 Binary files /dev/null and b/assets/sounds/guest_joined_call.wav differ diff --git a/crates/audio/src/audio.rs b/crates/audio/src/audio.rs index 379af34751..955713b7f0 100644 --- a/crates/audio/src/audio.rs +++ b/crates/audio/src/audio.rs @@ -55,6 +55,7 @@ pub fn init(cx: &mut App) { #[derive(Debug, Copy, Clone, Eq, Hash, PartialEq)] pub enum Sound { Joined, + GuestJoined, Leave, Mute, Unmute, @@ -67,6 +68,7 @@ impl Sound { fn file(&self) -> &'static str { match self { Self::Joined => "joined_call", + Self::GuestJoined => "guest_joined_call", Self::Leave => "leave_call", Self::Mute => "mute", Self::Unmute => "unmute", diff --git a/crates/call/src/call_impl/room.rs b/crates/call/src/call_impl/room.rs index 0d44a82c57..e659d1cf05 100644 --- a/crates/call/src/call_impl/room.rs +++ b/crates/call/src/call_impl/room.rs @@ -23,7 +23,7 @@ use livekit_client::{self as livekit, AudioStream, TrackSid}; use postage::{sink::Sink, stream::Stream, watch}; use project::Project; use settings::Settings as _; -use std::{future::Future, mem, rc::Rc, sync::Arc, time::Duration}; +use std::{future::Future, mem, rc::Rc, sync::Arc, time::Duration, time::Instant}; use util::{ResultExt, TryFutureExt, paths::PathStyle, post_inc}; pub const RECONNECT_TIMEOUT: Duration = Duration::from_secs(30); @@ -86,6 +86,7 @@ pub struct Room { room_update_completed_rx: watch::Receiver>, pending_room_update: Option>, maintain_connection: Option>>, + created: Instant, } impl EventEmitter for Room {} @@ -157,6 +158,7 @@ impl Room { maintain_connection: Some(maintain_connection), room_update_completed_tx, room_update_completed_rx, + created: cx.background_executor().now(), } } @@ -827,7 +829,17 @@ impl Room { }, ); - Audio::play_sound(Sound::Joined, cx); + // When joining a room start_room_connection gets + // called but we have already played the join sound. + // Dont play extra sounds over that. + if this.created.elapsed() > Duration::from_millis(100) { + if let proto::ChannelRole::Guest = role { + Audio::play_sound(Sound::GuestJoined, cx); + } else { + Audio::play_sound(Sound::Joined, cx); + } + } + if let Some(livekit_participants) = &livekit_participants && let Some(livekit_participant) = livekit_participants .get(&ParticipantIdentity(user.id.to_string()))