question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't use getDisplayMedia (and then start recording) in headless mode

See original GitHub issue

Steps 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.

  1. Run the following code, set headless to true or false 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:open
  • Created 4 years ago
  • Reactions:19
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
crisdosyagocommented, May 16, 2021

@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.

1reaction
thegiantbeastcommented, Feb 26, 2022

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 🤔

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found