-
Notifications
You must be signed in to change notification settings - Fork 404
Add audio support to WebRTC video player with mute/unmute controls #4074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: bgoncal <[email protected]>
Co-authored-by: bgoncal <[email protected]>
Co-authored-by: bgoncal <[email protected]>
Co-authored-by: bgoncal <[email protected]>
Co-authored-by: bgoncal <[email protected]>
Refactored WebRTCVideoPlayerViewControls to group top buttons and improve mute button styling, including conditional glass effect for iOS 26+. Updated ModalCloseButton to use glass effect when available. Simplified AVAudioSession category/mode usage in WebRTCClient. Shortened the experimental disclaimer string.
| @@ -1,4 +1,4 @@ | |||
| "WebRTC_player.experimental.disclaimer" = "Note: Native WebRTC video player is currently an experimental feature, audio may not work and microphone permission and usage may be requested even though not in use. Please use the web player interface for advanced options and reliable playback."; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change will be reverted by Lokalise. But at this moment it's fine, the current copy is better for the moment in time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds audio playback support to the native WebRTC video player with mute/unmute controls. The previous implementation had audio disabled to avoid microphone permission requests. The implementation properly configures the audio session for receive-only playback, extracts the remote audio track after SDP negotiation, and provides UI controls for muting/unmuting.
Key changes:
- Audio session configured for playback-only mode (
.playbackcategory with.spokenAudiomode) to receive audio without requiring microphone access - Remote audio track management added with proper extraction from peer connection transceivers after remote SDP is set
- Mute/unmute button added to video player controls with iOS 26.0+ glass effect styling
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Sources/App/WebView/WebRTC/WebRTCClient.swift | Adds audio session configuration, remote audio track management, and mute/unmute methods |
| Sources/App/WebView/WebRTC/WebRTCViewPlayerViewModel.swift | Adds isMuted state and toggleMute() method for audio control |
| Sources/App/WebView/WebRTC/WebRTCVideoPlayerViewControls.swift | Adds mute/unmute button with speaker icons to player controls |
| Sources/App/WebView/WebRTC/WebRTCVideoPlayerView.swift | Integrates mute state and toggle action into controls view |
| Sources/Shared/DesignSystem/Components/ModalCloseButton.swift | Adds iOS 26.0+ glass effect styling with conditional padding |
| Sources/Shared/Resources/Swiftgen/Strings.swift | Updates experimental disclaimer text to remove microphone-related warnings |
| Sources/App/Resources/en.lproj/Localizable.strings | Updates experimental disclaimer localization string |
Co-authored-by: Copilot <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4074 +/- ##
=======================================
Coverage ? 45.75%
=======================================
Files ? 242
Lines ? 13628
Branches ? 0
=======================================
Hits ? 6236
Misses ? 7392
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Enables audio playback in the native WebRTC video player and adds mute/unmute controls. The previous implementation had audio disabled via
useManualAudio = trueto avoid microphone permission requests.Key changes:
AVAudioSession.Category.playbackfor receive-only audio (no microphone access required)speaker.wave.fill/speaker.slash.fill)Technical details:
The implementation removes microphone-related warnings from the experimental disclaimer.
Screenshots
N/A - Audio feature, no visual changes beyond the mute button icon which follows existing control patterns.
Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#
Any other notes
Audio mode uses
.spokenAudiofor optimal voice/camera audio playback. The mute button follows the same auto-hide behavior as other player controls (3-second timeout).Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.