add test actions for setting audio output

This commit is contained in:
Mikayla Maki 2023-06-29 16:23:16 -07:00
parent 01a5110387
commit 6429dce6a5
No known key found for this signature in database
2 changed files with 14 additions and 1 deletions

View File

@ -1060,6 +1060,11 @@ impl Room {
self.live_kit.as_ref().map(|live_kit| live_kit.deafened)
}
pub fn test_set_audio(&mut self, _cx: &mut ModelContext<Self>) {
let output = live_kit_client::Room::audio_output_sources();
dbg!(output.get(2).map(|device| device.set()));
}
pub fn share_microphone(&mut self, cx: &mut ModelContext<Self>) -> Task<Result<()>> {
if self.status.is_offline() {
return Task::ready(Err(anyhow!("room is offline")));

View File

@ -23,7 +23,8 @@ actions!(
ToggleMute,
ToggleDeafen,
LeaveCall,
ShareMicrophone
ShareMicrophone,
SetThirdAudioOutput,
]
);
@ -40,6 +41,7 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut AppContext) {
cx.add_global_action(toggle_mute);
cx.add_global_action(toggle_deafen);
cx.add_global_action(share_microphone);
cx.add_global_action(test);
}
pub fn toggle_screen_sharing(_: &ToggleScreenSharing, cx: &mut AppContext) {
@ -77,3 +79,9 @@ pub fn share_microphone(_: &ShareMicrophone, cx: &mut AppContext) {
.detach_and_log_err(cx)
}
}
pub fn test(_: &SetThirdAudioOutput, cx: &mut AppContext) {
if let Some(room) = ActiveCall::global(cx).read(cx).room().cloned() {
room.update(cx, Room::test_set_audio)
}
}