testSpeaker API only works once and then becomes silent


Using the testSpeaker api, I have encountered a few problems. First, it works fine until you try stopping and starting again (it becomes silent). Secondly, if you call destroy(), it throws an error when you create a new testSpeaker. I based some of my code off of the react demo app, and yes, the react demo app causes the same errors too.

Browser Console Error

Various console errors I’ve encountered:

InvalidStateError - Failed to execute 'stop' on 'AudioScheduledSourceNode': cannot call stop without calling start first.
InvalidAccessError - Failed to execute 'connect' on 'AudioNode': cannot connect to an AudioNode belonging to a different audio context.

Which Web Video SDK version?


Video SDK Code Snippets

// Play default test speaker sound on selected speaker
const onTestSpeakerClick = () => {
  speakerTesterRef.current = localAudio.testSpeaker({
    speakerId: previewSpeakerSelectionId,
    onAnalyseFrequency: (value: number) => {
      setOutputLevel(Math.min(100, value))

// Stop test speaker after 3 seconds
useEffect(() => {
  if (!isPlayingAudio) {
  const interval = setInterval(() => {
    setSecondsLeft((prev) => {
      const newSeconds = prev - 1
      if (newSeconds <= 0) {
      return newSeconds
  }, 1000)
}, [isPlayingAudio])

To Reproduce(If applicable)
Steps to reproduce the behavior:

  1. Start up react demo app
  2. Go to preview
  3. Click test speaker, it works
  4. Stop speaker and test again, it is silent
  5. Switch speakers and test again, still silent



Troubleshooting Routes

Tested on the react demo app and encountered the same issues. Followed the sample code with no luck. The errors are originating from the vSDK library as far as I can tell. No permission issues at all.

Device (please complete the following information):

  • Device: Macbook Pro M1
  • OS: macOS 12.6
  • Browser: Chrome
  • Browser Version 106.0.5249.119 (Official Build) (arm64)

Additional context

testMicrophone works like a charm. It is only testSpeaker that is giving me issues.

1 Like

Hey @brendonion

Thanks for your feedback.

It is indeed an issue, we will fix it in the next release.



This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.