question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to construct 'AudioContext': The number of hardware contexts provided (6) is greater than or equal to the maximum bound (6)

See original GitHub issue

We use RecordRTC to record the window in a Chrome extension. The recording works fine except when we try to record the same window more continuously, it throws an error

background.js:18632 DOMException: Failed to construct 'AudioContext': The number of hardware contexts provided (6) is greater than or equal to the maximum bound (6).
    at getMixedAudioStream (chrome-extension://lfgkmcnkcgpggkkdcblgecnbinfoeipb/scripts/background.js:91194:47)
    at MultiStreamsMixer.getMixedStream (chrome-extension://lfgkmcnkcgpggkkdcblgecnbinfoeipb/scripts/background.js:91150:32)
    at MultiStreamRecorder.record (chrome-extension://lfgkmcnkcgpggkkdcblgecnbinfoeipb/scripts/background.js:91427:55)
    at initRecorder (chrome-extension://lfgkmcnkcgpggkkdcblgecnbinfoeipb/scripts/background.js:86221:23)
    at Object.startRecording (chrome-extension://lfgkmcnkcgpggkkdcblgecnbinfoeipb/scripts/background.js:86201:9)
    at RecordingManager._callee3$ (chrome-extension://lfgkmcnkcgpggkkdcblgecnbinfoeipb/scripts/background.js:85681:32)
    at tryCatch (chrome-extension://lfgkmcnkcgpggkkdcblgecnbinfoeipb/scripts/background.js:39004:40)
    at Generator.invoke [as _invoke] (chrome-extension://lfgkmcnkcgpggkkdcblgecnbinfoeipb/scripts/background.js:39238:22)
    at Generator.prototype.(anonymous function) [as next] (chrome-extension://lfgkmcnkcgpggkkdcblgecnbinfoeipb/scripts/background.js:39056:21)
    at step (chrome-extension://lfgkmcnkcgpggkkdcblgecnbinfoeipb/scripts/background.js:5405:30)

Error throws from

this.$initializeRecordRtc();
this.state.rtc.startRecording(); // this line

$initializeRecordRtc() is something like below

  $initializeRecordRtc() {
    const config = {
      mimeType: 'video/webm',
      disableLogs: false,
      frameInterval: this.screenInfo.frameInterval,
      canvas: {
        width: this.screenInfo.width,
        height: this.screenInfo.height,
      },
      video: {
        width: this.screenInfo.width,
        height: this.screenInfo.height,
      },
      bufferSize: 16384,
      leftChannel: false,
    };
    if (this.state.rtc) {
      this.$stopAndClearRecorder();
    }
    this.state.rtc = RecordRTC([this.state.tabStream, this.state.audioStream], config);
  }

My code which stops the recording is something like this

$stopAndClearRecorder() {
    if (!this.state) {
      return;
    }
    try {
      if (this.state.rtc) {
        const clear = () => {
          try {
            this.state.rtc.clearRecordedData();
            this.state.rtc.destroy();
          } catch (e) { this.background.error(e); /* Ignored */ }
          this.$cleanStreams();
        };
        if (this.state.rtc.getState() === 'recording') {
          this.state.rtc.stopRecording(clear);
        }
        clear();
      }
    } catch (e) {
      this.background.log('Could not stop recording', e);
    }
  }

Thanks in advance !

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
lmmProjectcommented, Jan 22, 2019

destroy useless

1reaction
osukonocommented, Feb 16, 2018

You should have only one AudioContext in the page.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to construct 'AudioContext': number of hardware ...
I started calling close() on the audio context instance created in my React component when component was getting unmounted and that resolved the ......
Read more >
AudioContext Error when having more than 6 storyline in one ...
The number of hardware contexts provided (6) is greater than or equal to the maximum bound (6).When having more than 6 storyline in...
Read more >
308784 - AudioContext not going out of scope. - chromium
Chrome Version : 32.0.1674.0 (Developer Build 229185) ... error says "The number of hardware contexts provided (6) is greater than or equal ......
Read more >
Close AudioContext when timeline is complete - Audio & Video
... Failed to construct 'AudioContext': The number of hardware contexts provided (6) is greater than or equal to the maximum bound…
Read more >
LayoutTests/webaudio/audiocontext-max-contexts-expected.txt ...
Check that the AudioContext constructor throws when the limit on hardware ... contexts provided (6) is greater than or equal to the maximum...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found