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

320
Views
Chrome extension - Detect audio playing in Javascript

im currently working on a chrome extension that need to detect if an audio is playing in the browser. I've found this post with a lot of solutions : Detect if audio is playing in browser Javascript

Complete JSFiddle : https://jsfiddle.net/Thornton_Fernbacher/mg3uv54j/73/

startBtn.onclick = function() {
  startBtn.onclick = null;

  navigator.mediaDevices.getDisplayMedia({
      video: true,
      audio: true
    })
    .then(stream => {
      if (stream.getAudioTracks().length > 0) {
        var source = audioCtx.createMediaStreamSource(stream);
        source.connect(analyser);

        document.body.classList.add('ready');
      } else {
        console.log('Failed to get audiostream. Audio not shared or browser not supported')
      }


    }).catch(err => console.log("Unable to open capture: ", err));
    audioCtx.resume();
}

function checkAudio() {
  check.classList.toggle('playing', window.isAudioPlaying());
  window.requestAnimationFrame(checkAudio);
}

checkAudio();

I tried first a JSFiddle who was working kind of perfectly. But, once i've tried to integer inside my extension, it doest work as expected. First, the start button doesnt open any alert to ask authorization and so the next code is impossible to execute. So i searched for the permissions of Chrome extension but i found nothing that cancel alerts.

So im looking to someone who knows a solution for this chrome extension that can help me. Have a good day.

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!