Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

319
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda