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 badges1 Answer
Reset to default 0const 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 ...
};