Skip to content

Add two-way audio to the WebRTC camera player#4994

Draft
bgoncal wants to merge 2 commits into
mainfrom
2wayaudio
Draft

Add two-way audio to the WebRTC camera player#4994
bgoncal wants to merge 2 commits into
mainfrom
2wayaudio

Conversation

@bgoncal

@bgoncal bgoncal commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

Adds two-way audio to the in-app WebRTC camera player. A mic toggle appears in the player when the camera reports the TWO_WAY_AUDIO feature, enabling it adds a local microphone track.

Depends on backend support from home-assistant/core#148282.

Screenshots

ha.mp4

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

Copilot AI review requested due to automatic review settings July 8, 2026 21:13
@bgoncal bgoncal changed the title Add two-way audio (talkback) to the WebRTC camera player Add two-way audio to the WebRTC camera player Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

⚠️ Unused L10n strings detected

Found 5 unused localization strings in the codebase.

Click to see details
Parsing Strings.swift...
Found 2159 L10n strings

Reading all Swift source code...
Read 7380627 characters of Swift code

Checking for unused strings...
Checked 100/2159 strings...
Checked 200/2159 strings...
Checked 300/2159 strings...
Checked 400/2159 strings...
Checked 500/2159 strings...
Checked 600/2159 strings...
Checked 700/2159 strings...
Checked 800/2159 strings...
Checked 900/2159 strings...
Checked 1000/2159 strings...
Checked 1100/2159 strings...
Checked 1200/2159 strings...
Checked 1300/2159 strings...
Checked 1400/2159 strings...
Checked 1500/2159 strings...
Checked 1600/2159 strings...
Checked 1700/2159 strings...
Checked 1800/2159 strings...
Checked 1900/2159 strings...
Checked 2000/2159 strings...
Checked 2100/2159 strings...

================================================================================
UNUSED STRINGS REPORT
================================================================================

Found 5 unused strings:


WATCH:
  - L10n.Watch.Complications.Builder.previewFooter
    Key: watch.complications.builder.preview_footer
    Line: 5837
  - L10n.Watch.Complications.Builder.sourceCustom
    Key: watch.complications.builder.source_custom
    Line: 5867
  - L10n.Watch.Complications.Builder.templateColor
    Key: watch.complications.builder.template_color
    Line: 5879
  - L10n.Watch.Complications.Builder.textTemplate
    Key: watch.complications.builder.text_template
    Line: 5897

ROOT:
  - L10n.debugSectionLabel
    Key: debug_section_label
    Line: 26

================================================================================
Total unused: 5
================================================================================

================================================================================
Copy-paste these keys into the "Lokalise: Delete Keys" workflow (keys input):
================================================================================
debug_section_label,watch.complications.builder.preview_footer,watch.complications.builder.source_custom,watch.complications.builder.template_color,watch.complications.builder.text_template

To remove them, run the
Lokalise: Delete Keys
workflow — it deletes the keys from Lokalise and opens a PR removing them from
Localizable.strings and regenerating Strings.swift. Copy-paste these keys into the keys input:

debug_section_label,watch.complications.builder.preview_footer,watch.complications.builder.source_custom,watch.complications.builder.template_color,watch.complications.builder.text_template

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds two-way audio (“talkback”) support to the in-app WebRTC camera player by introducing a microphone toggle (when supported by the camera entity) and renegotiating the WebRTC session using camera/webrtc/re_offer.

Changes:

  • Adds localized strings and SwiftGen accessors for talkback UI labels and microphone-permission messaging.
  • Extends the WebRTC player/view model to detect talkback support, request microphone permission, and trigger WebRTC re-offer renegotiation.
  • Updates WebRTCClient to support an optional local microphone track and to preserve mute state when remote audio tracks change.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Sources/Shared/Resources/Swiftgen/Strings.swift Adds SwiftGen accessors for new talkback localization keys.
Sources/App/Resources/en.lproj/Localizable.strings Adds English strings for talkback labels and microphone-denied messaging.
Sources/App/Cameras/CameraPlayer/WebRTC/WebRTCViewPlayerViewModel.swift Implements talkback state, mic permission request, and re-offer signaling handling.
Sources/App/Cameras/CameraPlayer/WebRTC/WebRTCVideoPlayerView.swift Adds mic toggle to the player toolbar (shown only when talkback is supported).
Sources/App/Cameras/CameraPlayer/WebRTC/WebRTCClient.swift Adds optional microphone-track support and separates playback vs recording peer-connection factories.

Comment thread Sources/App/Cameras/CameraPlayer/WebRTC/WebRTCViewPlayerViewModel.swift Outdated
Comment thread Sources/App/Cameras/CameraPlayer/WebRTC/WebRTCClient.swift
@bgoncal
bgoncal marked this pull request as draft July 8, 2026 21:34
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@912126e). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4994   +/-   ##
=======================================
  Coverage        ?   52.01%           
=======================================
  Files           ?      299           
  Lines           ?    19656           
  Branches        ?        0           
=======================================
  Hits            ?    10225           
  Misses          ?     9431           
  Partials        ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bgoncal
bgoncal changed the base branch from main to camera-player-enhancements July 9, 2026 09:50
Base automatically changed from camera-player-enhancements to main July 9, 2026 10:34
@bgoncal
bgoncal changed the base branch from main to camera-player-ui-improvements July 17, 2026 13:11
bgoncal added a commit that referenced this pull request Jul 17, 2026
## Summary
Camera player UI improvements, independent of two-way audio:
- Extracts the WebRTC player controls into a dedicated
`WebRTCVideoPlayerControlsView`.
- Adds `WebRTCVideoPlayerViewControllerWrapper` (a
`UIViewControllerRepresentable` that drives the player view controller
from SwiftUI via an `isVideoPlaying` binding).
- Reworks the `WebRTCVideoPlayerView` and `CameraPlayerView` layout.

The talkback control is present but stays hidden (gated on
`isTalkbackSupported`, which is `false` on `main`), so this PR is purely
UI and adds no two-way-audio behavior.

Base for the stacked two-way-audio PR #4994.

## Screenshots

## Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#

## Any other notes
Base automatically changed from camera-player-ui-improvements to main July 17, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants