# Beamer: Autostart video (mp4) on change to slide in external player

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

• If you want to use an external player with autostart, maybe using this viewer: tex.stackexchange.com/a/444158/36296 could help. – samcarter_is_at_topanswers.xyz Sep 5 '18 at 10:58
• unfortunately I even don't have control over the machine on which the presentation is running - but my assumption is that it runs everywhere, if it runs with linux on evince... so unfortunately this player is no option for me. – mathse Sep 5 '18 at 11:24
• This requires the PDF viewer to listen to page events (Open, Close, ...). Evince doesn't as far as I can tell. – AlexG Sep 5 '18 at 11:45

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
/S/Launch /F(example-movie.mp4)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>
>>
}%
}%
\x
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}{With video}
/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}
`
• Mileage may vary with other PDF viewers and on different platforms. – AlexG Sep 5 '18 at 11:31
• Thanks for the answer! Probably the best option for me, I will implement it and hope that it will either work (cause they have Acrobat Reader) or I have a mouse to start it by clicking on my hyperlink myself :) – mathse Sep 5 '18 at 13:25