-
Notifications
You must be signed in to change notification settings - Fork 9.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
headless mode should be able to play audio #2999
Comments
Keep in mind that puppeteer uses Chromium, which does not necessarily play all types of media. See https://github.com/GoogleChrome/puppeteer#q-what-features-does-puppeteer-not-support. That may be at least one of your issues. |
Sorry. I did not specify that I'm using Chrome instead of Chromium. Player works when not in headless mode! |
I've just just tried puppeteer v1.7 with Chrome Canary and the problem is still there. |
@demian85 any script I can play with that reproduces the issue? |
Yes, you can try the actual |
@demian85 ok I played with it; there are a few things that might happen:
const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch({
ignoreDefaultArgs: ['--mute-audio'],
});
const page = await browser.newPage();
await page.goto('http://www.noiseaddicts.com/free-samples-mp3/?id=2544');
await page.click('span.map_play');
})(); So all in all, there's no problem with headless not playing audio. However, it might be spotify that detects automation and prevents you from doing so. Hope this helps. |
Thanks for the work @aslushnikov !! |
It seems Spotify isn't blocking Puppeteer, it's just that it throws an error:
when calling you can see that in headful mode The problem might be that chromium does not support a DRM system: #720 |
Hi, try to execute puppeteer with
xvfb deps: <yum | dnf | apt-get> install xvfb xvfb-run-safe.sh: #!/bin/bash
: "${xvfb_lockdir:=$HOME/.xvfb-locks}"
: "${xvfb_display_min:=99}"
: "${xvfb_display_max:=599}"
mkdir -p -- "$xvfb_lockdir" || exit
i=$xvfb_display_min
while (( i < xvfb_display_max )); do
if [ -f "/tmp/.X$i-lock" ]; then
(( ++i )); continue
fi
exec 5>"$xvfb_lockdir/$i" || continue
if flock -x -n 5; then
exec /usr/bin/xvfb-run --server-num="$i" "$@" || exit
fi
(( i++ ))
done puppeteer conf: this.browser = await puppeteer.launch({
headless: false,
defaultViewport: {
width: 1280,
height: 768
},
executablePath: "/usr/bin/google-chrome",
ignoreDefaultArgs: ["--mute-audio", "--hide-scrollbars"]
}); |
Is there a way to execute your code with node xvfb? |
The way is described above: |
Hi please dose the above method work on Spotify headless chrome mode? |
Let's face it, Puppeteer is not just for testing purposes. People come up with weird and useful ideas for automating stuff too.
In my case, I'm trying to build a Spotify CLI client, and Chrome is the only way to play a song, as it is encrypted media (is there another way?)
The problem is that when setting headless mode, I get the following screen. Otherwise, the song plays as expected.
Why features available in headless mode are not the same as in normal mode? Is the hard-coded option
--mute-audio
the problem here? I tried removing it manually but nothing happens, so it seems that Spotify is checking for something that is not available. Any ideas what could it be?Thanks.
The text was updated successfully, but these errors were encountered: