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
--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
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.
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 ...
};