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

231
Views
Could not start audio source error on mediaDevices.getUserMedia

I am trying to make a screen recorder with electron.js

I have used desktopCapturer.getSources to get all the screens which is working fine but when I am tring to get stream using navigator.mediaDevices.getUserMedia it throws a error :

> DOMException: Error could not start audio source
const handleRecordActions = async () => {
    const { id } = activeScreen;
    try {
      // console.log("here", navigator);
      stream = await navigator.mediaDevices.getUserMedia({
        audio: {
          mandatory: {
            chromeMediaSource: "desktop",
            chromeMediaSourceId: id,
          },
        },
        video: {
          mandatory: {
            chromeMediaSource: "desktop",
            chromeMediaSourceId: id,
          },
        },
      });
      stream.stop = function () {
        stream.getAudioTracks().forEach(function (track) {
          track.stop();
        });
        stream.getVideoTracks().forEach(function (track) {
          //in case... :)
          track.stop();
        });
      };
      setStream(stream);
      handleStream(stream);

      // console.log({ stream, d: stream.getAudioTracks() });
    } catch (e) {
      console.log(e);
    }
  };

If I make audio: false then it throws different error :

> DOMException: Error starting screen capture

I am working on :

Ubuntu : 20.04
Electron : ^16.0.4

Edit :

I have confirmed that this error is occurring in linux (Ubuntu) only as the same code is working seamlessly in windows.

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!