Skip to content

Develop#102

Merged
ucswift merged 3 commits intomasterfrom
develop
Jan 29, 2026
Merged

Develop#102
ucswift merged 3 commits intomasterfrom
develop

Conversation

@ucswift
Copy link
Member

@ucswift ucswift commented Jan 28, 2026

Summary by CodeRabbit

  • New Features

    • Expanded audio device support to include Bluetooth, wired, and speaker options.
  • Improvements

    • Smarter audio routing across device selections and platforms for more reliable output.
    • Smoother audio play/stop transitions that preserve playback state during device switches.
    • Improved audio settings navigation (back behavior) and a more consistent header with always-visible audio button.
    • Minor layout refinements for tighter header and content spacing.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

📝 Walkthrough

Walkthrough

Adds previousView state for bottom-sheet navigation, broadens device filtering for microphones/speakers, changes audio stream stop behavior to optionally preserve state, and introduces platform-aware audio routing tied to selected audio devices.

Changes

Cohort / File(s) Summary
UI: LiveKit bottom sheet
src/components/livekit/livekit-bottom-sheet.tsx
Adds previousView state to restore prior view after audio settings; consolidates header layout and always renders audio settings button; adjusts horizontal padding and minor connected/view layout tweaks.
Device filtering: Audio settings
src/components/settings/audio-device-selection.tsx
Updates filters: microphones include bluetooth, wired, default (exclude devices tagged as speakers); speakers include bluetooth, wired, speaker, default and explicitly exclude device id default-mic; analytics counts adjusted.
Audio playback state
src/stores/app/audio-stream-store.ts
Changes stopStream signature to stopStream(clearState?: boolean); play flow does optimistic updates and calls stopStream(false) to preserve currentStream; stop logic now selectively clears state based on clearState.
LiveKit routing & subscriptions
src/stores/app/livekit-store.ts
Introduces setupAudioRouting(room) to configure platform-aware audio routing (Android/iOS via Expo Audio), logs device characteristics, and subscribes to selectedAudioDevices to apply routing when selections change.
Minor formatting
src/components/audio-stream/audio-stream-bottom-sheet.tsx, src/components/personnel/personnel-card.tsx
Whitespace/formatting-only tweaks with no behavior changes.

Sequence Diagram(s)

sequenceDiagram
    participant DeviceStore as Device Store\n(selectedAudioDevices)
    participant LiveKitStore as LiveKit Store
    participant Room as LiveKit Room
    participant AudioAPI as Expo Audio API

    DeviceStore->>LiveKitStore: selectedAudioDevices changes
    activate LiveKitStore
    LiveKitStore->>LiveKitStore: setupAudioRouting(room) invoked
    LiveKitStore->>LiveKitStore: log selected speaker/mic info

    alt Platform is Android/iOS
        LiveKitStore->>AudioAPI: Audio.setAudioModeAsync(mode)
        AudioAPI-->>LiveKitStore: mode applied
    end

    LiveKitStore->>Room: apply routing (speaker vs earpiece)
    Room-->>LiveKitStore: routing confirmed
    deactivate LiveKitStore
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • Develop #100: Touches src/components/personnel/personnel-card.tsx; relevant due to overlapping edits to that component.

Poem

🐰
Ears up, buttons bright and keen,
I hop between the views unseen,
Devices sorted, routes set true,
Streams stay steady, sound is new,
A rabbit cheers — audio pristine! 🎧

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Develop' is vague and does not convey any meaningful information about the changeset, which includes audio device filtering, audio stream management, LiveKit routing, and UI layout improvements. Replace the title with a descriptive summary of the main changes, such as 'Improve audio device selection and routing logic' or a title that reflects the primary objective of this pull request.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/settings/audio-device-selection.tsx (1)

25-32: Align analytics counts with updated device filters.
The mic/speaker lists now include wired/default and exclude default-mic for speakers, but the analytics counts still use the old criteria, so event payloads can drift from what users see. Consider updating the counts to match the new filters.

🔧 Update analytics counts to match the new filters
-        availableMicrophonesCount: availableAudioDevices.filter((device) => (device.type === 'bluetooth' ? device.isAvailable : true)).length,
-        availableSpeakersCount: availableAudioDevices.filter((device) => device.isAvailable).length,
+        availableMicrophonesCount: availableAudioDevices.filter(
+          (device) =>
+            (device.type === 'bluetooth' || device.type === 'wired' || device.type === 'default') &&
+            (device.type !== 'bluetooth' || device.isAvailable)
+        ).length,
+        availableSpeakersCount: availableAudioDevices.filter(
+          (device) =>
+            (device.type === 'bluetooth' || device.type === 'wired' || device.type === 'speaker' || device.type === 'default') &&
+            device.id !== 'default-mic' &&
+            (device.type !== 'bluetooth' || device.isAvailable)
+        ).length,
🧹 Nitpick comments (2)
src/stores/app/livekit-store.ts (2)

16-17: Remove duplicated comment line.
Two identical comment lines are stacked; keep just one.

🧹 Suggested cleanup
-// Helper function to setup audio routing based on selected devices
-// Helper function to setup audio routing based on selected devices
+// Helper function to setup audio routing based on selected devices

34-43: Avoid any in audioModeConfig typing.
Use expo-av’s AudioMode type (or the equivalent in your version) to keep type safety. Please confirm the exact type name in your expo-av version (e.g., AudioMode vs AudioModeOptions). As per coding guidelines, avoid using any; use precise types.

✅ Type-safe config
-import { Audio } from 'expo-av';
+import { Audio, type AudioMode } from 'expo-av';
@@
-      const audioModeConfig: any = {
+      const audioModeConfig: AudioMode = {

@ucswift
Copy link
Member Author

ucswift commented Jan 28, 2026

Approve

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is approved.

@ucswift ucswift merged commit 332c04a into master Jan 29, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant