Can't use getDisplayMedia (and then start recording) in headless mode
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 1.15.0
- Platform / OS version: Ubuntu 16.04
- URLs (if applicable):
- Node.js version: v10.15.3
What steps will reproduce the problem?
Please include code that reproduces the issue.
- Run the following code, set headless to
true
orfalse
and see the difference.
const puppeteer = require('puppeteer')
;(async () => {
const url = 'https://www.google.com'
const browser = await puppeteer.launch({
headless: false,
args: [
`--window-size=1920,1080`,
'--enable-experimental-web-platform-features',
'--disable-infobars',
'--enable-usermedia-screen-capturing',
'--allow-http-screen-capture',
'--auto-select-desktop-capture-source=webclip',
'--ignore-certificate-errors',
'--unsafely-treat-insecure-origin-as-secure=' + url
]
});
const page = await browser.newPage()
await page.setViewport({
width: 1920,
height: 1080,
})
await page.goto(url)
page.evaluate(async () => {
document.title = 'webclip'
const stream = await navigator.mediaDevices.getDisplayMedia({ video: true })
const recorder = new window.MediaRecorder(stream, { mimeType: 'video/webm' })
recorder.start(10)
const chunks = []
recorder.addEventListener('dataavailable', event => {
if (event.data && event.data.size) {
chunks.push(event.data)
}
})
})
})()
What is the expected result? Maybe it should start recording (I don’t know whether this behavior is intended and I haven’t found percisely related information).
What happens instead? Throw exceptions.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:19
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Can't use getDisplayMedia (and then start recording ... - GitHub
Can't use getDisplayMedia (and then start recording) in headless mode ... Run the following code, set headless to true or false and see...
Read more >Google Chrome Headless Error "Not supported" When using ...
Google Chrome Headless Error "Not supported" When using getDisplayMedia trying to record screen from Chrome Tab in Puppeteer. Save this ...
Read more >Using getDisplayMedia for local recording with audio on Jitsi
A video call recording hack leveraging getDisplayMedia with audio source capture, getUserMedia, and mediaRecorder to record locally for ...
Read more >MediaDevices.getDisplayMedia() - Web APIs | MDN
The MediaDevices interface's getDisplayMedia() method prompts the user ... The resulting stream can then be recorded using the MediaStream ...
Read more >Record screen on a headless machine - windows 10
Using Windows API a program can create a graphical window and draw on its canvas. It doesn't need any port, HDMI, or anything...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ldenoue no. pretty much likely that it can’t. The bug I linked above is now assigned to caseq@chromium.org
Go star the issue and spread the world to show it’s important. That contributes to the Chrome team’s decisions about what to work on next.
Just in case someone might miss this, the new CRBUG is: https://bugs.chromium.org/p/chromium/issues/detail?id=1268342
This should be fixed because having to run the full chrome instance because of
getDisplayMedia
isn’t the kind of behaviour I would expect from the headless mode 🤔