11

I need to automate screenshots of HTML 5 video player pages and their thumbnails, but after looking at some of the more popular headless browsers like PhantomJS they don't support HTML 5 video.

>phantomjs examples\features.js
Detected features (using Modernizr 2.0.6):

Supported:
  touch
  generatedcontent
  fontface
  flexbox
  canvas
  canvastext
  postmessage
  websqldatabase
  hashchange
  history
  draganddrop
  websockets
  rgba
  hsla
  multiplebgs
  backgroundsize
  borderimage
  borderradius
  boxshadow
  textshadow
  opacity
  cssanimations
  csscolumns
  cssgradients
  cssreflections
  csstransforms
  csstransitions
  localstorage
  sessionstorage
  webworkers
  applicationcache
  svg
  inlinesvg
  smil
  svgclippaths

Not supported:
  csstransforms3d
  webgl
  geolocation
  indexeddb
  video
  audio

Note that HTML 5 video is not supported above, what lightweight headless browser DOES support HTML 5 video?

user3813948
  • 363
  • 3
  • 13

2 Answers2

2

There is a solution but it is not ightweight.(It is pretty fast though) Now you can run Firefox with headless option. Here some code how to do it with Selenium.

options = new FirefoxOptions();
options.addArguments("--headless"); // This will make Firefox to run in headless mode.
System.setProperty("webdriver.gecko.driver", "lib/firefox/geckodriver.exe");
        FirefoxProfile profile = new FirefoxProfile();
        FirefoxBinary binary = new FirefoxBinary(new File("lib/firefox/firefox.exe"));
        options.setBinary(binary);
        options.setProfile(profile);
        driver = new FirefoxDriver(options);

or you can Build PanthomJS to support HTML5. Follow this, https://github.com/ariya/phantomjs/issues/10839#issuecomment-331457673

Lalith J.
  • 1,391
  • 4
  • 16
  • 27
1

Based on the documentation, SlimerJS can play HTML5 video and audio (and provide screenshots of them):

Since SlimerJS is executed on top of Firefox, it supports all the HTML5 standards recently implemented in Firefox, including things like audio, video, WebGL etc.

The web page rendering in SlimerJS is strictly identical to the rendering in Firefox.

You can go on caniuse.com to see the list of HTML5 features supported by Firefox and you can use in web pages loaded by SlimerJS.

Flash is said to be supported, too, but the Flash content is not available in screenshots:

SlimerJS is able to load Flash content if the Flash plugin is installed (though the plugin's rendering cannot be seen when taking screenshots).

sompylasar
  • 924
  • 11
  • 15
  • From the documentation: `it is not (yet) natively headless. However, it can be headless with the use of xvfb under Linux (but not on MacOS).` – Andrei Volgin Aug 08 '17 at 14:30