Edit
Notice of obsolescence:
YouTube have dropped their Flash-based video player in Sept 2017. For
the lack of HTML5 support in the PDF specification (and thus by PDF
viewers), YT playback is not possible anymore in an embedded fashion.
Alternatively, the SVG format allows embedded playback of HTML5 video, including YouTube and Vimeo. Package media4svg
is available for this purpose. It requires a workflow via DVI (dvilualatex
/latex
+ dvisvgm
). Example: http://mirrors.ctan.org/macros/latex/contrib/media4svg/example/beamer-example-3.svg
Original answer
\documentclass{article}
\usepackage{media9} %pdflatex, latex+dvips+ps2pdf, xelatex
%\usepackage[dvipdfmx]{media9} %latex+dvipdfmx
\begin{document}
\includemedia[
width=0.6\linewidth,height=0.45\linewidth,
activate=pageopen,
flashvars={
modestbranding=1 % no YT logo in control bar
&autohide=1 % controlbar autohide
&showinfo=0 % no title and other info before start
}
]{}{http://www.youtube.com/v/<video id>?rel=0} % Flash file
\end{document}
<video id>
to be replaced by the video ID, i. e., something like Mdc3o7wOwNA
. More FlashVars for configuring the youtube video player are documented here. Some FlashVars, such as rel=0
, seem to have effect only if appended to the URL.