cancel
Showing results for 
Search instead for 
Did you mean: 
Replies are disabled for this topic. Start a new one or visit our Help Center.

Nest Camera WebRTC Stream - No Audio Despite Valid Setup (Amplitude 0.000)

joelzyla
Community Member

Hi everyone, I’m struggling to get audio working with my Nest camera’s WebRTC stream in a custom JavaScript app using the Google Smart Device Management (SDM) API. Video streams fine, but audio stays silent with an amplitude of 0.000, and enabling two-way audio through renegotiation fails due to an SDP error. I’d really appreciate any insights or suggestions from the community. My setup involves a Google Nest Camera (Indoor, named "Home camera" in Google Home), a custom JavaScript app with a Node.js server (server.js) and HTML frontend (index.html) running locally at http://localhost:3000, aiming to stream audio from the camera and enable two-way audio, tested as of March 02, 2025. The video streams successfully, showing a live feed via
<video autoplay>
, and the WebRTC connection establishes with recvonly for audio and video in the initial SDP offer, while the camera’s answer SDP offers sendrecv for audio with the Opus codec, suggesting two-way capability.


However, I’m facing two main issues. First, there’s no audio from the camera; the audio track unmutes (muted=false, readyState=live), but the audio buffer remains all zeros (Raw audio data sample: [0.0000, ...], Current amplitude: 0.000), and no sound plays through my laptop speakers despite using
<video>
and AudioContext processing, even though audio works fine in the Nest app, confirming the mic hardware is functional. Second, enabling two-way audio fails; when I try renegotiating to sendrecv to send mic input, I get an error: "Invalid offer SDP: Offer must contain each of audio, video and application m lines in that order," because the renegotiation SDP incorrectly adds a second m=audio line, breaking the required structure.


Here’s a simplified version of my code from index.html:
<script>
let pc, localStream, audioTransceiver; async function generateWebRtcStream() { pc = new RTCPeerConnection({ iceServers: [{ urls: 'stun:stun.l.google.com:19302' }] }); localStream = await navigator.mediaDevices.getUserMedia({ audio: true }); localStream.getAudioTracks()[0].enabled = false; audioTransceiver = pc.addTransceiver('audio', { direction: 'recvonly' }); pc.addTransceiver('video', { direction: 'recvonly' }); pc.createDataChannel('data'); } async function startTalking() { const audioTrack = localStream.getAudioTracks()[0]; audioTrack.enabled = true; audioTransceiver.direction = 'sendrecv'; audioTransceiver.sender.replaceTrack(audioTrack); const offer = await pc.createOffer(); await pc.setLocalDescription(offer); }
</script>
. My latest logs (abbreviated) show: [8:28:31 PM] Stream connected, listening for audio... [8:28:31 PM] Track received: audio (id: 18d85554-..., enabled: true, muted: false, readyState: live) [8:28:35 PM] Raw audio data sample: [0.0000, 0.0000, ...] [8:28:40 PM] Starting two-way audio... [8:28:40 PM] Renegotiation offer SDP: (includes two m=audio lines) [8:28:40 PM] Error: Invalid offer SDP: Offer must contain each of audio, video and application m lines.... The initial SDP offer is m=audio ... a=recvonly m=video ... a=recvonly m=application ..., and the answer SDP is m=audio ... a=sendrecv (Opus/48000/2) m=video ... a=sendrecv m=application ....


I’ve tried verifying the mic is enabled in the Google Home app, ensuring
<video autoplay>
and AudioContext are active, adjusting renegotiation to use audioTransceiver.direction = 'sendrecv' and replaceTrack (still adds an extra m=audio), and comparing with the Nest app where audio works. My questions are: Why is the audio buffer silent despite sendrecv in the answer SDP, and is there a setting or API trigger I’m missing to enable the mic? How can I renegotiate to sendrecv without breaking the SDP structure, and does GenerateWebRtcStream support this or is there another command? Are there any known quirks with Nest WebRTC audio in custom apps? Additional info: my logs show no “Too Many Requests” (429) errors, and I’m willing to enable debug logging or test alternatives if suggested. Thanks in advance for any help—this community has been a lifesaver for other projects! Full logs are available if needed.

0 REPLIES 0