I am trying to take a screenshot of page with a video element using phantomjs. Currently, i set the time of the video ahead to some desired seconds (i.e. 60). Then I use page.render(output). However, the screenshot created is always black. Can anyone see the problem or verify if what Im trying to do is possible?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Running the features.js example (using modernizr.js), you will see
>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
So, yes, video is not supported.
回答2:
Analogous to Cybermaxs' answer, here are the features of PhantomJS 2:
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