First of all you need your video files in MP4 format with H.264 compression. See section 1 of the media9
documentation on how to recode existing video files / how to recreate them from bitmaps. AVI format is not supported.
To start two or more videos at once, a media button can be inserted that controls them all. Looping the videos is enabled by adding loop=true
to the Flash variables:
\documentclass{article}
\usepackage{media9}
\begin{document}
\includemedia[
label=vidA,
addresource=results1.mp4,
activate=pageopen,
width=5cm, height=4cm,
flashvars={
source=results1.mp4
&loop=true
}
]{}{VPlayer.swf}
\includemedia[
label=vidB,
addresource=results2.mp4,
activate=pageopen,
width=5cm, height=4cm,
flashvars={
source=results2.mp4
&loop=true
}
]{}{VPlayer.swf}
\mediabutton[
mediacommand=vidA:playPause,
mediacommand=vidB:playPause
]{\fbox{Play/Pause}}
\end{document}
Media files to be played back are usually embedded into the PDF (although playing files from remote URLs via http and rtmp protocols is supported too).
Media9 implements playback of media files inside PDF documents using the FlashPlayer plugin in Adobe Reader. This feature is currently available on the Windows and OSX platforms.
Two prerequisites are necessary: The media file (a video in the MP4/H.264 or FLV formats) and a media player in the Flash format (e. g. VPlayer.swf
provided by Media9).
The latter is embedded by setting it as the last argument of \includemedia
, while option addresource=...
instructs LaTeX to physically embed a video file into the PDF.
Furthermore, VPlayer.swf
needs to be told what to play. Flash applications are configured via FlashVars. For this, \includemedia
provides the flashvars
option. The most important FlashVar of VPlayer.swf
is source=...
which sets the media source. More FlashVars exist, e. g. for setting the sound volume, or loop
which tells VPlayer.swf
to infinitely replay the video. Refer to the Media9 documentation for other configuration options.
It is a good idea to place media files for embedding into the directory of the document you are about to write, or into a sub-directory of it. Lets assume Ruinn.MP4
is in the subdirectory videos
. A minimal working example would read:
\documentclass{article}
\usepackage{media9}
\begin{document}
\includemedia[
width=0.4\linewidth,
height=0.3\linewidth,
activate=pageopen,
addresource=videos/Ruinn.MP4,
flashvars={source=videos/Ruinn.MP4}
]{}{VPlayer.swf}
\end{document}
Note that the paths to the video file used with the addresource
option and with the source
FlashVar must be identical. Further note, that MP4 is only a container file format for video. The video data inside the file must be encoded with the H.264 codec. Another option is the FLV file format.
Best Answer
The play button can be locally enabled or disabled or given another look with one of
playbutton=none|fancy|plain
in the options argument of\includemedia
.Currently, the play button is printed when printing to paper or file from within AR. This will change in the next version (0.44) of
media9
.