使用phantomjs的视频元素的屏幕截图

时间:2014-05-16 19:26:31

标签: html5-video phantomjs

我正在尝试使用phantomjs拍摄带有视频元素的页面截图。目前,我将前方视频的时间设置为某个所需的秒数(即60)。然后我使用page.render(输出)。但是,创建的屏幕截图始终为黑色。任何人都可以看到问题或验证我是否可以做什么?

2 个答案:

答案 0 :(得分:1)

运行features.js示例(使用modernizr.js),您将看到

>phantomjs.exe 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

所以,是的,视频不受支持。

答案 1 :(得分:0)

类似于Cybermaxs' answer,以下是PhantomJS 2的features

Detected features (using Modernizr 2.8.3):

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