最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

windows - Puppeteer MediaRecorder API error: NotReadableError when capturing display media on Ubuntu Linux - Stack Overflow

programmeradmin3浏览0评论

I'm encountering an issue with Puppeteer and the MediaRecorder API when trying to capture display media on Ubuntu Linux. On Windows it works well it captures screen and video chunks are generated which are playable also but on Ubuntu linux this below mentioned error is occuring. Here's the relevant part of my code:

const stream = await navigator.mediaDevices.getDisplayMedia({
  video: {
    displaySurface: "monitor",
    width: 1368,
    height: 768,
  },
  // audio: { deviceId: "default" },
});

const mediaRecorder = new MediaRecorder(stream);

mediaRecorder.ondataavailable = (event) => {
  // ... processing chunks ...
};

I'm encountering an issue with Puppeteer and the MediaRecorder API when trying to capture display media on Ubuntu Linux. On Windows it works well it captures screen and video chunks are generated which are playable also but on Ubuntu linux this below mentioned error is occuring. Here's the relevant part of my code:

const stream = await navigator.mediaDevices.getDisplayMedia({
  video: {
    displaySurface: "monitor",
    width: 1368,
    height: 768,
  },
  // audio: { deviceId: "default" },
});

const mediaRecorder = new MediaRecorder(stream);

mediaRecorder.ondataavailable = (event) => {
  // ... processing chunks ...
};

When I run this code on Ubuntu Linux, I get the error:

Error getting display media: NotReadableError

Additional Context

  • The Puppeteer browser is launched with following parameters and in non-headless mode
--use-fake-ui-for-media-stream,
--auto-select-desktop-capture-source=Entire screen,
--enable-features=AudioServiceOutOfProcess,
--no-sandbox,
--disable-setuid-sandbox,
--disable-features=IsolateOrigins,site-per-process
  • This issue does not occur on Windows OS. Everything works fine there.

What I've Tried

  • Using --use-fake-ui-for-media-stream flag

  • Using --auto-select-desktop-capture-source=Entire screen flag,

  • Enabling AudioServiceOutOfProcess

  • Disabling sandbox features

Expected Behavior

I expect to be able to capture the entire screen using the MediaRecorder API on Ubuntu Linux.

Actual Behavior

The getDisplayMedia() call fails with a NotReadableError on Ubuntu Linux.

Share Improve this question edited Jan 30 at 10:35 Shubham More asked Jan 30 at 10:30 Shubham MoreShubham More 12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0
const stream = await navigator.mediaDevices.getDisplayMedia({
  video: {
    displaySurface: "cell",
    width: 1368,
    height: 768,
  },
  // audio: { deviceId: "default" },
});

const mediaRecorder = new MediaRecorder(stream);

mediaRecorder.ondataavailable = (event) => {
  // ... processing chunks ...
};

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论