[Tex/LaTex] Beamer: Autostart video (mp4) on change to slide in external player

beamerlinuxvideo

I'm new to beamer and use it on linux with just evince and no Acrobat software.
I'm preparing a speech with beamer and want to include a Video.
At the moment I use the multimedia package of beamer in a try to achieve this:

\documentclass{beamer}
\usetheme{Warsaw}

\usepackage{multimedia}


\begin{document}

\begin{frame}{First frame}
\end{frame}


\begin{frame}{Second Frame}
\movie[externalviewer,autostart]{A movie}{my_movie.mp4}
\end{frame}

\end{document}

And I can click the link and the video starts as expected.
Unfortunately I don't know whether I just have a presenter for the presentation or if I will have a mouse, so I would like the video to automatically start when the frame is shown.
This should be possible with the used command, but it doesn't work – the "autostart" parameter doesn't do anything.
Is there a way, how I can achieve this?
Thanks,
mathse

Best Answer

In PDF, this can be implemented using a `Launch' action, triggered by the page-open event.

Works in Acrobat Reader; as Evince does not listen to page events, the `Launch' action must be triggered manually by clicking the link.

pdflatex or lualatex; example-video.mp4, which is not embedded, must be copied into the directory of the PDF:

\documentclass{beamer}
\usepackage{luatex85}

\title{Presentation}

\begin{document}

\begin{frame}
\titlepage
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% `launch' action, triggered on `page-open'
\edef\pdfpageattrSaved{{\the\pdfpageattr}}
\begingroup
\edef\x{\endgroup
  \pdfpageattr{%
    /AA <<  %additional actions for next page
      /O << %on page-open event
        %%%%%%%%% adjust this %%%%%%%%%
        /S/Launch /F(example-movie.mp4)
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      >>
    >>
  }%
}%
\x
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}{With video}
  \leavevmode\pdfstartlink attr {/Subtype/Link} user {/A <<
    %%%%%%%%% adjust this %%%%%%%%%
    /S/Launch /F(example-movie.mp4)
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  >>}%
  Click\pdfendlink\ to trigger `Launch' action manually (Evince).
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% reset no normal behaviour
\expandafter\pdfpageattr\pdfpageattrSaved
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}{The End}
\end{frame}

\end{document}
Related Question