Puppeteer Media Capture Issue: NotReadableError on Ubuntu with MediaRecorder

We get a NotReadableError when capturing screen media with Puppeteer on Ubuntu, though it works fine on Windows. Below is a sample code:

const displayStream = await navigator.mediaDevices.getDisplayMedia({
  video: { width: 1280, height: 720 }
});

const recorderInstance = new MediaRecorder(displayStream);
recorderInstance.ondataavailable = (event) => {
  console.log('Chunk received:', event.data);
};

The NotReadableError in Ubuntu might stem from environmental and permission differences compared to Windows. In similar instances, I found that enabling or modifying certain browser flags helped mitigate this issue. For example, running Chromium with --no-sandbox sometimes allows media capture to function as expected. Additionally, verifying that all required dependencies, like the latest versions of gstreamer, are installed can make a difference. Lastly, it is worth testing on both stable and beta versions of the browser, as improvements and patches can resolve these media-API related errors.

hey, i’ve seen similar issues on ubuntu when using puppeteer. try checking user permisions and maybe adjusting chromium flags. in my case, updating drivers and experimenting with different browser versions helped a bit. hopefully this gives u some clues to work with

Based on my experience with similar issues on Ubuntu, the NotReadableError appears to be linked to how the system manages media resources and permissions rather than just a Puppeteer bug. I encountered similar difficulties and eventually had to tweak my system configuration. I ensured that all necessary permissions were properly granted—not only in the browser but also at the OS level. Additionally, running in a full desktop session rather than a headless mode provided more consistent results. I also experimented with updated graphics drivers and even different Chrome versions to see if that would ease resource conflicts. It may also help to verify that no other process is interfering with screen capture, as this has been a common cause for me.