Play mp4 in chromium with puppeteer, windows
Asked Answered
S

1

6

I'm developing with puppeteer in node on windows 10. The problem is that when I open a site playing an mp4 file the browser says me that it is not supported.

I found this package chromium-codecs-ffmpeg-nonfree but it is for Linux!

How can I play .mp4 in Chromium with puppeteer on windows?

Skintight answered 26/12, 2017 at 9:58 Comment(4)
So, why would you want to play mp4 file in a headless browser again? :/Mailbox
@Md.AbuTaher Automated screenshots for testing, perhaps! That's why I'm here ._.Prepare
If it's possible to use OGGs , those work in chromium.Automat
You can play Webm format in Chromium with puppetter ( VP9/VP8, see chromium.org/audio-video )Coastal
V
13

The Puppeteer Documentation has an answer for this:

Q: What features does Puppeteer not support?

You may find that Puppeteer does not behave as expected when controlling pages that incorporate audio and video. (For example, video playback/screenshots is likely to fail.) There are two reasons for this:

  • Puppeteer is bundled with Chromium--not Chrome--and so by default, it inherits all of Chromium's media-related limitations. This means that Puppeteer does not support licensed formats such as AAC or H.264. (However, it is possible to force Puppeteer to use a separately-installed version Chrome instead of Chromium via the executablePath option to puppeteer.launch. You should only use this configuration if you need an official release of Chrome that supports these media formats.)
  • Since Puppeteer (in all configurations) controls a desktop version of Chromium/Chrome, features that are only supported by the mobile version of Chrome are not supported. This means that Puppeteer does not support HTTP Live Streaming (HLS).

Therefore, in order to screenshot video playback in Puppeteer, you will need to set the executablePath as a separately installed Chrome executable:

const browser = await puppeteer.launch({
  executablePath: '/path/to/Chrome',
});
Veljkov answered 17/7, 2018 at 1:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.