Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

90
Views
Browser Live Audio Remove Buffering Delay

I am trying to implement a function where one client can record audio (MediaRecorder) and send it to a server. The server then creates a link where a different client can download the live stream.

And this all working fine, except for one detail: The stream is delayed by around 4 seconds. I think this has to do with the buffering of the audioNode.

Here is what I think is happening: The audioNode waits until 4 seconds of sound is available. Since the sound is created live, it has to wait 4 seconds for the data to be available.

So my question is: how can I disable or reduce the buffersize of an audioNode?

I am using electron as my "browser" or however it is called.

The http request (download stream) looks like this:

enter image description here

In the javascript code I simply attach the link to my sourceNode:

    audioNode = document.getElementById("callAudio")
    audioNode.volume = 1.0
    const audioSourceNode = document.getElementById("callAudioSource")
    const audioContext = new window.AudioContext()
    const audioTrack = audioContext.createMediaElementSource(audioNode)
    const audioGain = audioContext.createGain()
    const audioDestination = audioContext.createMediaStreamDestination();
    const audioTrack.connect(audioGain).connect(audioDestination)

    audioSourceNode.setAttribute("src", "http://localhost:12347")
    audioNode.load()
    audioNode.play().then(() => {
        console.debug("started playing after:", currentTime)
        playing = true
    })

The audioNode itself looks like this:

<audio controls id="callAudio" class="audioControls" crossorigin="anonymous" preload="none">
        <source src="" id="callAudioSource"></src>
</audio>

The debug tells me that it took roughly 4.2 seconds to start playing.

When I look at this stream from the perspective of my server, then I see that I have delay of less than 10ms. So, this cannot be due to the server producing a delay.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!