feat(client): add microphone passthrough button to controls toolbar (#620)

* feat(client): add microphone passthrough button to controls toolbar

Add mic toggle button to the bottom controls bar that enables users to
share their local microphone with the remote neko session via WebRTC.

The server already supports microphone capture (capture.microphone.enabled)
but the legacy client had no UI to trigger getUserMedia and send an audio
track to the peer connection.

Changes:
- base.ts: Add enableMicrophone/disableMicrophone methods that call
  getUserMedia and addTrack/removeTrack on the RTCPeerConnection.
  Mic is cleaned up automatically on disconnect.
- controls.vue: Add mic button (fa-microphone/fa-microphone-slash) between
  play/pause and volume controls with tooltip and error handling.
- en-us.ts: Add i18n strings for mic tooltips and error dialog.

* if the error is not io.EOF, log it. Otherwise, it's a normal closure of the track.

* tie microphone to active host and auto-disable on control loss

---------

Co-authored-by: h1n054ur <admin@haniumer.com>
Co-authored-by: Miroslav Šedivý <sedivy.miro@gmail.com>
This commit is contained in:
Hani
2026-02-17 21:02:51 +05:00
committed by GitHub
parent 902c849f22
commit bc19ab866f
4 changed files with 127 additions and 2 deletions
+6 -1
View File
@@ -1,7 +1,9 @@
package webrtc
import (
"errors"
"fmt"
"io"
"net"
"strings"
"sync"
@@ -459,7 +461,10 @@ func (manager *WebRTCManagerCtx) CreatePeer(session types.Session) (*webrtc.Sess
for {
i, _, err := track.Read(buf)
if err != nil {
logger.Warn().Err(err).Msg("failed read from remote track")
// if the error is not io.EOF, log it. Otherwise, it's a normal closure of the track.
if !errors.Is(err, io.EOF) {
logger.Warn().Err(err).Msg("failed read from remote track")
}
break
}