# Using \visible with media9 embedded videos

I am currently switching to media9 to include video in beamer. I bump into an issue with the visibility option. I want to put two videos on a frame alongside with the list. The first one starts when the page opens along with some items while the second video to show and start when I highlight the second part of the items. Here is my code in hope for a solution:

\begin{frame}{Frame example}
\begin{columns}
\begin{column}{5.5cm}
\begin{itemize}
\item Blabla
\item Blabla
\item<2-> Bloblo
\item<2-> Bloblo
\end{itemize}
\end{column}
\begin{column}{4.5cm}
\begin{figure}{
\includemedia[
width=\columnwidth,height=2.8125cm,
activate=pageopen,
flashvars={
source=blabla_video.mp4
&loop=true
&autoPlay=true
&scaleMode=letterbox
}
]{}{VPlayer.swf}
\caption{Blabla}}
\end{figure}
\visible<2->{
\begin{figure}{
\includemedia[
width=\columnwidth,height=2.8125cm,
activate=pagevisible,
flashvars={
source=bloblo_video.mp4
&autoPlay=true
&loop=true
&scaleMode=letterbox
},
transparent
]{}{VPlayer.swf}
\caption{Bloblo}}
\end{figure}}
\end{column}
\end{columns}
\end{frame}


Also I notice that Adobe Reader is considerably much slower reading video with media9 than with movie15. Is it just related to my configuration or there is something I am missing like a codec of some sort? Is it related to the fact that a warning concerning a signature field detected appears?

I am running MikTex 2.9, compiling with pdflatex and opening the pdf with Adobe Reader 11.0.3

I hope you guys have an answer...

media9 is not well suited for use with Beamer overlays. The latters produce multiple PDF pages per frame and possibly re-insert the video.

In particular, \visible reserves space on those overlays where its content is not displayed. For getting the dimension of the required white-space, the argument of \visible is typeset into some box for measuring. Media files are displayed within so-called PDF annotations, which do not belong to the page content but live in a separate layer above the page. They are inevitably added to the page resources and hence will be shown even in overlays where they are supposed to be invisible.

There is one trick to make it work though. Within the \visible argument, we place a \rule box with the same dimensions as the video and let this one be used in overlays where the video should be hidden:

\documentclass{beamer}
\usepackage{media9}
\begin{document}

\begin{frame}{Frame example}
\begin{columns}
\begin{column}{5.5cm}
\begin{itemize}
\item Blabla
\item Blabla
\item<2-> Bloblo
\item<2-> Bloblo
\end{itemize}
\end{column}
\begin{column}{4.5cm}
\begin{figure}
\includemedia[
width=\columnwidth,height=2.8125cm,
activate=pageopen,
flashvars={
source=blabla.mp4
&loop=true
&autoPlay=true
&scaleMode=letterbox
}
]{}{VPlayer.swf}
\caption{Blabla}
\end{figure}
\visible<2->{
\begin{figure}
\only<1>{\rule{\columnwidth}{2.8125cm}}%
\only<2->{%
\includemedia[
width=\columnwidth,height=2.8125cm,
activate=pagevisible,
flashvars={
source=bloblo.mp4
&autoPlay=true
&loop=true
&scaleMode=letterbox
}
]{}{VPlayer.swf}%
}
\caption{Bloblo}
\end{figure}}
\end{column}
\end{columns}
\end{frame}

\end{document}


Note that, when passing to the second overlay, the first video is again extracted from the PDF, unpacked, loaded and started, which may lead to some latency. This cannot be avoided. With movie15 it was possible to 'pull' the playing video from one page to the next using JavaScript. This was quite hackish, but worked somehow. With media9 this possibility has gone.

• Thanks! It works even if I will have to change my slide as I want the first video to continue playing... Any hint about the latency I observed when it comes to load and play the video? – TazgerO May 28 '13 at 8:45
• @TazgerO: Yes but be aware that it starts from zero, not where you have left it on the first overlay. – AlexG May 28 '13 at 8:52
• I will keep that in mind but I was thinking about just avoiding the overlay – TazgerO May 28 '13 at 8:56
• @TazgerO: As I said before, media files and VPlayer.swf are compressed objects within the PDF. They must be extracted, decompressed, loaded into FlashPlayer plugin and initialized therein before being played back. This takes some time – AlexG May 28 '13 at 8:57
• I just happen to use your trick... Thank again... – TazgerO May 28 '13 at 9:07