[Webkit-unassigned] [Bug 216349] New: onaudioprocess does not get called on Safari when external microphone connected connected

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Sep 10 00:37:39 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=216349

            Bug ID: 216349
           Summary: onaudioprocess does not get called on Safari when
                    external microphone connected connected
           Product: WebKit
           Version: Safari 13
          Hardware: All
                OS: All
            Status: NEW
          Severity: Blocker
          Priority: P2
         Component: Web Audio
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: toshish at symbl.ai

We're using new webkitAudioContext() in Safari 13.1.2 on MacBook or iOS Safari on iPhone and iPad to create AudioContext instance, and we're creating ScriptProcessorNode and attaching it to the source create using audioContext.createMediaStreamSource(). The onaudioprocess callback gets called with the audio data, but when you switch to external microphone, Bluetooth headset with microphone or AirPods, onaudioprocess does not get called at all. 

If you also connect Analyser node to the same audio source create using audioContext.createMediaStreamSource(), analyser.getByteTimeDomainData(dataArray) populates the data but onaudioprocess on the ScriptProcessorNode on the same source doesn't get called when connected to external microphone (anything other than internal MacBook Micorphone).

What has been tried:
* We confirmed that the stream being used is the only stream in the tab and getUserMedia() was only called once to get the stream. 
* We also tried using explicit deviceId of external microphone device as well as internal microphone while external microphone is connected. In both cases, onaudioprocess does not get called.

Only scenario where it works with external microphone is - if you start the stream while no external microphone is connected, and while the stream is active if you switch to external microphone by connecting physically - the audio from external microphone is used and onaudioprocess keeps continue to get called.


Code sample used to create the ScriptProcessorNode:

const AudioContext = window.AudioContext || window.webkitAudioContext;

audioContext = new AudioContext();
const audioSource = audioContext.createMediaStreamSource(stream);

  const processor = audioContext.createScriptProcessor(2048, 1, 1);
  processor.connect(audioContext.destination);
  processor.onaudioprocess = (e) => {
    // Does not get called when connected to external microphone
    // Gets called when using internal MacBook microphone
    console.log('print audio buffer', e);
  }

  audioSource.connect(processor);


The exact same behavior is also observed on iOS Safari on iPhone and iPad.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200910/854fc539/attachment.htm>


More information about the webkit-unassigned mailing list