I would like to have a video in my pdf that plays when you click on it. When the video is not playing it should show a figure. When I compile my pdf I do get a figure that I can click on, but it turns blank when I click on it, and no video plays. I don't get any errors either. This is my code:
\usepackage{media9} %this is specified somewhere at the start of the file
\includemedia[label=videofile, width=1.0\textwidth, addresource=./Videos/videofile.mp4,
flashvars={source=./Videos/videofile.mp4}]{\includegraphics[width=1.0\textwidth]
{./Figures/picture}}{VPlayer.swf}
Best Answer
Your video file seems to be corrupt/using the wrong video codec. I successfully tried your example with file
random.mp4
(h.264 codec) from the media9 package.Note, that with the current configuration, on clicking once, VPlayer.swf will be activated only. To have the video start playing after one click, you must append
&autoPlay=true
to theflashvars
option. Alternatively, you could putactivate=pageopen
to the options list of\inlcudemedia
. Then,VPlayer.swf
will be automatically activated showing the first frame of the video file and obscuring the embedded poster graphics file. The first click will start playback.Further note that one of the
width
options (\includegraphics
or\inlcudemedia
) is redundant.The
label
option is only needed if you want to refer to this media inclusion from a\PushButton
with JavaScript or a\medialink
(soon to come).